summaryrefslogtreecommitdiff
path: root/firmware/src
diff options
context:
space:
mode:
authorCamil Staps2016-08-22 22:28:32 +0200
committerCamil Staps2016-08-22 22:28:32 +0200
commit79bb1a9932af7bfcdab67e2a1da9d9edcba87f71 (patch)
treec9f96cd9498d1e24bc646923c5d79d13f310fbeb /firmware/src
parentInitial commit (diff)
old wipold
Diffstat (limited to 'firmware/src')
-rw-r--r--firmware/src/app.c83
-rw-r--r--firmware/src/app.h5
-rw-r--r--firmware/src/keyboard.c119
-rw-r--r--firmware/src/keyboard.h44
-rw-r--r--firmware/src/system_config/default/configuration.xml140
-rw-r--r--firmware/src/system_config/default/default.mhc65
-rw-r--r--firmware/src/system_config/default/framework/system/clk/src/sys_clk_static.c7
-rw-r--r--firmware/src/system_config/default/system_config.h119
-rw-r--r--firmware/src/system_config/default/system_definitions.h17
-rw-r--r--firmware/src/system_config/default/system_init.c147
-rw-r--r--firmware/src/system_config/default/system_interrupt.c17
-rw-r--r--firmware/src/system_config/default/system_tasks.c12
-rw-r--r--firmware/src/system_config/pic32mx695f512h/btl_mx.ld798
-rw-r--r--firmware/src/system_config/pic32mx695f512h/configuration.xml210
-rw-r--r--firmware/src/system_config/pic32mx695f512h/framework/system/clk/src/sys_clk_static.c216
-rw-r--r--firmware/src/system_config/pic32mx695f512h/framework/system/clk/sys_clk_static.h65
-rw-r--r--firmware/src/system_config/pic32mx695f512h/framework/system/ports/src/sys_ports_static.c81
-rw-r--r--firmware/src/system_config/pic32mx695f512h/gfx_hgc_definitions.c248
-rw-r--r--firmware/src/system_config/pic32mx695f512h/gfx_hgc_definitions.h219
-rw-r--r--firmware/src/system_config/pic32mx695f512h/pic32mx695f512h.mhc406
-rw-r--r--firmware/src/system_config/pic32mx695f512h/system_config.h238
-rw-r--r--firmware/src/system_config/pic32mx695f512h/system_definitions.h136
-rw-r--r--firmware/src/system_config/pic32mx695f512h/system_exceptions.c143
-rw-r--r--firmware/src/system_config/pic32mx695f512h/system_init.c336
-rw-r--r--firmware/src/system_config/pic32mx695f512h/system_interrupt.c89
-rw-r--r--firmware/src/system_config/pic32mx695f512h/system_tasks.c104
-rw-r--r--firmware/src/t6963c_specific.h4
27 files changed, 3984 insertions, 84 deletions
diff --git a/firmware/src/app.c b/firmware/src/app.c
index 635c46f..05b9551 100644
--- a/firmware/src/app.c
+++ b/firmware/src/app.c
@@ -19,13 +19,18 @@
*******************************************************************************/
#include "app.h"
-#include "T6963C_PIC/t6963c.h"
-#include "t6963c_specific.h"
-#include "T6963C_PIC/terminal.h"
APP_DATA appData;
static Terminal* term;
+void APP_keyboardHandler(USB_HID_KEYBOARD_KEYPAD);
+void APP_keyboardHandler(USB_HID_KEYBOARD_KEYPAD keyCode) {
+ if (term != NULL) {
+ terminal.append(term, (char*) keyboard_keyValue[keyCode]);
+ terminal.append(term, " - ");
+ }
+}
+
void APP_Initialize (void) {
t6963c_init();
t6963c_clear();
@@ -33,38 +38,62 @@ void APP_Initialize (void) {
term = terminal.construct(t6963c_rows * t6963c_columns);
term->update = t6963c_update_terminal;
+ keyboard_setKeyHandler(APP_keyboardHandler);
+ terminal.append(term, "Initialising... ");
+ if (!keyboard_init()) {
+ terminal.append(term, "failure.\n");
+ } else {
+ terminal.append(term, "success.\n");
+ }
+
appData.state = APP_STATE_MAIN;
}
+bool seen = false;
+
void APP_Tasks (void) {
/* Check the application's current state. */
switch (appData.state) {
/* Application's main state. */
case APP_STATE_MAIN: {
- if (term != NULL) {
- unsigned char* string = "me@pic:~$ ls\nme@pic:~$ mkdir docs\nme@pic:~$ cd docs/\nme@pic:~/docs$ ls\nme@pic:~/docs$ touch doc.txt\nme@pic:~/docs$ ls\ndoc.txt\nme@pic:~/docs$ cat doc.txt\nme@pic:~/docs$ echo hello > doc.txt\nme@pic:~/docs$ cat doc.txt\nhello\nme@pic:~/docs$ cd ..\nme@pic:~$ tree -fFi\n.\n./docs/\n./docs/doc.txt\n\n1 directory, 1 file\nme@pic:~$ rm -r docs/\n";
- unsigned short i, j;
- unsigned char state = 0; // 0 = quick, 1 = slow
- for (i = 0; string[i]; i++) {
- if (!terminal.appendChar(term, string[i])) {
- terminal.free(term);
- t6963c_clear();
- t6963c_set_address(5,5);
- t6963c_writeString("ERROR");
- while (1);
- }
- if (string[i] == '$') {
- state = 1;
- terminal.appendChar(term, string[++i]);
- for (j = 0; j < 10000; j++)
- delay_ns(60000);
- } else if (string[i] == '\n') {
- state = 0;
- }
- if (state)
- for (j = 0; j < 800; j++)
- delay_ns(60000);
- }
+// if (term != NULL) {
+// unsigned char* string = "me@pic:~$ ls\nme@pic:~$ mkdir docs\nme@pic:~$ cd docs/\nme@pic:~/docs$ ls\nme@pic:~/docs$ touch doc.txt\nme@pic:~/docs$ ls\ndoc.txt\nme@pic:~/docs$ cat doc.txt\nme@pic:~/docs$ echo hello > doc.txt\nme@pic:~/docs$ cat doc.txt\nhello\nme@pic:~/docs$ cd ..\nme@pic:~$ tree -fFi\n.\n./docs/\n./docs/doc.txt\n\n1 directory, 1 file\nme@pic:~$ rm -r docs/\n";
+// unsigned short i, j;
+// unsigned char state = 0; // 0 = quick, 1 = slow
+// for (i = 0; string[i]; i++) {
+// if (!terminal.appendChar(term, string[i])) {
+// terminal.free(term);
+// t6963c_clear();
+// t6963c_set_address(5,5);
+// t6963c_writeString("ERROR");
+// while (1);
+// }
+// if (string[i] == '$') {
+// state = 1;
+// terminal.appendChar(term, string[++i]);
+// for (j = 0; j < 10000; j++)
+// delay_ns(60000);
+// } else if (string[i] == '\n') {
+// state = 0;
+// }
+// if (state)
+// for (j = 0; j < 800; j++)
+// delay_ns(60000);
+// }
+// }
+
+ keyboard_handleKeys();
+
+ if (!seen && USB_HOST_BusIsEnabled(0)) {
+ terminal.append(term, "ON\n");
+ char s[5];
+ itoa(s, USB_HOST_Status(sysObj.usbHostObject0), 10);
+ terminal.append(term, s);
+ terminal.append(term, "\n");
+ itoa(s, U1CON, 10);
+ terminal.append(term, s);
+ terminal.append(term, "\n");
+ seen = true;
}
break;
diff --git a/firmware/src/app.h b/firmware/src/app.h
index 50db318..03de612 100644
--- a/firmware/src/app.h
+++ b/firmware/src/app.h
@@ -25,6 +25,11 @@
#include "system_config.h"
#include "system_definitions.h"
+#include "T6963C_PIC/t6963c.h"
+#include "t6963c_specific.h"
+#include "T6963C_PIC/terminal.h"
+#include "keyboard.h"
+
#ifdef __cplusplus // Provide C++ Compatibility
extern "C" {
diff --git a/firmware/src/keyboard.c b/firmware/src/keyboard.c
new file mode 100644
index 0000000..317d232
--- /dev/null
+++ b/firmware/src/keyboard.c
@@ -0,0 +1,119 @@
+#include "keyboard.h"
+#include "system_config.h"
+#include "system_definitions.h"
+#include "system/tmr/sys_tmr.h"
+
+typedef struct {
+ USB_HOST_HID_KEYBOARD_HANDLE handle;
+ USB_HOST_HID_KEYBOARD_DATA data;
+ USB_HOST_HID_KEYBOARD_DATA prevData;
+ bool attached;
+ bool capsLockPressed;
+ void(*keyHandler)(USB_HID_KEYBOARD_KEYPAD);
+} KEYBOARD_STATE;
+
+static KEYBOARD_STATE keyboard_state;
+
+USB_HOST_EVENT_RESPONSE keyboard_hostEventHandler(USB_HOST_EVENT event, void* eventData, uintptr_t context) {
+ if (keyboard_state.keyHandler != NULL) {
+ keyboard_state.keyHandler(USB_HID_KEYBOARD_KEYPAD_KEYBOARD_B);
+ }
+ switch (event) {
+ case USB_HOST_EVENT_DEVICE_UNSUPPORTED:
+ break;
+ case USB_HOST_EVENT_DEVICE_REJECTED_INSUFFICIENT_POWER:
+ break;
+ case USB_HOST_EVENT_HUB_TIER_LEVEL_EXCEEDED:
+ break;
+ case USB_HOST_EVENT_PORT_OVERCURRENT_DETECTED:
+ break;
+ default:
+ break;
+ }
+ if (keyboard_state.keyHandler != NULL) {
+ keyboard_state.keyHandler(USB_HID_KEYBOARD_KEYPAD_KEYBOARD_B);
+ }
+ return USB_HOST_EVENT_RESPONSE_NONE;
+}
+
+void keyboard_hostHIDKeyboardEventHandler(USB_HOST_HID_KEYBOARD_HANDLE handle,
+ USB_HOST_HID_KEYBOARD_EVENT event,
+ void* pData) {
+ if (keyboard_state.keyHandler != NULL) {
+ keyboard_state.keyHandler(USB_HID_KEYBOARD_KEYPAD_KEYBOARD_A);
+ }
+ switch (event) {
+ case USB_HOST_HID_KEYBOARD_EVENT_ATTACH:
+ keyboard_state.handle = handle;
+ keyboard_state.attached = true;
+ keyboard_state.capsLockPressed = false;
+ break;
+ case USB_HOST_HID_KEYBOARD_EVENT_DETACH:
+ keyboard_state.handle = handle;
+ keyboard_state.attached = false;
+ keyboard_state.capsLockPressed = false;
+ break;
+ case USB_HOST_HID_KEYBOARD_EVENT_REPORT_RECEIVED:
+ keyboard_state.handle = handle;
+ memcpy(&keyboard_state.data, pData, sizeof(keyboard_state.data));
+ break;
+ }
+ if (keyboard_state.keyHandler != NULL) {
+ keyboard_state.keyHandler(USB_HID_KEYBOARD_KEYPAD_KEYBOARD_A);
+ }
+}
+
+void BSP_USBVBUSPowerEnable(uint8_t port, bool enable) {
+ TRISBbits.TRISB5 = 0;
+ if (enable) {
+ LATBbits.LATB5 = 1;
+ U1OTGCONbits.VBUSON = 1;
+ } else {
+ LATBbits.LATB5 = 0;
+ U1OTGCONbits.VBUSON = 0;
+ }
+}
+
+bool BSP_USBVBUSSwitchOverCurrentDetect(uint8_t port) {
+ return false;
+}
+
+bool keyboard_init() {
+ USB_HOST_EventHandlerSet(keyboard_hostEventHandler, 0);
+ USB_HOST_HID_KEYBOARD_EventHandlerSet(keyboard_hostHIDKeyboardEventHandler);
+ bool ret = USB_HOST_BusEnable(0) != USB_HOST_RESULT_BUS_UNKNOWN;
+ U1CONbits.SOFEN = 1;
+ return ret;
+}
+
+void keyboard_setKeyHandler(void(*keyHandler)(USB_HID_KEYBOARD_KEYPAD)) {
+ keyboard_state.keyHandler = keyHandler;
+}
+
+void keyboard_handleKeys() {
+ uint8_t i, j;
+ bool foundInPrev;
+
+ for (i = 0; i < 6; i++) {
+ if (keyboard_state.data.nonModifierKeysData[i].event == USB_HID_KEY_PRESSED) {
+ for (j = 0; j < 6; j++) {
+ if (keyboard_state.prevData.nonModifierKeysData[j].event == USB_HID_KEY_PRESSED
+ && keyboard_state.prevData.nonModifierKeysData[j].keyCode == keyboard_state.data.nonModifierKeysData[i].keyCode) {
+ foundInPrev = !(200 <= 1000
+ * (SYS_TMR_SystemCountGet() - keyboard_state.prevData.nonModifierKeysData[j].sysCount)
+ / SYS_TMR_SystemCountFrequencyGet());
+ }
+ }
+ if (!foundInPrev) {
+ if (keyboard_state.data.nonModifierKeysData[i].keyCode == 57) { // Caps lock
+ keyboard_state.capsLockPressed = ~keyboard_state.capsLockPressed;
+ } else {
+ keyboard_state.keyHandler(keyboard_state.data.nonModifierKeysData[i].keyCode);
+ }
+ }
+ foundInPrev = false;
+ }
+ }
+
+ memcpy(&keyboard_state.prevData, &keyboard_state.data, sizeof(keyboard_state.data));
+}
diff --git a/firmware/src/keyboard.h b/firmware/src/keyboard.h
new file mode 100644
index 0000000..3f492e9
--- /dev/null
+++ b/firmware/src/keyboard.h
@@ -0,0 +1,44 @@
+/*
+ * File: keyboard.h
+ * Author: Camil Staps <info@camilstaps.nl>
+ *
+ * Created on August 30, 2015, 11:29 AM
+ */
+
+#ifndef KEYBOARD_H
+#define KEYBOARD_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include "usb/usb_hid.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+bool keyboard_init();
+void keyboard_setKeyHandler(void(*keyHandler)(USB_HID_KEYBOARD_KEYPAD));
+void keyboard_handleKeys(void);
+
+void BSP_USBVBUSPowerEnable(uint8_t port, bool enable);
+bool BSP_USBVBUSSwitchOverCurrentDetect(uint8_t port);
+
+const static char *keyboard_keyValue[] = {
+ "No event indicated", "ErrorRoll Over", "POSTFail", "Error Undefined",
+ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
+ "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
+ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
+ "ENTER", "ESCAPE", "BACKSPACE", "TAB", "SPACEBAR",
+ "-", "=", "[", "]", "\\0", "~", ";", "'", "GRAVE ACCENT", ",", ".", "/",
+ "CAPS LOCK",
+ "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12"
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* KEYBOARD_H */
+
diff --git a/firmware/src/system_config/default/configuration.xml b/firmware/src/system_config/default/configuration.xml
index 4606dcc..7ba7ae5 100644
--- a/firmware/src/system_config/default/configuration.xml
+++ b/firmware/src/system_config/default/configuration.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<configuration version="1.0.6.12">
+<configuration version="1.0.7.9">
<General>
<HarmonyPath path="../../../../opt/microchip/harmony/v1_06"/>
<ForceOptimization flag="false"/>
@@ -7,79 +7,153 @@
<Manifest>
<Files>
<File>
- <Name>sys_devcon_cache_pic32mz.S</Name>
+ <Name>drv_tmr.h</Name>
+ <Path>Header Files/framework/driver/tmr</Path>
+ </File>
+ <File>
+ <Name>sys_devcon.c</Name>
<Path>Source Files/framework/system/devcon/src</Path>
</File>
<File>
- <Name>sys_module.h</Name>
- <Path>Header Files/framework/system/common</Path>
+ <Name>sys_tmr.h</Name>
+ <Path>Header Files/framework/system/tmr</Path>
</File>
<File>
- <Name>sys_devcon.c</Name>
- <Path>Source Files/framework/system/devcon/src</Path>
+ <Name>usb_host.h</Name>
+ <Path>Header Files/framework/usb</Path>
</File>
<File>
- <Name>sys_devcon_cache.h</Name>
- <Path>Header Files/framework/system/devcon</Path>
+ <Name>sys_tmr.c</Name>
+ <Path>Source Files/framework/system/tmr/src</Path>
</File>
<File>
- <Name>sys_common.h</Name>
- <Path>Header Files/framework/system/common</Path>
+ <Name>drv_usbhs.c</Name>
+ <Path>Source Files/framework/driver/usb/usbhs/src/dynamic</Path>
+ </File>
+ <File>
+ <Name>usb_host_hub_interface.h</Name>
+ <Path>Header Files/framework/usb</Path>
+ </File>
+ <File>
+ <Name>usb_host_hid.c</Name>
+ <Path>Source Files/framework/usb/src/dynamic</Path>
</File>
<File>
<Name>sys_ports.h</Name>
<Path>Header Files/framework/system/ports</Path>
</File>
<File>
- <Name>system.h</Name>
- <Path>Header Files/framework/system</Path>
+ <Name>driver.h</Name>
+ <Path>Header Files/framework/driver</Path>
+ </File>
+ <File>
+ <Name>sys_common.h</Name>
+ <Path>Header Files/framework/system/common</Path>
+ </File>
+ <File>
+ <Name>usb_host.c</Name>
+ <Path>Source Files/framework/usb/src/dynamic</Path>
+ </File>
+ <File>
+ <Name>sys_int_pic32.c</Name>
+ <Path>Source Files/framework/system/int/src</Path>
+ </File>
+ <File>
+ <Name>drv_usbhs_host.c</Name>
+ <Path>Source Files/framework/driver/usb/usbhs/src/dynamic</Path>
+ </File>
+ <File>
+ <Name>sys_devcon_cache_pic32mz.S</Name>
+ <Path>Source Files/framework/system/devcon/src</Path>
+ </File>
+ <File>
+ <Name>drv_tmr.c</Name>
+ <Path>Source Files/framework/driver/tmr/src/dynamic</Path>
</File>
<File>
<Name>sys_ports.c</Name>
<Path>Source Files/framework/system/ports/src</Path>
</File>
<File>
+ <Name>usb_host_hid.h</Name>
+ <Path>Header Files/framework/usb</Path>
+ </File>
+ <File>
+ <Name>sys_devcon_cache.h</Name>
+ <Path>Header Files/framework/system/devcon</Path>
+ </File>
+ <File>
<Name>sys_devcon.h</Name>
<Path>Header Files/framework/system/devcon</Path>
</File>
<File>
+ <Name>system.h</Name>
+ <Path>Header Files/framework/system</Path>
+ </File>
+ <File>
+ <Name>sys_module.h</Name>
+ <Path>Header Files/framework/system/common</Path>
+ </File>
+ <File>
<Name>sys_devcon_pic32mz.c</Name>
<Path>Source Files/framework/system/devcon/src</Path>
</File>
+ <File>
+ <Name>usb_host_hid_keyboard.c</Name>
+ <Path>Source Files/framework/usb/src/dynamic</Path>
+ </File>
+ <File>
+ <Name>sys_int.h</Name>
+ <Path>Header Files/framework/system/int</Path>
+ </File>
+ <File>
+ <Name>drv_usb.h</Name>
+ <Path>Header Files/framework/driver/usb</Path>
+ </File>
</Files>
<Templates>
<Template>
+ <Name>system_init.c</Name>
+ <Path>Source Files/app/system_config/default</Path>
+ <Checksum>AB64567D43967E351B3AE21A3512770A</Checksum>
+ </Template>
+ <Template>
+ <Name>sys_ports_static.c</Name>
+ <Path>Source Files/app/system_config/default/framework/system/ports/src</Path>
+ <Checksum>5F2394E93856B6D50B7274ADB5A4FF75</Checksum>
+ </Template>
+ <Template>
<Name>main.c</Name>
<Path>Source Files/app</Path>
</Template>
<Template>
+ <Name>system_tasks.c</Name>
+ <Path>Source Files/app/system_config/default</Path>
+ <Checksum>06DAEF54F88A42FADBE944B8C42A9A8E</Checksum>
+ </Template>
+ <Template>
<Name>system_exceptions.c</Name>
<Path>Source Files/app/system_config/default</Path>
<Checksum>C111969CA43D6CEA1E9E33A6164E7AE0</Checksum>
</Template>
<Template>
- <Name>app.c</Name>
- <Path>Source Files/app</Path>
+ <Name>system_config.h</Name>
+ <Path>Header Files/app/system_config/default</Path>
+ <Checksum>2E2753D416790B8746872ED19CBD7EBD</Checksum>
</Template>
<Template>
- <Name>system_config.h</Name>
+ <Name>system_definitions.h</Name>
<Path>Header Files/app/system_config/default</Path>
- <Checksum>AACDE55E44291B8ECCFF86EB2C6D3F1B</Checksum>
+ <Checksum>311DEBE3E7CC645F2B04685A22F1A574</Checksum>
</Template>
<Template>
- <Name>system_init.c</Name>
- <Path>Source Files/app/system_config/default</Path>
- <Checksum>A20E6051172F14BA64FD464630B2D979</Checksum>
+ <Name>app.h</Name>
+ <Path>Header Files/app</Path>
</Template>
<Template>
<Name>system_interrupt.c</Name>
<Path>Source Files/app/system_config/default</Path>
- <Checksum>9AC33B2960C8DF72C5EB0E3662303FF4</Checksum>
- </Template>
- <Template>
- <Name>sys_ports_static.c</Name>
- <Path>Source Files/app/system_config/default/framework/system/ports/src</Path>
- <Checksum>5F2394E93856B6D50B7274ADB5A4FF75</Checksum>
+ <Checksum>A9E8E9E6AB62025075023812C9644167</Checksum>
</Template>
<Template>
<Name>sys_clk_static.h</Name>
@@ -87,23 +161,13 @@
<Checksum>999179DADE9ECD59953526F5E9F83ACC</Checksum>
</Template>
<Template>
- <Name>app.h</Name>
- <Path>Header Files/app</Path>
- </Template>
- <Template>
<Name>sys_clk_static.c</Name>
<Path>Source Files/app/system_config/default/framework/system/clk/src</Path>
- <Checksum>58CE0B253D4367C188EB62895C501C46</Checksum>
+ <Checksum>AD2A48FC4F748121617EE487C9AD8911</Checksum>
</Template>
<Template>
- <Name>system_tasks.c</Name>
- <Path>Source Files/app/system_config/default</Path>
- <Checksum>BE644D0142ACA48D9CA2E6255A02CDBA</Checksum>
- </Template>
- <Template>
- <Name>system_definitions.h</Name>
- <Path>Header Files/app/system_config/default</Path>
- <Checksum>08B5EB4F7D9B07DBF06AD124A3AC99C1</Checksum>
+ <Name>app.c</Name>
+ <Path>Source Files/app</Path>
</Template>
</Templates>
<Libraries>
diff --git a/firmware/src/system_config/default/default.mhc b/firmware/src/system_config/default/default.mhc
index 94fdc77..bb5dcaa 100644
--- a/firmware/src/system_config/default/default.mhc
+++ b/firmware/src/system_config/default/default.mhc
@@ -1,6 +1,6 @@
#
-# Configuration generated by Microchip Harmony Configurator (MHC) v1.0.6.12
-# Project name: PIC32MZ_harmony_tryout
+# Configuration generated by Microchip Harmony Configurator (MHC) v1.0.7.9
+# Project name: CText
# Configuration: default
# Device: PIC32MZ2048ECG064
# Harmony version: 1.06
@@ -147,7 +147,23 @@ CONFIG_USE_DRV_SST25VF064C=n
#
# from $HARMONY_VERSION_PATH/framework/driver/tmr/config/drv_tmr.hconfig
#
-CONFIG_USE_DRV_TMR=n
+CONFIG_USE_DRV_TMR=y
+CONFIG_DRV_TMR_DRIVER_MODE="DYNAMIC"
+CONFIG_DRV_TMR_CLIENTS_NUMBER=1
+CONFIG_DRV_TMR_INTERRUPT_MODE=y
+CONFIG_DRV_TMR_INSTANCES_NUMBER=1
+#
+# from $HARMONY_VERSION_PATH/framework/driver/tmr/config/drv_tmr_idx.ftl
+#
+CONFIG_DRV_TMR_INST_0=y
+CONFIG_DRV_TMR_PERIPHERAL_ID_IDX0="TMR_ID_1"
+CONFIG_DRV_TMR_INTERRUPT_PRIORITY_IDX0="INT_PRIORITY_LEVEL1"
+CONFIG_DRV_TMR_INTERRUPT_SUB_PRIORITY_IDX0="INT_SUBPRIORITY_LEVEL0"
+CONFIG_DRV_TMR_CLOCK_SOURCE_IDX0="DRV_TMR_CLKSOURCE_INTERNAL"
+CONFIG_DRV_TMR_PRESCALE_IDX0="TMR_PRESCALE_VALUE_256"
+CONFIG_DRV_TMR_OPERATION_MODE_IDX0="DRV_TMR_OPERATION_MODE_16_BIT"
+CONFIG_DRV_TMR_ASYNC_WRITE_ENABLE_IDX0=n
+CONFIG_DRV_TMR_POWER_STATE_IDX0="SYS_MODULE_POWER_RUN_FULL"
#
# from $HARMONY_VERSION_PATH/framework/driver/touch/adc10bit/config/drv_adc10bit.hconfig
#
@@ -199,7 +215,8 @@ CONFIG_SYS_CLK_PBCLK2_ENABLE=y
CONFIG_SYS_CLK_PBDIV2=2
CONFIG_SYS_CLK_PBCLK3_ENABLE=y
CONFIG_SYS_CLK_PBDIV3=2
-CONFIG_SYS_CLK_PBCLK4_ENABLE=n
+CONFIG_SYS_CLK_PBCLK4_ENABLE=y
+CONFIG_SYS_CLK_PBDIV4=1
CONFIG_SYS_CLK_PBCLK6_ENABLE=y
CONFIG_SYS_CLK_PBDIV6=1
CONFIG_SYS_CLK_PBCLK7_ENABLE=n
@@ -213,6 +230,7 @@ CONFIG_SYS_CLK_FREQ="80000000"
CONFIG_SYS_CLK_PBCLK0_FREQ="40000000"
CONFIG_SYS_CLK_PBCLK2_FREQ="40000000"
CONFIG_SYS_CLK_PBCLK3_FREQ="40000000"
+CONFIG_SYS_CLK_PBCLK4_FREQ="80000000"
CONFIG_SYS_CLK_PBCLK6_FREQ="80000000"
#
# from $HARMONY_VERSION_PATH/framework/system/command/config/sys_command.hconfig
@@ -249,7 +267,7 @@ CONFIG_USE_SYS_FS=n
#
# from $HARMONY_VERSION_PATH/framework/system/int/config/sys_int.hconfig
#
-CONFIG_USE_SYS_INT=n
+CONFIG_USE_SYS_INT=y
CONFIG_USE_EXT_INT=n
#
# from $HARMONY_VERSION_PATH/framework/system/msg/config/sys_msg.hconfig
@@ -265,8 +283,8 @@ CONFIG_USE_SYS_PORTS_CN_INTERRUPT=n
# from $HARMONY_VERSION_PATH/framework/system/ports/config/sys_ports_idx.ftl
#
CONFIG_USE_PORT_B=y
-CONFIG_SYS_PORT_B_ANSEL=0x0
-CONFIG_SYS_PORT_B_TRIS=0x0
+CONFIG_SYS_PORT_B_ANSEL=0x7020
+CONFIG_SYS_PORT_B_TRIS=0x7020
CONFIG_SYS_PORT_B_LAT=0x0
CONFIG_SYS_PORT_B_ODC=0x0
CONFIG_SYS_PORT_B_CNPU=0x0
@@ -327,7 +345,15 @@ CONFIG_USE_SYS_TOUCH=n
#
# from $HARMONY_VERSION_PATH/framework/system/tmr/config/sys_tmr.hconfig
#
-CONFIG_USE_SYS_TMR=n
+CONFIG_USE_SYS_TMR=y
+CONFIG_SYS_TMR_POWER_STATE="SYS_MODULE_POWER_RUN_FULL"
+CONFIG_SYS_TMR_DRIVER_INDEX="DRV_TMR_INDEX_0"
+CONFIG_SYS_TMR_MAX_CLIENT_OBJECTS=5
+CONFIG_SYS_TMR_FREQUENCY=1000
+CONFIG_SYS_TMR_FREQUENCY_TOLERANCE=10
+CONFIG_SYS_TMR_UNIT_RESOLUTION=10000
+CONFIG_SYS_TMR_CLIENT_TOLERANCE=10
+CONFIG_SYS_TMR_INTERRUPT_NOTIFICATION=n
#
# from $HARMONY_VERSION_PATH/framework/system/wdt/config/sys_wdt.hconfig
#
@@ -339,7 +365,26 @@ CONFIG_USE_TCPIP_STACK=n
#
# from $HARMONY_VERSION_PATH/framework/usb/config/usb.hconfig
#
-CONFIG_USE_USB_STACK=n
+CONFIG_USE_USB_STACK=y
+CONFIG_DRV_USB_INTERRUPT_MODE=y
+CONFIG_DRV_USB_DEVICE_SUPPORT=n
+CONFIG_DRV_USB_HOST_SUPPORT=y
+CONFIG_DRV_USB_BETA_SW_HOST_SUPPORT=n
+CONFIG_USB_HOST_SPEED_HS_IDX0="USB_SPEED_HIGH"
+CONFIG_USB_HOST_DEVICE_NUMBER=1
+CONFIG_USB_HOST_TPL_ENTRY_NUMBER=1
+CONFIG_USB_HOST_MAX_INTERFACES=5
+CONFIG_USB_HOST_USE_HUB=n
+CONFIG_USB_HOST_USE_CDC=n
+CONFIG_USB_HOST_USE_HID=y
+CONFIG_USB_HOST_USE_MOUSE=n
+CONFIG_USB_HOST_USE_KEYBOARD=y
+CONFIG_USB_HOST_HID_NUMBER_OF_INSTANCES=1
+CONFIG_USB_HOST_HID_INTERRUPT_IN_ENDPOINTS_NUMBER=1
+CONFIG_USB_HID_TOTAL_USAGE_DRIVER_INSTANCES=1
+CONFIG_USB_HID_GLOBAL_PUSH_POP_STACK_SIZE=1
+CONFIG_USB_HOST_USE_AUDIO=n
+CONFIG_USB_HOST_USE_MSD=n
#
# from $HARMONY_VERSION_PATH/framework/sample/config/sample_module.hconfig
#
@@ -399,7 +444,7 @@ CONFIG_FPLLRNG="RANGE_5_10_MHZ"
CONFIG_FPLLICLK="PLL_FRC"
CONFIG_FPLLMULT="MUL_80"
CONFIG_FPLLODIV="DIV_8"
-CONFIG_UPLLFSEL="FREQ_12MHZ"
+CONFIG_UPLLFSEL="FREQ_24MHZ"
CONFIG_UPLLEN="OFF"
CONFIG_FNOSC="SPLL"
CONFIG_DMTINTV="WIN_127_128"
diff --git a/firmware/src/system_config/default/framework/system/clk/src/sys_clk_static.c b/firmware/src/system_config/default/framework/system/clk/src/sys_clk_static.c
index 06a146b..7f01b06 100644
--- a/firmware/src/system_config/default/framework/system/clk/src/sys_clk_static.c
+++ b/firmware/src/system_config/default/framework/system/clk/src/sys_clk_static.c
@@ -104,9 +104,9 @@ void SYS_CLK_Initialize( const SYS_CLK_INIT const * clkInit )
/* Enable Peripheral Bus 4 */
PLIB_OSC_PBClockDivisorSet (OSC_ID_0, 3, 2 );
PLIB_OSC_PBOutputClockEnable (OSC_ID_0, 3 );
- /* Disable Peripheral Bus 5 */
- PLIB_OSC_PBOutputClockDisable (OSC_ID_0, 4 );
-
+ /* Enable Peripheral Bus 5 */
+ PLIB_OSC_PBClockDivisorSet (OSC_ID_0, 4, 1 );
+ PLIB_OSC_PBOutputClockEnable (OSC_ID_0, 4 );
/* Enable Peripheral Bus 7 */
PLIB_OSC_PBClockDivisorSet (OSC_ID_0, 6, 1 );
PLIB_OSC_PBOutputClockEnable (OSC_ID_0, 6 );
@@ -219,6 +219,7 @@ inline uint32_t SYS_CLK_PeripheralFrequencyGet ( CLK_BUSES_PERIPHERAL peripheral
freq = SYS_CLK_BUS_PERIPHERAL_4;
break;
case CLK_BUS_PERIPHERAL_5:
+ freq = SYS_CLK_BUS_PERIPHERAL_5;
break;
case CLK_BUS_PERIPHERAL_7:
freq = SYS_CLK_BUS_PERIPHERAL_7;
diff --git a/firmware/src/system_config/default/system_config.h b/firmware/src/system_config/default/system_config.h
index a8faed8..2f506cc 100644
--- a/firmware/src/system_config/default/system_config.h
+++ b/firmware/src/system_config/default/system_config.h
@@ -85,14 +85,18 @@ SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
#define SYS_CLK_BUS_PERIPHERAL_1 40000000ul
#define SYS_CLK_BUS_PERIPHERAL_3 40000000ul
#define SYS_CLK_BUS_PERIPHERAL_4 40000000ul
+#define SYS_CLK_BUS_PERIPHERAL_5 80000000ul
#define SYS_CLK_BUS_PERIPHERAL_7 80000000ul
#define SYS_CLK_CONFIG_PRIMARY_XTAL 24000000ul
#define SYS_CLK_CONFIG_SECONDARY_XTAL 32768ul
+/*** Interrupt System Service Configuration ***/
+#define SYS_INT true
+
/*** Ports System Service Configuration ***/
-#define SYS_PORT_B_ANSEL 0x0
-#define SYS_PORT_B_TRIS 0x0
+#define SYS_PORT_B_ANSEL 0x7020
+#define SYS_PORT_B_TRIS 0x7020
#define SYS_PORT_B_LAT 0x0
#define SYS_PORT_B_ODC 0x0
#define SYS_PORT_B_CNPU 0x0
@@ -137,6 +141,15 @@ SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
#define SYS_PORT_G_CNPU 0x0
#define SYS_PORT_G_CNPD 0x0
#define SYS_PORT_G_CNEN 0x0
+/*** Timer System Service Configuration ***/
+#define SYS_TMR_POWER_STATE SYS_MODULE_POWER_RUN_FULL
+#define SYS_TMR_DRIVER_INDEX DRV_TMR_INDEX_0
+#define SYS_TMR_MAX_CLIENT_OBJECTS 5
+#define SYS_TMR_FREQUENCY 1000
+#define SYS_TMR_FREQUENCY_TOLERANCE 10
+#define SYS_TMR_UNIT_RESOLUTION 10000
+#define SYS_TMR_CLIENT_TOLERANCE 10
+#define SYS_TMR_INTERRUPT_NOTIFICATION false
// *****************************************************************************
@@ -145,13 +158,113 @@ SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
// *****************************************************************************
// *****************************************************************************
-
+/*** Timer Driver Configuration ***/
+#define DRV_TMR_INSTANCES_NUMBER 1
+#define DRV_TMR_CLIENTS_NUMBER 1
+#define DRV_TMR_INTERRUPT_MODE true
+
+/*** Timer Driver 0 Configuration ***/
+#define DRV_TMR_PERIPHERAL_ID_IDX0 TMR_ID_1
+#define DRV_TMR_INTERRUPT_SOURCE_IDX0 INT_SOURCE_TIMER_1
+#define DRV_TMR_INTERRUPT_VECTOR_IDX0 INT_VECTOR_T1
+#define DRV_TMR_ISR_VECTOR_IDX0 _TIMER_1_VECTOR
+#define DRV_TMR_INTERRUPT_PRIORITY_IDX0 INT_PRIORITY_LEVEL1
+#define DRV_TMR_INTERRUPT_SUB_PRIORITY_IDX0 INT_SUBPRIORITY_LEVEL0
+#define DRV_TMR_CLOCK_SOURCE_IDX0 DRV_TMR_CLKSOURCE_INTERNAL
+#define DRV_TMR_PRESCALE_IDX0 TMR_PRESCALE_VALUE_256
+#define DRV_TMR_OPERATION_MODE_IDX0 DRV_TMR_OPERATION_MODE_16_BIT
+#define DRV_TMR_ASYNC_WRITE_ENABLE_IDX0 false
+#define DRV_TMR_POWER_STATE_IDX0 SYS_MODULE_POWER_RUN_FULL
+
+
+
// *****************************************************************************
// *****************************************************************************
// Section: Middleware & Other Library Configuration
// *****************************************************************************
// *****************************************************************************
+/*** USB Driver Configuration ***/
+
+
+/* Disable Device Support */
+#define DRV_USBHS_DEVICE_SUPPORT false
+
+/* Enables Device Support */
+#define DRV_USBHS_HOST_SUPPORT true
+
+/* Maximum USB driver instances */
+#define DRV_USBHS_INSTANCES_NUMBER 1
+
+
+/* Interrupt mode enabled */
+#define DRV_USBHS_INTERRUPT_MODE true
+
+
+/* Number of Endpoints used */
+#define DRV_USBHS_ENDPOINTS_NUMBER 1
+
+
+
+
+
+
+
+#define DRV_USBHS_HOST_NAK_LIMIT 2000
+/* Provides Host pipes number */
+#define DRV_USBHS_HOST_PIPES_NUMBER 10
+#define DRV_USBHS_HOST_ATTACH_DEBOUNCE_DURATION 500
+#define DRV_USBHS_HOST_RESET_DURATION 100
+// *****************************************************************************
+// *****************************************************************************
+// Section: USB Device Layer Configuration
+// *****************************************************************************
+// *****************************************************************************
+/* Provides Host pipes number */
+#define USB_HOST_PIPES_NUMBER 10
+/* NAK Limit for Control transfer data stage and Status Stage */
+#define DRV_USB_HOST_NAK_LIMIT 200
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: USB Host Layer Configuration
+// *****************************************************************************
+// **************************************************************************
+
+/* Total number of devices to be supported */
+#define USB_HOST_DEVICES_NUMBER 1
+
+/* Target peripheral list entries */
+#define USB_HOST_TPL_ENTRIES 1
+
+/* Maximum number of configurations supported per device */
+#define USB_HOST_DEVICE_INTERFACES_NUMBER 5
+
+#define USB_HOST_CONTROLLERS_NUMBER 1
+
+#define USB_HOST_TRANSFERS_NUMBER 10
+
+/* Number of Host Layer Clients */
+#define USB_HOST_CLIENTS_NUMBER 1
+
+
+/* Number of HID Client driver instances in the application */
+#define USB_HOST_HID_INSTANCES_NUMBER 1
+
+/* Maximum number of INTERRUPT IN endpoints supported per HID interface */
+#define USB_HOST_HID_INTERRUPT_IN_ENDPOINTS_NUMBER 1
+
+/* Number of total usage driver instances registered with HID client driver */
+#define USB_HOST_HID_USAGE_DRIVER_SUPPORT_NUMBER 1
+
+/* Maximum number PUSH items that can be saved in the Global item queue per field
+ * per HID interface */
+#define USB_HID_GLOBAL_PUSH_POP_STACK_SIZE 1
+
+
+
+
+
diff --git a/firmware/src/system_config/default/system_definitions.h b/firmware/src/system_config/default/system_definitions.h
index 5bc5468..5a20414 100644
--- a/firmware/src/system_config/default/system_definitions.h
+++ b/firmware/src/system_config/default/system_definitions.h
@@ -55,9 +55,18 @@ SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
#include "system/clk/sys_clk.h"
#include "system/clk/sys_clk_static.h"
#include "system/devcon/sys_devcon.h"
+#include "system/int/sys_int.h"
+#include "system/tmr/sys_tmr.h"
+#include "driver/tmr/drv_tmr.h"
#include "system/ports/sys_ports.h"
+#include "driver/usb/usbhs/drv_usbhs.h"
+#include "usb/usb_host.h"
+#include "usb/usb_host_hub.h"
+#include "usb/usb_host_hub_interface.h"
+#include "usb/usb_host_hid.h"
+#include "usb/usb_host_hid_keyboard.h"
#include "app.h"
@@ -93,6 +102,13 @@ extern "C" {
typedef struct
{
SYS_MODULE_OBJ sysDevcon;
+ SYS_MODULE_OBJ sysTmr;
+ SYS_MODULE_OBJ drvTmr0;
+ SYS_MODULE_OBJ drvUSBObject;
+
+
+ SYS_MODULE_OBJ usbHostObject0;
+
} SYSTEM_OBJECTS;
@@ -106,6 +122,7 @@ typedef struct
extern SYSTEM_OBJECTS sysObj;
+
//DOM-IGNORE-BEGIN
#ifdef __cplusplus
}
diff --git a/firmware/src/system_config/default/system_init.c b/firmware/src/system_config/default/system_init.c
index 9c69c4e..7a25752 100644
--- a/firmware/src/system_config/default/system_init.c
+++ b/firmware/src/system_config/default/system_init.c
@@ -95,7 +95,7 @@ SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
#pragma config FPLLICLK = PLL_FRC
#pragma config FPLLMULT = MUL_80
#pragma config FPLLODIV = DIV_8
-#pragma config UPLLFSEL = FREQ_12MHZ
+#pragma config UPLLFSEL = FREQ_24MHZ
#pragma config UPLLEN = OFF
/*** DEVCFG3 ***/
@@ -121,6 +121,96 @@ SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
// *****************************************************************************
// *****************************************************************************
+//<editor-fold defaultstate="collapsed" desc="USB Stack Initialization Data">
+
+// </editor-fold>
+
+//<editor-fold defaultstate="collapsed" desc="USB Host Initialization Data">
+
+
+
+/****************************************************
+ * Endpoint Table needed by the controller driver .
+ ****************************************************/
+
+
+
+DRV_USBHS_INIT drvUSBHSInit =
+{
+ .moduleInit = {SYS_MODULE_POWER_RUN_FULL},
+ .interruptSource = INT_SOURCE_USB_1,
+ .interruptSourceUSBDma = INT_SOURCE_USB_1_DMA,
+ .operationMode = DRV_USBHS_OPMODE_HOST,
+ .operationSpeed = USB_SPEED_HIGH,
+ .portIndication = NULL,
+ .portPowerEnable = BSP_USBVBUSPowerEnable,
+ .portOverCurrentDetect = BSP_USBVBUSSwitchOverCurrentDetect,
+ .rootHubAvailableCurrent = 500,
+ .stopInIdle = false,
+ .suspendInSleep = false,
+ .usbID = USBHS_ID_0
+
+};
+
+
+
+USB_HOST_HID_USAGE_DRIVER_INTERFACE usageDriverInterface =
+{
+ .initialize = NULL,
+ .deinitialize = NULL,
+ .usageDriverEventHandler = _USB_HOST_HID_KEYBOARD_EventHandler,
+ .usageDriverTask = _USB_HOST_HID_KEYBOARD_Task
+};
+
+USB_HOST_HID_USAGE_DRIVER_TABLE_ENTRY usageDriverTableEntry[1] =
+{
+ {
+ .usage = USB_HID_GENERIC_DESKTOP_KEYBOARD,
+ .initializeData = NULL,
+ .interface = &usageDriverInterface
+ }
+};
+
+
+USB_HOST_HID_INIT hidInitData =
+{
+ .nUsageDriver = 1,
+ .usageDriverTable = usageDriverTableEntry
+};
+const USB_HOST_TPL_ENTRY USBTPList[ 1 ] =
+{
+
+
+
+ TPL_INTERFACE_CLASS_SUBCLASS_PROTOCOL(0x03, 0x01, 0x01, &hidInitData, USB_HOST_HID_INTERFACE) ,
+
+
+
+
+};
+
+
+const USB_HOST_HCD hcdTable =
+{
+ .drvIndex = DRV_USBHS_INDEX_0,
+ .hcdInterface = DRV_USBHS_HOST_INTERFACE
+};
+
+const USB_HOST_INIT usbHostInitData =
+{
+ .nTPLEntries = 1 ,
+ .tplList = (USB_HOST_TPL_ENTRY *)USBTPList,
+ .hostControllerDrivers = (USB_HOST_HCD *)&hcdTable
+
+};
+
+
+
+
+
+
+// </editor-fold>
+
// *****************************************************************************
@@ -129,6 +219,33 @@ SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
// *****************************************************************************
// *****************************************************************************
+//<editor-fold defaultstate="collapsed" desc="DRV_Timer Initialization Data">
+
+/*** TMR Driver Initialization Data ***/
+
+const DRV_TMR_INIT drvTmr0InitData =
+{
+ .moduleInit.sys.powerState = DRV_TMR_POWER_STATE_IDX0,
+ .tmrId = DRV_TMR_PERIPHERAL_ID_IDX0,
+ .clockSource = DRV_TMR_CLOCK_SOURCE_IDX0,
+ .prescale = DRV_TMR_PRESCALE_IDX0,
+ .mode = DRV_TMR_OPERATION_MODE_IDX0,
+ .interruptSource = DRV_TMR_INTERRUPT_SOURCE_IDX0,
+ .asyncWriteEnable = false,
+};
+// </editor-fold>
+//<editor-fold defaultstate="collapsed" desc="SYS_TMR Initialization Data">
+/*** TMR Service Initialization Data ***/
+const SYS_TMR_INIT sysTmrInitData =
+{
+ .moduleInit = {SYS_MODULE_POWER_RUN_FULL},
+ .drvIndex = DRV_TMR_INDEX_0,
+ .tmrFreq = 1000,
+};
+
+// </editor-fold>
+//<editor-fold defaultstate="collapsed" desc="DRV_USB Initialization Data">
+// </editor-fold>
// *****************************************************************************
// *****************************************************************************
@@ -195,10 +312,38 @@ void SYS_Initialize ( void* data )
/* Initialize Drivers */
+ sysObj.drvTmr0 = DRV_TMR_Initialize(DRV_TMR_INDEX_0, (SYS_MODULE_INIT *)&drvTmr0InitData);
+
+ SYS_INT_VectorPrioritySet(INT_VECTOR_T1, INT_PRIORITY_LEVEL1);
+ SYS_INT_VectorSubprioritySet(INT_VECTOR_T1, INT_SUBPRIORITY_LEVEL0);
+
+
+
/* Initialize System Services */
+ SYS_INT_Initialize();
+
+ /*** TMR Service Initialization Code ***/
+ sysObj.sysTmr = SYS_TMR_Initialize(SYS_TMR_INDEX_0, (const SYS_MODULE_INIT * const)&sysTmrInitData);
/* Initialize Middleware */
+
+ sysObj.usbHostObject0 = USB_HOST_Initialize ((SYS_MODULE_INIT *)& usbHostInitData );
+ sysObj.drvUSBObject = DRV_USBHS_Initialize (DRV_USBHS_INDEX_0, (SYS_MODULE_INIT *) &drvUSBHSInit);
+
+ SYS_INT_VectorPrioritySet(INT_VECTOR_USB1, INT_PRIORITY_LEVEL4);
+ SYS_INT_VectorSubprioritySet(INT_VECTOR_USB1, INT_SUBPRIORITY_LEVEL0);
+
+ /* Set the priority of the USB DMA Interrupt */
+ SYS_INT_VectorPrioritySet(INT_VECTOR_USB1_DMA, INT_PRIORITY_LEVEL4);
+ /* Set Sub-priority of the USB DMA Interrupt */
+ SYS_INT_VectorSubprioritySet(INT_VECTOR_USB1_DMA, INT_SUBPRIORITY_LEVEL0);
+
+
+
+ /* Enable Global Interrupts */
+ SYS_INT_Enable();
+
/* Initialize the Application */
APP_Initialize();
}
diff --git a/firmware/src/system_config/default/system_interrupt.c b/firmware/src/system_config/default/system_interrupt.c
index a676c11..0d0c030 100644
--- a/firmware/src/system_config/default/system_interrupt.c
+++ b/firmware/src/system_config/default/system_interrupt.c
@@ -70,6 +70,23 @@ SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
// Section: System Interrupt Vector Functions
// *****************************************************************************
// *****************************************************************************
+void __ISR(_TIMER_1_VECTOR, ipl1AUTO) _IntHandlerDrvTmrInstance0(void)
+{
+
+ DRV_TMR_Tasks_ISR(sysObj.drvTmr0);
+
+}
+ void __ISR( _USB_VECTOR , IPL4AUTO)_IntHandler_USB_stub ( void )
+{
+ DRV_USBHS_Tasks_ISR(sysObj.drvUSBObject);
+}
+void __ISR ( _USB_DMA_VECTOR, IPL4AUTO) _IntHandlerUSBInstance0_USBDMA ( void )
+{
+ DRV_USBHS_Tasks_ISR_USBDMA(sysObj.drvUSBObject);
+
+}
+
+
/*******************************************************************************
End of File
diff --git a/firmware/src/system_config/default/system_tasks.c b/firmware/src/system_config/default/system_tasks.c
index 14c834d..1ae8a24 100644
--- a/firmware/src/system_config/default/system_tasks.c
+++ b/firmware/src/system_config/default/system_tasks.c
@@ -74,11 +74,23 @@ void SYS_Tasks ( void )
{
/* Maintain system services */
SYS_DEVCON_Tasks(sysObj.sysDevcon);
+ SYS_TMR_Tasks(sysObj.sysTmr);
/* Maintain Device Drivers */
+ DRV_TMR_Tasks(sysObj.drvTmr0);
/* Maintain Middleware & Other Libraries */
+
+ /* USBHS Driver Task Routine */
+ DRV_USBHS_Tasks(sysObj.drvUSBObject);
+
+
+ /* USB Host layer task routine.*/
+ USB_HOST_Tasks(sysObj.usbHostObject0);
+
+
+
/* Maintain the application's state machine. */
APP_Tasks();
diff --git a/firmware/src/system_config/pic32mx695f512h/btl_mx.ld b/firmware/src/system_config/pic32mx695f512h/btl_mx.ld
new file mode 100644
index 0000000..f41053f
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/btl_mx.ld
@@ -0,0 +1,798 @@
+/*--------------------------------------------------------------------------
+ * MPLAB XC Compiler - PIC32MX695F512H linker script
+ * Build date : May 01 2015
+ *
+ * Copyright (c) 2015, Microchip Technology Inc. and its subsidiaries ("Microchip")
+ * All rights reserved.
+ *
+ * This software is developed by Microchip Technology Inc. and its
+ * subsidiaries ("Microchip").
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. Microchip's name may not be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY MICROCHIP "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL MICROCHIP BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWSOEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/* Default linker script, for normal executables */
+
+/* IMPORTANT: PIC32MX MCUs use two files for the default linker script:
+ * 1) pic32mx/lib/ldscripts/elf32pic32.x (main linker script)
+ * 2) pic32mx/lib/proc/32MX695F512H/procdefs.ld (variant-specific fragment)
+ *
+ * This file is provided only as a convenience when adding a custom linker script
+ * to your application.
+ */
+
+OUTPUT_FORMAT("elf32-tradlittlemips")
+OUTPUT_ARCH(pic32mx)
+ENTRY(_reset)
+/*
+ * Provide for a minimum stack and heap size
+ * - _min_stack_size - represents the minimum space that must be made
+ * available for the stack. Can be overridden from
+ * the command line using the linker's --defsym option.
+ * - _min_heap_size - represents the minimum space that must be made
+ * available for the heap. Must be specified on
+ * the command line using the linker's --defsym option.
+ */
+EXTERN (_min_stack_size _min_heap_size)
+PROVIDE(_min_stack_size = 0x400) ;
+
+/*************************************************************************
+ * Processor-specific object file. Contains SFR definitions.
+ *************************************************************************/
+INPUT("processor.o")
+
+/*************************************************************************
+ * Processor-specific peripheral libraries are optional
+ *************************************************************************/
+OPTIONAL("libmchp_peripheral.a")
+OPTIONAL("libmchp_peripheral_32MX695F512H.a")
+
+/*************************************************************************
+ * For interrupt vector handling
+ *************************************************************************/
+PROVIDE(_vector_spacing = 0x00000001);
+_ebase_address = 0x9D00E000;
+
+/*************************************************************************
+ * Memory Address Equates
+ * _RESET_ADDR -- Reset Vector
+ * _BEV_EXCPT_ADDR -- Boot exception Vector
+ * _DBG_EXCPT_ADDR -- In-circuit Debugging Exception Vector
+ * _DBG_CODE_ADDR -- In-circuit Debug Executive address
+ * _DBG_CODE_SIZE -- In-circuit Debug Executive size
+ * _GEN_EXCPT_ADDR -- General Exception Vector
+ *************************************************************************/
+_RESET_ADDR = 0x9D00F000;
+_BEV_EXCPT_ADDR = 0x9D00F380;
+_DBG_EXCPT_ADDR = 0x9D00F480;
+_DBG_CODE_ADDR = 0xBFC02000;
+_DBG_CODE_SIZE = 0xFF0;
+_GEN_EXCPT_ADDR = _ebase_address + 0x180;
+
+/*************************************************************************
+ * Memory Regions
+ *
+ * Memory regions without attributes cannot be used for orphaned sections.
+ * Only sections specifically assigned to these regions can be allocated
+ * into these regions.
+ *
+ * The Debug exception vector is located at 0x9FC00480.
+ *
+ * The config_<address> sections are used to locate the config words at
+ * their absolute addresses.
+ *************************************************************************/
+MEMORY
+{
+ kseg0_program_mem (rx) : ORIGIN = 0x9d00F490, LENGTH = 0x70b70
+ kseg0_boot_mem : ORIGIN = 0x9d00E000, LENGTH = 0x0
+ exception_mem : ORIGIN = 0x9D00E000, LENGTH = 0x200
+ config3 : ORIGIN = 0xBFC02FF0, LENGTH = 0x4
+ config2 : ORIGIN = 0xBFC02FF4, LENGTH = 0x4
+ config1 : ORIGIN = 0xBFC02FF8, LENGTH = 0x4
+ config0 : ORIGIN = 0xBFC02FFC, LENGTH = 0x4
+ kseg1_boot_mem : ORIGIN = 0x9d00F000, LENGTH = 0x490
+ kseg1_data_mem (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x20000
+ sfrs : ORIGIN = 0xBF800000, LENGTH = 0x100000
+ debug_exec_mem : ORIGIN = 0xBFC02000, LENGTH = 0xFF0
+ configsfrs : ORIGIN = 0xBFC02FF0, LENGTH = 0x10
+}
+
+/*************************************************************************
+ * Configuration-word sections. Map the config-pragma input sections to
+ * absolute-address output sections.
+ *************************************************************************/
+SECTIONS
+{
+ .config_BFC02FF0 : {
+ KEEP(*(.config_BFC02FF0))
+ } > config3
+ .config_BFC02FF4 : {
+ KEEP(*(.config_BFC02FF4))
+ } > config2
+ .config_BFC02FF8 : {
+ KEEP(*(.config_BFC02FF8))
+ } > config1
+ .config_BFC02FFC : {
+ KEEP(*(.config_BFC02FFC))
+ } > config0
+}
+SECTIONS
+{
+ /* Boot Sections */
+ .reset _RESET_ADDR :
+ {
+ KEEP(*(.reset))
+ KEEP(*(.reset.startup))
+ } > kseg1_boot_mem
+ .bev_excpt _BEV_EXCPT_ADDR :
+ {
+ KEEP(*(.bev_handler))
+ } > kseg1_boot_mem
+ /* Debug exception vector */
+ .dbg_excpt _DBG_EXCPT_ADDR (NOLOAD) :
+ {
+ . += (DEFINED (_DEBUGGER) ? 0x8 : 0x0);
+ } > kseg1_boot_mem
+ /* Space reserved for the debug executive */
+ .dbg_code _DBG_CODE_ADDR (NOLOAD) :
+ {
+ . += (DEFINED (_DEBUGGER) ? _DBG_CODE_SIZE : 0x0);
+ } > debug_exec_mem
+
+ .app_excpt _GEN_EXCPT_ADDR :
+ {
+ KEEP(*(.gen_handler))
+ } > exception_mem
+
+ .vector_0 _ebase_address + 0x200 + ((_vector_spacing << 5) * 0) :
+ {
+ KEEP(*(.vector_0))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_0) <= (_vector_spacing << 5), "function at exception vector 0 too large")
+ .vector_1 _ebase_address + 0x200 + ((_vector_spacing << 5) * 1) :
+ {
+ KEEP(*(.vector_1))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_1) <= (_vector_spacing << 5), "function at exception vector 1 too large")
+ .vector_2 _ebase_address + 0x200 + ((_vector_spacing << 5) * 2) :
+ {
+ KEEP(*(.vector_2))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_2) <= (_vector_spacing << 5), "function at exception vector 2 too large")
+ .vector_3 _ebase_address + 0x200 + ((_vector_spacing << 5) * 3) :
+ {
+ KEEP(*(.vector_3))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_3) <= (_vector_spacing << 5), "function at exception vector 3 too large")
+ .vector_4 _ebase_address + 0x200 + ((_vector_spacing << 5) * 4) :
+ {
+ KEEP(*(.vector_4))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_4) <= (_vector_spacing << 5), "function at exception vector 4 too large")
+ .vector_5 _ebase_address + 0x200 + ((_vector_spacing << 5) * 5) :
+ {
+ KEEP(*(.vector_5))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_5) <= (_vector_spacing << 5), "function at exception vector 5 too large")
+ .vector_6 _ebase_address + 0x200 + ((_vector_spacing << 5) * 6) :
+ {
+ KEEP(*(.vector_6))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_6) <= (_vector_spacing << 5), "function at exception vector 6 too large")
+ .vector_7 _ebase_address + 0x200 + ((_vector_spacing << 5) * 7) :
+ {
+ KEEP(*(.vector_7))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_7) <= (_vector_spacing << 5), "function at exception vector 7 too large")
+ .vector_8 _ebase_address + 0x200 + ((_vector_spacing << 5) * 8) :
+ {
+ KEEP(*(.vector_8))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_8) <= (_vector_spacing << 5), "function at exception vector 8 too large")
+ .vector_9 _ebase_address + 0x200 + ((_vector_spacing << 5) * 9) :
+ {
+ KEEP(*(.vector_9))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_9) <= (_vector_spacing << 5), "function at exception vector 9 too large")
+ .vector_10 _ebase_address + 0x200 + ((_vector_spacing << 5) * 10) :
+ {
+ KEEP(*(.vector_10))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_10) <= (_vector_spacing << 5), "function at exception vector 10 too large")
+ .vector_11 _ebase_address + 0x200 + ((_vector_spacing << 5) * 11) :
+ {
+ KEEP(*(.vector_11))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_11) <= (_vector_spacing << 5), "function at exception vector 11 too large")
+ .vector_12 _ebase_address + 0x200 + ((_vector_spacing << 5) * 12) :
+ {
+ KEEP(*(.vector_12))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_12) <= (_vector_spacing << 5), "function at exception vector 12 too large")
+ .vector_13 _ebase_address + 0x200 + ((_vector_spacing << 5) * 13) :
+ {
+ KEEP(*(.vector_13))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_13) <= (_vector_spacing << 5), "function at exception vector 13 too large")
+ .vector_14 _ebase_address + 0x200 + ((_vector_spacing << 5) * 14) :
+ {
+ KEEP(*(.vector_14))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_14) <= (_vector_spacing << 5), "function at exception vector 14 too large")
+ .vector_15 _ebase_address + 0x200 + ((_vector_spacing << 5) * 15) :
+ {
+ KEEP(*(.vector_15))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_15) <= (_vector_spacing << 5), "function at exception vector 15 too large")
+ .vector_16 _ebase_address + 0x200 + ((_vector_spacing << 5) * 16) :
+ {
+ KEEP(*(.vector_16))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_16) <= (_vector_spacing << 5), "function at exception vector 16 too large")
+ .vector_17 _ebase_address + 0x200 + ((_vector_spacing << 5) * 17) :
+ {
+ KEEP(*(.vector_17))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_17) <= (_vector_spacing << 5), "function at exception vector 17 too large")
+ .vector_18 _ebase_address + 0x200 + ((_vector_spacing << 5) * 18) :
+ {
+ KEEP(*(.vector_18))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_18) <= (_vector_spacing << 5), "function at exception vector 18 too large")
+ .vector_19 _ebase_address + 0x200 + ((_vector_spacing << 5) * 19) :
+ {
+ KEEP(*(.vector_19))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_19) <= (_vector_spacing << 5), "function at exception vector 19 too large")
+ .vector_20 _ebase_address + 0x200 + ((_vector_spacing << 5) * 20) :
+ {
+ KEEP(*(.vector_20))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_20) <= (_vector_spacing << 5), "function at exception vector 20 too large")
+ .vector_21 _ebase_address + 0x200 + ((_vector_spacing << 5) * 21) :
+ {
+ KEEP(*(.vector_21))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_21) <= (_vector_spacing << 5), "function at exception vector 21 too large")
+ .vector_22 _ebase_address + 0x200 + ((_vector_spacing << 5) * 22) :
+ {
+ KEEP(*(.vector_22))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_22) <= (_vector_spacing << 5), "function at exception vector 22 too large")
+ .vector_23 _ebase_address + 0x200 + ((_vector_spacing << 5) * 23) :
+ {
+ KEEP(*(.vector_23))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_23) <= (_vector_spacing << 5), "function at exception vector 23 too large")
+ .vector_24 _ebase_address + 0x200 + ((_vector_spacing << 5) * 24) :
+ {
+ KEEP(*(.vector_24))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_24) <= (_vector_spacing << 5), "function at exception vector 24 too large")
+ .vector_25 _ebase_address + 0x200 + ((_vector_spacing << 5) * 25) :
+ {
+ KEEP(*(.vector_25))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_25) <= (_vector_spacing << 5), "function at exception vector 25 too large")
+ .vector_26 _ebase_address + 0x200 + ((_vector_spacing << 5) * 26) :
+ {
+ KEEP(*(.vector_26))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_26) <= (_vector_spacing << 5), "function at exception vector 26 too large")
+ .vector_27 _ebase_address + 0x200 + ((_vector_spacing << 5) * 27) :
+ {
+ KEEP(*(.vector_27))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_27) <= (_vector_spacing << 5), "function at exception vector 27 too large")
+ .vector_28 _ebase_address + 0x200 + ((_vector_spacing << 5) * 28) :
+ {
+ KEEP(*(.vector_28))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_28) <= (_vector_spacing << 5), "function at exception vector 28 too large")
+ .vector_29 _ebase_address + 0x200 + ((_vector_spacing << 5) * 29) :
+ {
+ KEEP(*(.vector_29))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_29) <= (_vector_spacing << 5), "function at exception vector 29 too large")
+ .vector_30 _ebase_address + 0x200 + ((_vector_spacing << 5) * 30) :
+ {
+ KEEP(*(.vector_30))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_30) <= (_vector_spacing << 5), "function at exception vector 30 too large")
+ .vector_31 _ebase_address + 0x200 + ((_vector_spacing << 5) * 31) :
+ {
+ KEEP(*(.vector_31))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_31) <= (_vector_spacing << 5), "function at exception vector 31 too large")
+ .vector_32 _ebase_address + 0x200 + ((_vector_spacing << 5) * 32) :
+ {
+ KEEP(*(.vector_32))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_32) <= (_vector_spacing << 5), "function at exception vector 32 too large")
+ .vector_33 _ebase_address + 0x200 + ((_vector_spacing << 5) * 33) :
+ {
+ KEEP(*(.vector_33))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_33) <= (_vector_spacing << 5), "function at exception vector 33 too large")
+ .vector_34 _ebase_address + 0x200 + ((_vector_spacing << 5) * 34) :
+ {
+ KEEP(*(.vector_34))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_34) <= (_vector_spacing << 5), "function at exception vector 34 too large")
+ .vector_35 _ebase_address + 0x200 + ((_vector_spacing << 5) * 35) :
+ {
+ KEEP(*(.vector_35))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_35) <= (_vector_spacing << 5), "function at exception vector 35 too large")
+ .vector_36 _ebase_address + 0x200 + ((_vector_spacing << 5) * 36) :
+ {
+ KEEP(*(.vector_36))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_36) <= (_vector_spacing << 5), "function at exception vector 36 too large")
+ .vector_37 _ebase_address + 0x200 + ((_vector_spacing << 5) * 37) :
+ {
+ KEEP(*(.vector_37))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_37) <= (_vector_spacing << 5), "function at exception vector 37 too large")
+ .vector_38 _ebase_address + 0x200 + ((_vector_spacing << 5) * 38) :
+ {
+ KEEP(*(.vector_38))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_38) <= (_vector_spacing << 5), "function at exception vector 38 too large")
+ .vector_39 _ebase_address + 0x200 + ((_vector_spacing << 5) * 39) :
+ {
+ KEEP(*(.vector_39))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_39) <= (_vector_spacing << 5), "function at exception vector 39 too large")
+ .vector_40 _ebase_address + 0x200 + ((_vector_spacing << 5) * 40) :
+ {
+ KEEP(*(.vector_40))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_40) <= (_vector_spacing << 5), "function at exception vector 40 too large")
+ .vector_41 _ebase_address + 0x200 + ((_vector_spacing << 5) * 41) :
+ {
+ KEEP(*(.vector_41))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_41) <= (_vector_spacing << 5), "function at exception vector 41 too large")
+ .vector_42 _ebase_address + 0x200 + ((_vector_spacing << 5) * 42) :
+ {
+ KEEP(*(.vector_42))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_42) <= (_vector_spacing << 5), "function at exception vector 42 too large")
+ .vector_43 _ebase_address + 0x200 + ((_vector_spacing << 5) * 43) :
+ {
+ KEEP(*(.vector_43))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_43) <= (_vector_spacing << 5), "function at exception vector 43 too large")
+ .vector_44 _ebase_address + 0x200 + ((_vector_spacing << 5) * 44) :
+ {
+ KEEP(*(.vector_44))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_44) <= (_vector_spacing << 5), "function at exception vector 44 too large")
+ .vector_45 _ebase_address + 0x200 + ((_vector_spacing << 5) * 45) :
+ {
+ KEEP(*(.vector_45))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_45) <= (_vector_spacing << 5), "function at exception vector 45 too large")
+ .vector_46 _ebase_address + 0x200 + ((_vector_spacing << 5) * 46) :
+ {
+ KEEP(*(.vector_46))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_46) <= (_vector_spacing << 5), "function at exception vector 46 too large")
+ .vector_47 _ebase_address + 0x200 + ((_vector_spacing << 5) * 47) :
+ {
+ KEEP(*(.vector_47))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_47) <= (_vector_spacing << 5), "function at exception vector 47 too large")
+ .vector_48 _ebase_address + 0x200 + ((_vector_spacing << 5) * 48) :
+ {
+ KEEP(*(.vector_48))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_48) <= (_vector_spacing << 5), "function at exception vector 48 too large")
+ .vector_49 _ebase_address + 0x200 + ((_vector_spacing << 5) * 49) :
+ {
+ KEEP(*(.vector_49))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_49) <= (_vector_spacing << 5), "function at exception vector 49 too large")
+ .vector_50 _ebase_address + 0x200 + ((_vector_spacing << 5) * 50) :
+ {
+ KEEP(*(.vector_50))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_50) <= (_vector_spacing << 5), "function at exception vector 50 too large")
+ .vector_51 _ebase_address + 0x200 + ((_vector_spacing << 5) * 51) :
+ {
+ KEEP(*(.vector_51))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_51) <= (_vector_spacing << 5), "function at exception vector 51 too large")
+ .vector_52 _ebase_address + 0x200 + ((_vector_spacing << 5) * 52) :
+ {
+ KEEP(*(.vector_52))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_52) <= (_vector_spacing << 5), "function at exception vector 52 too large")
+ .vector_53 _ebase_address + 0x200 + ((_vector_spacing << 5) * 53) :
+ {
+ KEEP(*(.vector_53))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_53) <= (_vector_spacing << 5), "function at exception vector 53 too large")
+ .vector_54 _ebase_address + 0x200 + ((_vector_spacing << 5) * 54) :
+ {
+ KEEP(*(.vector_54))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_54) <= (_vector_spacing << 5), "function at exception vector 54 too large")
+ .vector_55 _ebase_address + 0x200 + ((_vector_spacing << 5) * 55) :
+ {
+ KEEP(*(.vector_55))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_55) <= (_vector_spacing << 5), "function at exception vector 55 too large")
+ .vector_56 _ebase_address + 0x200 + ((_vector_spacing << 5) * 56) :
+ {
+ KEEP(*(.vector_56))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_56) <= (_vector_spacing << 5), "function at exception vector 56 too large")
+ .vector_57 _ebase_address + 0x200 + ((_vector_spacing << 5) * 57) :
+ {
+ KEEP(*(.vector_57))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_57) <= (_vector_spacing << 5), "function at exception vector 57 too large")
+ .vector_58 _ebase_address + 0x200 + ((_vector_spacing << 5) * 58) :
+ {
+ KEEP(*(.vector_58))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_58) <= (_vector_spacing << 5), "function at exception vector 58 too large")
+ .vector_59 _ebase_address + 0x200 + ((_vector_spacing << 5) * 59) :
+ {
+ KEEP(*(.vector_59))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_59) <= (_vector_spacing << 5), "function at exception vector 59 too large")
+ .vector_60 _ebase_address + 0x200 + ((_vector_spacing << 5) * 60) :
+ {
+ KEEP(*(.vector_60))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_60) <= (_vector_spacing << 5), "function at exception vector 60 too large")
+ .vector_61 _ebase_address + 0x200 + ((_vector_spacing << 5) * 61) :
+ {
+ KEEP(*(.vector_61))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_61) <= (_vector_spacing << 5), "function at exception vector 61 too large")
+ .vector_62 _ebase_address + 0x200 + ((_vector_spacing << 5) * 62) :
+ {
+ KEEP(*(.vector_62))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_62) <= (_vector_spacing << 5), "function at exception vector 62 too large")
+ .vector_63 _ebase_address + 0x200 + ((_vector_spacing << 5) * 63) :
+ {
+ KEEP(*(.vector_63))
+ } > exception_mem
+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_63) <= (_vector_spacing << 5), "function at exception vector 63 too large")
+
+ /* The startup code is in the .reset.startup section.
+ * Keep this here for backwards compatibility with older
+ * C32 v1.xx releases.
+ */
+ .startup ORIGIN(kseg0_boot_mem) :
+ {
+ KEEP(*(.startup))
+ } > kseg0_boot_mem
+
+ /* Code Sections - Note that input sections *(.text) and *(.text.*)
+ * are not mapped here. The best-fit allocator locates them,
+ * so that .text may flow around absolute sections as needed.
+ */
+ .text :
+ {
+ *(.stub .gnu.linkonce.t.*)
+ KEEP (*(.text.*personality*))
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+ *(.gnu.warning)
+ . = ALIGN(4) ;
+ } >kseg0_program_mem
+ /* Global-namespace object initialization */
+ .init :
+ {
+ KEEP (*crti.o(.init))
+ KEEP (*crtbegin.o(.init))
+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *crtn.o ).init))
+ KEEP (*crtend.o(.init))
+ KEEP (*crtn.o(.init))
+ . = ALIGN(4) ;
+ } >kseg0_program_mem
+ .fini :
+ {
+ KEEP (*(.fini))
+ . = ALIGN(4) ;
+ } >kseg0_program_mem
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ . = ALIGN(4) ;
+ } >kseg0_program_mem
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ . = ALIGN(4) ;
+ } >kseg0_program_mem
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ . = ALIGN(4) ;
+ } >kseg0_program_mem
+ .ctors :
+ {
+ /* XC32 uses crtbegin.o to find the start of
+ the constructors, so we make sure it is
+ first. Because this is a wildcard, it
+ doesn't matter if the user does not
+ actually link against crtbegin.o; the
+ linker won't look for a file to match a
+ wildcard. The wildcard also means that it
+ doesn't matter which directory crtbegin.o
+ is in. */
+ KEEP (*crtbegin.o(.ctors))
+ KEEP (*crtbegin?.o(.ctors))
+ /* We don't want to include the .ctor section from
+ the crtend.o file until after the sorted ctors.
+ The .ctor section from the crtend file contains the
+ end of ctors marker and it must be last */
+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ . = ALIGN(4) ;
+ } >kseg0_program_mem
+ .dtors :
+ {
+ KEEP (*crtbegin.o(.dtors))
+ KEEP (*crtbegin?.o(.dtors))
+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ . = ALIGN(4) ;
+ } >kseg0_program_mem
+ /* Read-only sections */
+ .rodata :
+ {
+ *( .gnu.linkonce.r.*)
+ *(.rodata1)
+ . = ALIGN(4) ;
+ } >kseg0_program_mem
+ /*
+ * Small initialized constant global and static data can be placed in the
+ * .sdata2 section. This is different from .sdata, which contains small
+ * initialized non-constant global and static data.
+ */
+ .sdata2 ALIGN(4) :
+ {
+ *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
+ . = ALIGN(4) ;
+ } >kseg0_program_mem
+ /*
+ * Uninitialized constant global and static data (i.e., variables which will
+ * always be zero). Again, this is different from .sbss, which contains
+ * small non-initialized, non-constant global and static data.
+ */
+ .sbss2 ALIGN(4) :
+ {
+ *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
+ . = ALIGN(4) ;
+ } >kseg0_program_mem
+ .eh_frame_hdr :
+ {
+ *(.eh_frame_hdr)
+ } >kseg0_program_mem
+ . = ALIGN(4) ;
+ .eh_frame : ONLY_IF_RO
+ {
+ KEEP (*(.eh_frame))
+ } >kseg0_program_mem
+ . = ALIGN(4) ;
+ .gcc_except_table : ONLY_IF_RO
+ {
+ *(.gcc_except_table .gcc_except_table.*)
+ } >kseg0_program_mem
+ . = ALIGN(4) ;
+ .dbg_data (NOLOAD) :
+ {
+ . += (DEFINED (_DEBUGGER) ? 0x200 : 0x0);
+ } >kseg1_data_mem
+ .jcr :
+ {
+ KEEP (*(.jcr))
+ . = ALIGN(4) ;
+ } >kseg1_data_mem
+ .eh_frame : ONLY_IF_RW
+ {
+ KEEP (*(.eh_frame))
+ } >kseg1_data_mem
+ . = ALIGN(4) ;
+ .gcc_except_table : ONLY_IF_RW
+ {
+ *(.gcc_except_table .gcc_except_table.*)
+ } >kseg1_data_mem
+ . = ALIGN(4) ;
+ /* Persistent data - Use the new C 'persistent' attribute instead. */
+ .persist :
+ {
+ _persist_begin = .;
+ *(.persist .persist.*)
+ *(.pbss .pbss.*)
+ . = ALIGN(4) ;
+ _persist_end = .;
+ } >kseg1_data_mem
+ /*
+ * Note that input sections named .data* are not mapped here.
+ * The best-fit allocator locates them, so that they may flow
+ * around absolute sections as needed.
+ */
+ .data :
+ {
+ *( .gnu.linkonce.d.*)
+ SORT(CONSTRUCTORS)
+ *(.data1)
+ . = ALIGN(4) ;
+ } >kseg1_data_mem
+ . = .;
+ _gp = ALIGN(16) + 0x7ff0;
+ .got ALIGN(4) :
+ {
+ *(.got.plt) *(.got)
+ . = ALIGN(4) ;
+ } >kseg1_data_mem /* AT>kseg0_program_mem */
+ /*
+ * Note that 'small' data sections are still mapped in the linker
+ * script. This ensures that they are grouped together for
+ * gp-relative addressing. Absolute sections are allocated after
+ * the 'small' data sections so small data cannot flow around them.
+ */
+ /*
+ * We want the small data sections together, so single-instruction offsets
+ * can access them all, and initialized data all before uninitialized, so
+ * we can shorten the on-disk segment size.
+ */
+ .sdata ALIGN(4) :
+ {
+ _sdata_begin = . ;
+ *(.sdata .sdata.* .gnu.linkonce.s.*)
+ . = ALIGN(4) ;
+ _sdata_end = . ;
+ } >kseg1_data_mem
+ .lit8 :
+ {
+ *(.lit8)
+ } >kseg1_data_mem
+ .lit4 :
+ {
+ *(.lit4)
+ } >kseg1_data_mem
+ . = ALIGN (4) ;
+ _data_end = . ;
+ _bss_begin = . ;
+ .sbss ALIGN(4) :
+ {
+ _sbss_begin = . ;
+ *(.dynsbss)
+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
+ *(.scommon)
+ _sbss_end = . ;
+ . = ALIGN(4) ;
+ } >kseg1_data_mem
+ /*
+ * Align here to ensure that the .bss section occupies space up to
+ * _end. Align after .bss to ensure correct alignment even if the
+ * .bss section disappears because there are no input sections.
+ *
+ * Note that input sections named .bss* are no longer mapped here.
+ * The best-fit allocator locates them, so that they may flow
+ * around absolute sections as needed.
+ *
+ */
+ .bss :
+ {
+ *(.dynbss)
+ *(COMMON)
+ /* Align here to ensure that the .bss section occupies space up to
+ _end. Align after .bss to ensure correct alignment even if the
+ .bss section disappears because there are no input sections. */
+ . = ALIGN(. != 0 ? 4 : 1);
+ } >kseg1_data_mem
+ . = ALIGN(4) ;
+ _end = . ;
+ _bss_end = . ;
+ /*
+ * The heap and stack are best-fit allocated by the linker after other
+ * data and bss sections have been allocated.
+ */
+ /*
+ * RAM functions go at the end of our stack and heap allocation.
+ * Alignment of 2K required by the boundary register (BMXDKPBA).
+ *
+ * RAM functions are now allocated by the linker. The linker generates
+ * _ramfunc_begin and _bmxdkpba_address symbols depending on the
+ * location of RAM functions.
+ */
+ _bmxdudba_address = LENGTH(kseg1_data_mem) ;
+ _bmxdupba_address = LENGTH(kseg1_data_mem) ;
+ /* The .pdr section belongs in the absolute section */
+ /DISCARD/ : { *(.pdr) }
+ .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
+ .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
+ .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) }
+ .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) }
+ .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) }
+ .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) }
+ .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) }
+ .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) }
+ .gcc_compiled_long32 : { KEEP(*(.gcc_compiled_long32)) }
+ .gcc_compiled_long64 : { KEEP(*(.gcc_compiled_long64)) }
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ /* DWARF debug sections used by MPLAB X for source-level debugging.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ /* SGI/MIPS DWARF 2 extensions */
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+ .debug_pubtypes 0 : { *(.debug_pubtypes) }
+ .debug_ranges 0 : { *(.debug_ranges) }
+ /DISCARD/ : { *(.rel.dyn) }
+ .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
+ /DISCARD/ : { *(.note.GNU-stack) }
+ /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.discard) }
+}
+
diff --git a/firmware/src/system_config/pic32mx695f512h/configuration.xml b/firmware/src/system_config/pic32mx695f512h/configuration.xml
new file mode 100644
index 0000000..de96ab1
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/configuration.xml
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<configuration version="1.0.7.9">
+ <Designer>
+ <Assets>
+ <Settings bpp="16">
+ <MemoryLocations>
+ <MemoryLocation address="0" id="default"/>
+ </MemoryLocations>
+ </Settings>
+ </Assets>
+ <Screens height="200" width="320">
+ <Screen active="true" background="000000" clearOnShow="true" export="true" name="Screen1" primary="true" visible="true">
+ <Objects/>
+ </Screen>
+ </Screens>
+ <Schemes defaultSchemeName="default">
+ <Scheme name="default">
+ <Alpha>100</Alpha>
+ <BackgroundOffset>0,0</BackgroundOffset>
+ <EmbossSize>3</EmbossSize>
+ <Colors>
+ <Primary>FFFFFF</Primary>
+ <Secondary>404040</Secondary>
+ <Disabled>C0C0C0</Disabled>
+ <Background>000000</Background>
+ <EmbossLight>C0C0C0</EmbossLight>
+ <EmbossDark>404040</EmbossDark>
+ <TextPrimary>000000</TextPrimary>
+ <TextSecondary>FFFFFF</TextSecondary>
+ <TextDisabled>404040</TextDisabled>
+ <GradientStart>000000</GradientStart>
+ <GradientEnd>FFFFFF</GradientEnd>
+ </Colors>
+ <FillStyle>Color</FillStyle>
+ <BackgroundType>None</BackgroundType>
+ </Scheme>
+ </Schemes>
+ </Designer>
+ <General>
+ <HarmonyPath path="../../../../opt/microchip/harmony/v1_06"/>
+ <ForceOptimization flag="true"/>
+ </General>
+ <Manifest>
+ <Files>
+ <File>
+ <Name>drv_usbfs.c</Name>
+ <Path>Source Files/framework/driver/usb/usbfs/src/dynamic</Path>
+ </File>
+ <File>
+ <Name>drv_tmr.h</Name>
+ <Path>Header Files/framework/driver/tmr</Path>
+ </File>
+ <File>
+ <Name>sys_devcon.c</Name>
+ <Path>Source Files/framework/system/devcon/src</Path>
+ </File>
+ <File>
+ <Name>drv_tmr.c</Name>
+ <Path>Source Files/framework/driver/tmr/src/dynamic</Path>
+ </File>
+ <File>
+ <Name>sys_tmr.h</Name>
+ <Path>Header Files/framework/system/tmr</Path>
+ </File>
+ <File>
+ <Name>sys_ports.c</Name>
+ <Path>Source Files/framework/system/ports/src</Path>
+ </File>
+ <File>
+ <Name>sys_tmr.c</Name>
+ <Path>Source Files/framework/system/tmr/src</Path>
+ </File>
+ <File>
+ <Name>usb_host.h</Name>
+ <Path>Header Files/framework/usb</Path>
+ </File>
+ <File>
+ <Name>usb_host_hid.h</Name>
+ <Path>Header Files/framework/usb</Path>
+ </File>
+ <File>
+ <Name>sys_devcon.h</Name>
+ <Path>Header Files/framework/system/devcon</Path>
+ </File>
+ <File>
+ <Name>system.h</Name>
+ <Path>Header Files/framework/system</Path>
+ </File>
+ <File>
+ <Name>usb_host_hub_interface.h</Name>
+ <Path>Header Files/framework/usb</Path>
+ </File>
+ <File>
+ <Name>usb_host_hid.c</Name>
+ <Path>Source Files/framework/usb/src/dynamic</Path>
+ </File>
+ <File>
+ <Name>sys_module.h</Name>
+ <Path>Header Files/framework/system/common</Path>
+ </File>
+ <File>
+ <Name>sys_ports.h</Name>
+ <Path>Header Files/framework/system/ports</Path>
+ </File>
+ <File>
+ <Name>sys_devcon_pic32mx.c</Name>
+ <Path>Source Files/framework/system/devcon/src</Path>
+ </File>
+ <File>
+ <Name>drv_usbfs_host.c</Name>
+ <Path>Source Files/framework/driver/usb/usbfs/src/dynamic</Path>
+ </File>
+ <File>
+ <Name>usb_host_hid_keyboard.c</Name>
+ <Path>Source Files/framework/usb/src/dynamic</Path>
+ </File>
+ <File>
+ <Name>driver.h</Name>
+ <Path>Header Files/framework/driver</Path>
+ </File>
+ <File>
+ <Name>sys_common.h</Name>
+ <Path>Header Files/framework/system/common</Path>
+ </File>
+ <File>
+ <Name>sys_int_pic32.c</Name>
+ <Path>Source Files/framework/system/int/src</Path>
+ </File>
+ <File>
+ <Name>usb_host.c</Name>
+ <Path>Source Files/framework/usb/src/dynamic</Path>
+ </File>
+ <File>
+ <Name>sys_int.h</Name>
+ <Path>Header Files/framework/system/int</Path>
+ </File>
+ <File>
+ <Name>drv_usb.h</Name>
+ <Path>Header Files/framework/driver/usb</Path>
+ </File>
+ </Files>
+ <Templates>
+ <Template>
+ <Name>main.c</Name>
+ <Path>Source Files/app</Path>
+ </Template>
+ <Template>
+ <Name>system_tasks.c</Name>
+ <Path>Source Files/app/system_config/pic32mx695f512h</Path>
+ <Checksum>B4CB1F5B13561E07FA1E606E7D65176C</Checksum>
+ </Template>
+ <Template>
+ <Name>system_interrupt.c</Name>
+ <Path>Source Files/app/system_config/pic32mx695f512h</Path>
+ <Checksum>C1F87F2B27FDEE2F775A9D071102B6CE</Checksum>
+ </Template>
+ <Template>
+ <Name>system_config.h</Name>
+ <Path>Header Files/app/system_config/pic32mx695f512h</Path>
+ <Checksum>39015131093CE7970BF85F37A2919DDE</Checksum>
+ </Template>
+ <Template>
+ <Name>app.c</Name>
+ <Path>Source Files/app</Path>
+ </Template>
+ <Template>
+ <Name>sys_ports_static.c</Name>
+ <Path>Source Files/app/system_config/pic32mx695f512h/framework/system/ports/src</Path>
+ <Checksum>8C22202B87CB917EECD35DF44DED33EA</Checksum>
+ </Template>
+ <Template>
+ <Name>system_definitions.h</Name>
+ <Path>Header Files/app/system_config/pic32mx695f512h</Path>
+ <Checksum>EFD06A1C13E6C533C64C308BFF681244</Checksum>
+ </Template>
+ <Template>
+ <Name>system_exceptions.c</Name>
+ <Path>Source Files/app/system_config/pic32mx695f512h</Path>
+ <Checksum>C111969CA43D6CEA1E9E33A6164E7AE0</Checksum>
+ </Template>
+ <Template>
+ <Name>sys_clk_static.h</Name>
+ <Path>Header Files/app/system_config/pic32mx695f512h/framework/system/clk</Path>
+ <Checksum>999179DADE9ECD59953526F5E9F83ACC</Checksum>
+ </Template>
+ <Template>
+ <Name>sys_clk_static.c</Name>
+ <Path>Source Files/app/system_config/pic32mx695f512h/framework/system/clk/src</Path>
+ <Checksum>1B968DA82B5DD869A6119C3B7628D753</Checksum>
+ </Template>
+ <Template>
+ <Name>app.h</Name>
+ <Path>Header Files/app</Path>
+ </Template>
+ <Template>
+ <Name>system_init.c</Name>
+ <Path>Source Files/app/system_config/pic32mx695f512h</Path>
+ <Checksum>DA033280A90158D9C345EF049A33AB51</Checksum>
+ </Template>
+ <Template>
+ <Name>btl_mx.ld</Name>
+ <Path>Linker Files/system_config/pic32mx695f512h</Path>
+ <Checksum>95603DFB49B136E1C6B184C901573CD1</Checksum>
+ </Template>
+ </Templates>
+ <Libraries>
+ <Library value="../../../../../../opt/microchip/harmony/v1_06/bin/framework/peripheral/PIC32MX695F512H_peripherals.a"/>
+ </Libraries>
+ </Manifest>
+</configuration>
diff --git a/firmware/src/system_config/pic32mx695f512h/framework/system/clk/src/sys_clk_static.c b/firmware/src/system_config/pic32mx695f512h/framework/system/clk/src/sys_clk_static.c
new file mode 100644
index 0000000..837a4fb
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/framework/system/clk/src/sys_clk_static.c
@@ -0,0 +1,216 @@
+/*******************************************************************************
+ SYS CLK Static Functions for Clock System Service
+
+ Company:
+ Microchip Technology Inc.
+
+ File Name:
+ sys_clk_static.c
+
+ Summary:
+ SYS CLK static function implementations for the Clock System Service.
+
+ Description:
+ The Clock System Service provides a simple interface to manage the oscillators
+ on Microchip microcontrollers. This file defines the static implementation for the
+ Clock System Service.
+
+ Remarks:
+ Static functions incorporate all system clock configuration settings as
+ determined by the user via the Microchip Harmony Configurator GUI. It provides
+ static version of the routines, eliminating the need for an object ID or
+ object handle.
+
+ Static single-open interfaces also eliminate the need for the open handle.
+*******************************************************************************/
+
+//DOM-IGNORE-BEGIN
+/*******************************************************************************
+Copyright (c) 2014 released Microchip Technology Inc. All rights reserved.
+
+Microchip licenses to you the right to use, modify, copy and distribute
+Software only when embedded on a Microchip microcontroller or digital signal
+controller that is integrated into your product or third party product
+(pursuant to the sublicense terms in the accompanying license agreement).
+
+You should refer to the license agreement accompanying this Software for
+additional information regarding your rights and obligations.
+
+SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
+IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
+CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
+OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
+INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
+CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
+SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
+(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
+*******************************************************************************/
+//DOM-IGNORE-END
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Include Files
+// *****************************************************************************
+// *****************************************************************************
+
+#include "system_config.h"
+#include "system_definitions.h"
+#include "peripheral/osc/plib_osc.h"
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: File Scope Functions
+// *****************************************************************************
+// *****************************************************************************
+
+// *****************************************************************************
+/* Function:
+ void SYS_CLK_Static_Initialize ( const SYS_CLK_INIT const * clkInit )
+
+ Summary:
+ Initializes hardware and internal data structure of the System Clock.
+
+ Description:
+ This function initializes the hardware and internal data structure of System
+ Clock Service.
+
+ Remarks:
+ This is configuration values for the static version of the Clock System Service
+ module is determined by the user via the Microchip Harmony Configurator GUI.
+ This template will build a sys_clk_static.h and sys_clk_static.c file with
+ the configuration per the user's choice.
+
+ The objective is to eliminate the user's need to be knowledgeable in the function of
+ the 'configuration bits' to configure the system oscillators.
+*/
+
+void SYS_CLK_Initialize( const SYS_CLK_INIT const * clkInit )
+{
+ SYS_DEVCON_SystemUnlock ( );
+
+ PLIB_OSC_FRCDivisorSelect( OSC_ID_0, OSC_FRC_DIV_2);
+
+ /* Enable Peripheral Bus 1 */
+ PLIB_OSC_PBClockDivisorSet (OSC_ID_0, 0, 1 );
+
+
+
+
+
+
+
+ SYS_DEVCON_SystemLock ( );
+}
+
+//******************************************************************************
+/* Function:
+ inline uint32_t SYS_CLK_SystemFrequencyGet ( void )
+
+ Summary:
+ Gets the system clock frequency in Hertz.
+
+ Description:
+ This function gets the System clock frequency in Hertz.
+
+ Precondition:
+ None.
+
+ Parameters:
+ None.
+
+ Returns:
+ System clock frequency in Hertz.
+
+ Example:
+ <code>
+ uint32_t sysClockHz;
+
+ sysClockHz = SYS_CLK_SystemFrequencyGet ( );
+ </code>
+
+ Remarks:
+ */
+
+inline uint32_t SYS_CLK_SystemFrequencyGet ( void )
+{
+ return SYS_CLK_FREQ;
+}
+
+//******************************************************************************
+/* Function:
+ inline uint32_t SYS_CLK_PeripheralFrequencyGet ( CLK_BUSES_PERIPHERAL peripheralBus )
+
+ Summary:
+ Gets the selected clock peripheral bus frequency in Hertz.
+
+ Description:
+ This function gets the selected peripheral bus clock frequency in Hertz.
+
+ Precondition:
+ None.
+
+ Parameters:
+ peripheralBus - Reference clock bus selection. One of the possible value from
+ CLK_BUSES_PERIPHERAL enum. For devices that do not have multiple
+ clock channels for Reference clock, CLK_BUS_PERIPHERAL_1 should be
+ the selection.
+
+ Returns:
+ Clock frequency in Hertz.
+
+ Example:
+ <code>
+ unsigned long peripheralClockHz;
+
+ peripheralClockHz = SYS_CLK_PeripheralFrequencyGet ( CLK_BUS_PERIPHERAL_5 );
+ </code>
+
+ Remarks:
+ Most of the devices doesn't have multiple Peripheral clock buses. In that case,
+ pass CLK_USB_PERIPHERAL_1 as the bus number.
+ */
+
+inline uint32_t SYS_CLK_PeripheralFrequencyGet ( CLK_BUSES_PERIPHERAL peripheralBus )
+{
+ return SYS_CLK_BUS_PERIPHERAL_1;
+}
+
+
+//******************************************************************************
+/* Function:
+ inline uint32_t SYS_CLK_ReferenceClockFrequencyGet ( CLK_BUSES_REFERENCE referenceBus )
+
+ Summary:
+ Gets the selected Reference clock bus frequency in Hertz.
+
+ Description:
+ This function gets frequency of the selected Reference clock bus in Hertz.
+
+ Precondition:
+ None.
+
+ Parameters:
+ peripheralBus - Reference clock bus selection. One of the possible value from
+ CLK_BUSES_REFERENCE enum. For devices that do not have multiple
+ clock channels for Reference clock, CLK_BUS_REFERENCE_1 should be
+ the selection.
+
+ Returns:
+ Clock frequency in Hz.
+
+ Example:
+ <code>
+ unsigned long sysClockOutputHz;
+
+ sysClockOutputHz = SYS_CLK_ReferenceClockFrequencyGet ( CLK_BUS_REFERENCE_3 );
+ </code>
+
+ Remarks:
+ */
+
+inline uint32_t SYS_CLK_ReferenceClockFrequencyGet ( CLK_BUSES_REFERENCE referenceBus )
+{
+ return 0;
+} \ No newline at end of file
diff --git a/firmware/src/system_config/pic32mx695f512h/framework/system/clk/sys_clk_static.h b/firmware/src/system_config/pic32mx695f512h/framework/system/clk/sys_clk_static.h
new file mode 100644
index 0000000..23a0cf5
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/framework/system/clk/sys_clk_static.h
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ SYS CLK Static Interface Declarations for Clock System Service
+
+ Company:
+ Microchip Technology Inc.
+
+ File Name:
+ sys_clk_static.h
+
+ Summary:
+ SYS CLK interface declarations for the static system service.
+
+ Description:
+ The Clock System Service provides a simple interface to manage the oscillators
+ on Microchip microcontrollers. This file defines the interface
+ Declarations for the SYS CLK system service.
+
+ Remarks:
+ Static interfaces incorporate all system clock configuration settings as
+ determined by the user via the Microchip Harmony Configurator GUI. It provides
+ static version of the routines, eliminating the need for an object ID or
+ object handle.
+
+ Static single-open interfaces also eliminate the need for the open handle.
+*******************************************************************************/
+
+//DOM-IGNORE-BEGIN
+/*******************************************************************************
+Copyright (c) 2014 released Microchip Technology Inc. All rights reserved.
+
+Microchip licenses to you the right to use, modify, copy and distribute
+Software only when embedded on a Microchip microcontroller or digital signal
+controller that is integrated into your product or third party product
+(pursuant to the sublicense terms in the accompanying license agreement).
+
+You should refer to the license agreement accompanying this Software for
+additional information regarding your rights and obligations.
+
+SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
+IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
+CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
+OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
+INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
+CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
+SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
+(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
+*******************************************************************************/
+//DOM-IGNORE-END
+
+#ifndef _SYS_CLK_STATIC_H
+#define _SYS_CLK_STATIC_H
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: SYS CLK Module Initialization Routine (Static Version)
+// *****************************************************************************
+// *****************************************************************************
+
+#endif // #ifndef _SYS_CLK_STATIC_H
+
+/*******************************************************************************
+ End of File
+*/
diff --git a/firmware/src/system_config/pic32mx695f512h/framework/system/ports/src/sys_ports_static.c b/firmware/src/system_config/pic32mx695f512h/framework/system/ports/src/sys_ports_static.c
new file mode 100644
index 0000000..d84b837
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/framework/system/ports/src/sys_ports_static.c
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ SYS PORTS Static Functions for PORTS System Service
+
+ Company:
+ Microchip Technology Inc.
+
+ File Name:
+ sys_ports_static.c
+
+ Summary:
+ SYS PORTS static function implementations for the Ports System Service.
+
+ Description:
+ The Ports System Service provides a simple interface to manage the ports
+ on Microchip microcontrollers. This file defines the static implementation for the
+ Ports System Service.
+
+ Remarks:
+ Static functions incorporate all system ports configuration settings as
+ determined by the user via the Microchip Harmony Configurator GUI. It provides
+ static version of the routines, eliminating the need for an object ID or
+ object handle.
+
+*******************************************************************************/
+
+//DOM-IGNORE-BEGIN
+/*******************************************************************************
+Copyright (c) 2013 released Microchip Technology Inc. All rights reserved.
+
+Microchip licenses to you the right to use, modify, copy and distribute
+Software only when embedded on a Microchip microcontroller or digital signal
+controller that is integrated into your product or third party product
+(pursuant to the sublicense terms in the accompanying license agreement).
+
+You should refer to the license agreement accompanying this Software for
+additional information regarding your rights and obligations.
+
+SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
+IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
+CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
+OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
+INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
+CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
+SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
+(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
+*******************************************************************************/
+//DOM-IGNORE-END
+
+#include "system_config.h"
+#include "peripheral/ports/plib_ports.h"
+#include "peripheral/int/plib_int.h"
+
+
+void SYS_PORTS_Initialize(void)
+{
+ /* AN and CN Pins Initialization */
+ PLIB_PORTS_AnPinsModeSelect(PORTS_ID_0, SYS_PORT_AD1PCFG, PORTS_PIN_MODE_DIGITAL);
+ PLIB_PORTS_CnPinsPullUpEnable(PORTS_ID_0, SYS_PORT_CNPUE);
+ PLIB_PORTS_CnPinsEnable(PORTS_ID_0, SYS_PORT_CNEN);
+ PLIB_PORTS_ChangeNoticeEnable(PORTS_ID_0);
+
+
+
+ /* PORT B Initialization */
+ PLIB_PORTS_OpenDrainEnable(PORTS_ID_0, PORT_CHANNEL_B, SYS_PORT_B_ODC);
+ PLIB_PORTS_Write( PORTS_ID_0, PORT_CHANNEL_B, SYS_PORT_B_LAT);
+ PLIB_PORTS_DirectionOutputSet( PORTS_ID_0, PORT_CHANNEL_B, SYS_PORT_B_TRIS ^ 0xFFFF);
+
+ /* PORT E Initialization */
+ PLIB_PORTS_OpenDrainEnable(PORTS_ID_0, PORT_CHANNEL_E, SYS_PORT_E_ODC);
+ PLIB_PORTS_Write( PORTS_ID_0, PORT_CHANNEL_E, SYS_PORT_E_LAT);
+ PLIB_PORTS_DirectionOutputSet( PORTS_ID_0, PORT_CHANNEL_E, SYS_PORT_E_TRIS ^ 0xFFFF);
+
+}
+
+
+/*******************************************************************************
+ End of File
+*/
diff --git a/firmware/src/system_config/pic32mx695f512h/gfx_hgc_definitions.c b/firmware/src/system_config/pic32mx695f512h/gfx_hgc_definitions.c
new file mode 100644
index 0000000..e3140af
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/gfx_hgc_definitions.c
@@ -0,0 +1,248 @@
+/*******************************************************************************
+ MPLAB Harmony Graphics Composer Generated Implementation File
+
+ File Name:
+ gfx_hgc_definitions.c
+
+ Summary:
+ Build-time generated implementation from the MPLAB Harmony
+ Graphics Composer.
+
+ Description:
+ Build-time generated implementation from the MPLAB Harmony
+ Graphics Composer.
+
+ Created with MPLAB Harmony Version 1.06
+*******************************************************************************/
+// DOM-IGNORE-BEGIN
+/*******************************************************************************
+Copyright (c) 2013-2014 released Microchip Technology Inc. All rights reserved.
+
+Microchip licenses to you the right to use, modify, copy and distribute
+Software only when embedded on a Microchip microcontroller or digital signal
+controller that is integrated into your product or third party product
+(pursuant to the sublicense terms in the accompanying license agreement).
+
+You should refer to the license agreement accompanying this Software for
+additional information regarding your rights and obligations.
+
+SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
+IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
+CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
+OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
+INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
+CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
+SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
+(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
+*******************************************************************************/
+// DOM-IGNORE-END
+
+#include "gfx_hgc_definitions.h"
+
+/*** Generated Asset References ***/
+/*** Generated ASCII Text Labels ***/
+/*** HGC Object Global ***/
+HGC_OBJECTS hgcObj;
+static HGC_STATES hgcState;
+
+/******************************************************************************
+ Function:
+ HGC_SCREEN_STATES GFX_HGC_GetScreenState ( void )
+
+ Remarks:
+ This function returns the screen state
+ */
+HGC_SCREEN_STATES GFX_HGC_GetScreenState ( void )
+{
+ return hgcObj.screenState;
+}
+
+
+/******************************************************************************
+ Function:
+ void GFX_HGC_SetScreenState ( HGC_SCREEN_STATES newState )
+
+ Remarks:
+ This function sets the screen state machine to a new state
+ */
+void GFX_HGC_SetScreenState ( HGC_SCREEN_STATES newState )
+{
+ hgcObj.prevRefreshState = hgcObj.screenState;
+ hgcObj.screenState = newState;
+}
+
+
+/******************************************************************************
+ Function:
+ void GFX_HGC_Setup ( void )
+
+ Summary:
+ This function sets up the GOL message callback and draw callbacks.
+ */
+void GFX_HGC_Setup ( void )
+{
+}
+
+/******************************************************************************
+ Function:
+ void GFX_HGC_Tasks (SYS_MODULE_OBJ gfxObject);
+
+ Summary:
+ This function is called in SYS_Tasks. The intent wait until the GFX library
+ is initialized before supplying items to draw
+*/
+void GFX_HGC_Tasks (SYS_MODULE_OBJ gfxObject)
+{
+ switch ( hgcState )
+ {
+ case HGC_STATE_INIT:
+ if (GFX_Status(gfxObject)==SYS_STATUS_READY)
+ {
+ GFX_HGC_Setup();
+ hgcState = HGC_STATE_RUNNING;
+ }
+ break;
+
+ case HGC_STATE_RUNNING:
+ //Drive screen state machine
+ GFX_HGC_DrawScreenTask();
+ break;
+
+ default:
+ break;
+ }
+}
+
+/******************************************************************************
+ Function:
+ void GFX_HGC_DrawScreenTask( void )
+
+ Remarks:
+ Task loop to drive the HGC generated screen state machine for HGC design
+ that has primitives only
+ */
+void GFX_HGC_DrawScreenTask( void )
+{
+ switch (hgcObj.screenState)
+ {
+ case HGC_SCREEN_STATE_INIT:
+ //Draw the primary screen as selected in the Composer
+ GFX_HGC_SetScreenState(HGC_SCREEN_STATE_SETUP_SCREEN_Screen1);
+ break;
+ case HGC_SCREEN_STATE_SETUP_SCREEN_Screen1:
+ GFX_HGC_SetupScreen(Screen1);
+
+ GFX_HGC_SetScreenState(HGC_SCREEN_STATE_PRE_DRAW_PRIMITIVE_SCREEN_Screen1);
+ break;
+ case HGC_SCREEN_STATE_PRE_DRAW_PRIMITIVE_SCREEN_Screen1:
+ GFX_HGC_SetScreenState(HGC_SCREEN_STATE_DRAW_PRIMITIVE_SCREEN_Screen1);
+ break;
+ case HGC_SCREEN_STATE_DRAW_PRIMITIVE_SCREEN_Screen1:
+ GFX_HGC_DrawScreen_Primitives(Screen1);
+ GFX_HGC_SetScreenState(HGC_SCREEN_STATE_POST_DRAW_PRIMITIVE_SCREEN_Screen1);
+ break;
+ case HGC_SCREEN_STATE_POST_DRAW_PRIMITIVE_SCREEN_Screen1:
+ GFX_HGC_SetScreenState(HGC_SCREEN_STATE_DISPLAY_SCREEN_Screen1);
+ break;
+ case HGC_SCREEN_STATE_DISPLAY_SCREEN_Screen1:
+ break;
+ default:
+ break;
+ }
+}
+
+/******************************************************************************
+ Function:
+ void GFX_HGC_SetupScreen( uint8_t screenId )
+
+ Remarks:
+ Clears current screen and starts a fresh screen with its background color
+ */
+void GFX_HGC_SetupScreen(uint8_t screenId)
+{
+ switch (screenId)
+ {
+ case Screen1:
+ GFX_ColorSet(GFX_INDEX_0, GFX_RGBConvert(0x00, 0x00, 0x00));
+ GFX_ScreenClear(GFX_INDEX_0);
+ break;
+ default:
+ break;
+ }
+}
+
+
+/******************************************************************************
+ Function:
+ bool GFX_HGC_ChangeScreen( uint8_t screenId )
+
+ Output:
+ Returns true if a screenId matches an existing screen identifier
+
+ Remarks:
+ Can be called to initiate GFX Library to draw a new screen
+ */
+bool GFX_HGC_ChangeScreen(uint8_t screenId)
+{
+ switch (screenId)
+ {
+ case Screen1:
+ GFX_HGC_SetScreenState(HGC_SCREEN_STATE_SETUP_SCREEN_Screen1);
+ break;
+ default:
+ return false;
+ }
+
+ return true; // release drawing control to GOL
+}
+
+/******************************************************************************
+ Function:
+ bool GFX_HGC_DrawScreen_Primitives( uint8_t screenId )
+
+ Output:
+ Returns true if a screenId matches an existing screen identifier
+
+ Remarks:
+ HGC-specified GFX Primitives are drawn here, grouped by screen.
+ GFX Primitives are drawn after GFX GOL Objects to make sure GFX GOL Objects
+ do not cover GFX Primitives
+ */
+bool GFX_HGC_DrawScreen_Primitives(uint8_t screenId)
+{
+ switch (screenId)
+ {
+ case Screen1:
+ break;
+ default:
+ return true;
+ }
+
+ return true; // release drawing control to GOL
+}
+
+
+/******************************************************************************
+ Function:
+ bool GFX_HGC_DrawItem(int itemId)
+
+ Output:
+ Returns true if a itemId matches an existing item identifier
+
+ Remarks:
+ Every item specified in every screen in HGC is listed in this function
+ */
+bool GFX_HGC_DrawItem(int itemId)
+{
+ switch(itemId)
+ {
+ default:
+ return false; // process by default
+ }
+
+ return true;
+}
+
+
diff --git a/firmware/src/system_config/pic32mx695f512h/gfx_hgc_definitions.h b/firmware/src/system_config/pic32mx695f512h/gfx_hgc_definitions.h
new file mode 100644
index 0000000..268b8f2
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/gfx_hgc_definitions.h
@@ -0,0 +1,219 @@
+/*******************************************************************************
+ MPLAB Harmony Graphics Composer Generated Definitions Header
+
+ File Name:
+ gfx_hgc_definitions.h
+
+ Summary:
+ Build-time generated definitions header based on output by the MPLAB Harmony
+ Graphics Composer.
+
+ Description:
+ Build-time generated definitions header based on output by the MPLAB Harmony
+ Graphics Composer.
+
+ Created with MPLAB Harmony Version 1.06
+*******************************************************************************/
+
+// DOM-IGNORE-BEGIN
+/*******************************************************************************
+Copyright (c) 2013-2014 released Microchip Technology Inc. All rights reserved.
+
+Microchip licenses to you the right to use, modify, copy and distribute
+Software only when embedded on a Microchip microcontroller or digital signal
+controller that is integrated into your product or third party product
+(pursuant to the sublicense terms in the accompanying license agreement).
+
+You should refer to the license agreement accompanying this Software for
+additional information regarding your rights and obligations.
+
+SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
+IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
+CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
+OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
+INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
+CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
+SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
+(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
+*******************************************************************************/
+// DOM-IGNORE-END
+
+
+#ifndef _GFX_HGC_DEFINITIONS_H
+#define _GFX_HGC_DEFINITIONS_H
+
+#include "system_config.h"
+#include "system_definitions.h"
+
+// DOM-IGNORE-BEGIN
+#ifdef __cplusplus // Provide C++ Compatibility
+
+extern "C" {
+
+#endif
+// DOM-IGNORE-END
+
+typedef enum
+{
+ HGC_STATE_INIT = 0,
+ HGC_STATE_RUNNING
+} HGC_STATES;
+
+typedef enum
+{
+ HGC_SCREEN_STATE_INIT = 0,
+ HGC_SCREEN_STATE_SETUP_SCREEN_Screen1,
+ HGC_SCREEN_STATE_PRE_DRAW_GOL_SCREEN_Screen1,
+ HGC_SCREEN_STATE_DRAW_GOL_SCREEN_Screen1,
+ HGC_SCREEN_STATE_POST_DRAW_GOL_SCREEN_Screen1,
+ HGC_SCREEN_STATE_PRE_DRAW_PRIMITIVE_SCREEN_Screen1,
+ HGC_SCREEN_STATE_DRAW_PRIMITIVE_SCREEN_Screen1,
+ HGC_SCREEN_STATE_POST_DRAW_PRIMITIVE_SCREEN_Screen1,
+ HGC_SCREEN_STATE_DISPLAY_SCREEN_Screen1,
+
+} HGC_SCREEN_STATES;
+
+/*** Screen IDs ***/
+#define Screen1 0
+
+
+
+// *****************************************************************************
+/* MPLAB Harmony Graphics Composer Objects
+
+ Summary:
+ Structure holding the graphics object handles
+
+ Description:
+ This structure contains the object handles for all graphics objects
+ generated by the Harmony Graphics Composer
+
+ Remarks:
+*/
+
+typedef struct HGC_OBJECTS
+{
+ HGC_SCREEN_STATES screenState; // current state of screen state machine
+ HGC_SCREEN_STATES prevRefreshState; // previous state of screen state machine
+
+ /*** GOL Objects References ***/
+} HGC_OBJECTS;
+
+extern HGC_OBJECTS hgcObj;
+
+/******************************************************************************
+ Function:
+ void GFX_HGC_Setup ( void )
+
+ Summary:
+ This function sets up the GOL message callback and draw callbacks.
+ */
+void GFX_HGC_Setup ( void );
+
+
+/******************************************************************************
+ Function:
+ HGC_SCREEN_STATES GFX_HGC_GetScreenState ( void )
+
+ Remarks:
+ This function returns the screen state
+ */
+HGC_SCREEN_STATES GFX_HGC_GetScreenState ( void );
+
+
+/******************************************************************************
+ Function:
+ void GFX_HGC_SetScreenState ( HGC_SCREEN_STATES newState )
+
+ Remarks:
+ This function sets the screen state machine to a new state
+ */
+void GFX_HGC_SetScreenState ( HGC_SCREEN_STATES newState );
+
+
+/******************************************************************************
+ Function:
+ void GFX_HGC_Tasks (SYS_MODULE_OBJ gfxObject);
+
+ Summary:
+ This function is called in SYS_Tasks. The intent wait until the GFX library
+ is initialized before supplying items to draw
+*/
+void GFX_HGC_Tasks (SYS_MODULE_OBJ gfxObject);
+
+
+/******************************************************************************
+ Function:
+ void GFX_HGC_DrawScreenTask( void )
+
+ Remarks:
+ Task loop to drive the HGC generated screen state machine for HGC design
+ that has GFX_Primitives only
+ */
+void GFX_HGC_DrawScreenTask( void );
+
+
+/******************************************************************************
+ Function:
+ bool GFX_HGC_DrawScreen_Primitives( uint8_t screenId )
+
+ Output:
+ Returns true if a screenId matches an existing screen identifier
+
+ Remarks:
+ HGC-specified GFX Primitives are drawn here, grouped by screen.
+ GFX Primitives are drawn after GFX GOL Objects to make sure GFX GOL Objects
+ do not cover GFX Primitives
+ */
+bool GFX_HGC_DrawScreen_Primitives(uint8_t screenId);
+
+
+/******************************************************************************
+ Function:
+ void GFX_HGC_SetupScreen( uint8_t screenId )
+
+ Remarks:
+ Clears current screen and starts a fresh screen with its background color
+ */
+void GFX_HGC_SetupScreen(uint8_t screenId);
+
+
+/******************************************************************************
+ Function:
+ bool GFX_HGC_ChangeScreen( uint8_t screenId )
+
+ Output:
+ Returns true if a screenId matches an existing screen identifier
+
+ Remarks:
+ Can be called to initiate GFX Library to draw a new screen
+ */
+bool GFX_HGC_ChangeScreen(uint8_t screenId);
+
+
+/******************************************************************************
+ Function:
+ bool GFX_HGC_DrawItem(int itemId)
+
+ Output:
+ Returns true if a itemId matches an existing item identifier
+
+ Remarks:
+ Every item specified in every screen in HGC is listed in this function
+ */
+bool GFX_HGC_DrawItem(int itemId);
+
+
+
+//DOM-IGNORE-BEGIN
+#ifdef __cplusplus
+}
+#endif
+//DOM-IGNORE-END
+
+#endif // _GFX_HGC_DEFINITIONS_H
+/*******************************************************************************
+ End of File
+*/
diff --git a/firmware/src/system_config/pic32mx695f512h/pic32mx695f512h.mhc b/firmware/src/system_config/pic32mx695f512h/pic32mx695f512h.mhc
new file mode 100644
index 0000000..13017a8
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/pic32mx695f512h.mhc
@@ -0,0 +1,406 @@
+#
+# Configuration generated by Microchip Harmony Configurator (MHC) v1.0.7.9
+# Project name: CText
+# Configuration: pic32mx695f512h
+# Device: PIC32MX695F512H
+# Harmony version: 1.06
+#
+#
+# from $PROJECT_FIRMWARE_DIRECTORY/$PROJECT_NAME.hconfig
+#
+CONFIG_APP_INSTANCES=1
+#
+# from $HARMONY_VERSION_PATH/utilities/mhc/config/app_name_idx.ftl
+#
+CONFIG_APP_MENU_IDX0=y
+CONFIG_APP_NAME_0="app"
+#
+# from $PROJECT_FIRMWARE_DIRECTORY/$PROJECT_NAME.hconfig
+#
+CONFIG_USE_EXCEPTION_HANDLER=y
+CONFIG_EXCEPTION_USE_SYS_DEBUG=y
+CONFIG_EXCEPTION_BREAKPOINT=y
+#
+# from $HARMONY_VERSION_PATH/framework/bluetooth/config/bluetooth.hconfig
+#
+CONFIG_USE_BLUETOOTH_LIBRARIES=n
+#
+# from $HARMONY_VERSION_PATH/framework/bootloader/config/bootloader.hconfig
+#
+CONFIG_USE_BOOTLOADER=y
+CONFIG_CUSTOM_BOOTLOADER_PROGRAM_SPACE=y
+CONFIG_USE_BOOTLOADER_LIBRARY=n
+#
+# from $HARMONY_VERSION_PATH/framework/crypto/config/crypto.hconfig
+#
+CONFIG_USE_CRYPTO_LIB=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/adc/config/drv_adc.hconfig
+#
+CONFIG_USE_DRV_ADC=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/camera/config/drv_camera.hconfig
+#
+CONFIG_USE_DRV_CAMERA=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/cmp/config/drv_cmp.hconfig
+#
+CONFIG_DRV_CVREF_ENABLE=n
+CONFIG_USE_DRV_CMP=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/encx24j600/config/drv_encx24j600.hconfig
+#
+CONFIG_DRV_ENCX24J600_USE_DRIVER=n
+#
+# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcpip_mac.hconfig
+#
+CONFIG_TCPIP_USE_ETH_MAC=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/gfx/controller/lcc/config/drv_gfx_lcc.hconfig
+#
+CONFIG_USE_DRV_GFX_LCC=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/gfx/controller/otm2201a/config/drv_gfx_otm2201a.hconfig
+#
+CONFIG_USE_DRV_GFX_OTM2201A=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/gfx/controller/ssd1926/config/drv_gfx_ssd1926.hconfig
+#
+CONFIG_USE_DRV_GFX_SSD1926=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/gfx/controller/ssd1289/config/drv_gfx_ssd1289.hconfig
+#
+CONFIG_USE_DRV_GFX_SSD1289=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/gfx/controller/s1d13517/config/drv_gfx_s1d13517.hconfig
+#
+CONFIG_USE_DRV_GFX_S1D13517=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/gfx/controller/tft002/config/drv_gfx_tft002.hconfig
+#
+CONFIG_USE_DRV_GFX_TFT002=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/gfx/display/config/drv_gfx_display.hconfig
+#
+CONFIG_USE_DRV_GFX_DISPLAY=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/i2c/config/drv_i2c.hconfig
+#
+CONFIG_USE_DRV_I2C=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/ic/config/drv_ic.hconfig
+#
+CONFIG_USE_DRV_IC=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/nvm/config/drv_nvm.hconfig
+#
+CONFIG_USE_DRV_NVM=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/oc/config/drv_oc.hconfig
+#
+CONFIG_USE_DRV_OC=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/pmp/config/drv_pmp.hconfig
+#
+CONFIG_USE_DRV_PMP=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/rtcc/config/drv_rtcc.hconfig
+#
+CONFIG_USE_DRV_RTCC=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/sample/config/drv_sample.hconfig
+#
+CONFIG_USE_DRV_SAMPLE=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/sdcard/config/drv_sdcard.hconfig
+#
+CONFIG_USE_DRV_SDCARD=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/spi/config/drv_spi.hconfig
+#
+CONFIG_DRV_SPI_USE_DRIVER=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/spi_flash/sst25vf016b/config/drv_sst25vf016b.hconfig
+#
+CONFIG_USE_DRV_SST25VF016B=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/spi_flash/sst25vf020b/config/drv_sst25vf020b.hconfig
+#
+CONFIG_USE_DRV_SST25VF020B=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/spi_flash/sst25vf064c/config/drv_sst25vf064c.hconfig
+#
+CONFIG_USE_DRV_SST25VF064C=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/tmr/config/drv_tmr.hconfig
+#
+CONFIG_USE_DRV_TMR=y
+CONFIG_DRV_TMR_DRIVER_MODE="DYNAMIC"
+CONFIG_DRV_TMR_CLIENTS_NUMBER=1
+CONFIG_DRV_TMR_INTERRUPT_MODE=y
+CONFIG_DRV_TMR_INSTANCES_NUMBER=1
+#
+# from $HARMONY_VERSION_PATH/framework/driver/tmr/config/drv_tmr_idx.ftl
+#
+CONFIG_DRV_TMR_INST_0=y
+CONFIG_DRV_TMR_PERIPHERAL_ID_IDX0="TMR_ID_1"
+CONFIG_DRV_TMR_INTERRUPT_PRIORITY_IDX0="INT_PRIORITY_LEVEL1"
+CONFIG_DRV_TMR_INTERRUPT_SUB_PRIORITY_IDX0="INT_SUBPRIORITY_LEVEL0"
+CONFIG_DRV_TMR_CLOCK_SOURCE_IDX0="DRV_TMR_CLKSOURCE_INTERNAL"
+CONFIG_DRV_TMR_PRESCALE_IDX0="TMR_PRESCALE_VALUE_256"
+CONFIG_DRV_TMR_OPERATION_MODE_IDX0="DRV_TMR_OPERATION_MODE_16_BIT"
+CONFIG_DRV_TMR_ASYNC_WRITE_ENABLE_IDX0=n
+CONFIG_DRV_TMR_POWER_STATE_IDX0="SYS_MODULE_POWER_RUN_FULL"
+#
+# from $HARMONY_VERSION_PATH/framework/driver/touch/adc10bit/config/drv_adc10bit.hconfig
+#
+CONFIG_USE_DRV_TOUCH_ADC10BIT=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/touch/ar1020/config/drv_ar1020.hconfig
+#
+CONFIG_USE_DRV_TOUCH_AR1020=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/touch/mtch6301/config/drv_mtch6301.hconfig
+#
+CONFIG_USE_DRV_TOUCH_MTCH6301=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/usart/config/drv_usart.hconfig
+#
+CONFIG_USE_DRV_USART=n
+#
+# from $HARMONY_VERSION_PATH/framework/driver/wifi/config/drv_wifi.hconfig
+#
+CONFIG_USE_DRV_WIFI=n
+#
+# from $HARMONY_VERSION_PATH/framework/gfx/config/gfx.hconfig
+#
+CONFIG_USE_GFX_STACK=n
+#
+# from $HARMONY_VERSION_PATH/framework/math/dsp/config/dsp.hconfig
+#
+CONFIG_USE_DSP=n
+#
+# from $HARMONY_VERSION_PATH/framework/osal/config/osal.hconfig
+#
+CONFIG_USE_OSAL=y
+#
+# from $HARMONY_VERSION_PATH/framework/peripheral/config/peripheral.hconfig
+#
+CONFIG_PERIPHERAL_LIB=y
+#
+# from $HARMONY_VERSION_PATH/framework/system/clk/config/sys_clk.hconfig
+#
+CONFIG_USE_SYS_CLK=y
+CONFIG_SYS_CLK_MODE="STATIC"
+CONFIG_SYS_CLK_PBDIV0_OVERRIDE=n
+CONFIG_SYS_CLK_PBDIV0_MX="DIV_1"
+CONFIG_SYS_CLK_CONFIG_PRIMARY_XTAL="8000000"
+CONFIG_SYS_CLK_CONFIG_SECONDARY_XTAL=""
+CONFIG_SYS_CLK_FREQ="80000000"
+CONFIG_SYS_CLK_PBCLK_FREQ="80000000"
+CONFIG_SYS_CLK_UPLL_BEFORE_DIV2_FREQ="48000000"
+#
+# from $HARMONY_VERSION_PATH/framework/system/command/config/sys_command.hconfig
+#
+CONFIG_USE_SYS_COMMAND=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/common/config/sys_common.hconfig
+#
+CONFIG_USE_SYS_COMMON=y
+CONFIG_SYS_BUFFER=n
+CONFIG_SYS_QUEUE=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/console/config/sys_console.hconfig
+#
+CONFIG_USE_SYS_CONSOLE=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/debug/config/sys_debug.hconfig
+#
+CONFIG_USE_SYS_DEBUG=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/devcon/config/sys_devcon.hconfig
+#
+CONFIG_USE_SYS_DEVCON=y
+CONFIG_SYS_DEVCON_USE_JTAG=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/dma/config/sys_dma.hconfig
+#
+CONFIG_USE_SYS_DMA=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/fs/config/sys_fs.hconfig
+#
+CONFIG_USE_SYS_FS=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/int/config/sys_int.hconfig
+#
+CONFIG_USE_SYS_INT=y
+CONFIG_USE_EXT_INT=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/msg/config/sys_msg.hconfig
+#
+CONFIG_USE_SYS_MSG=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/ports/config/sys_ports.hconfig
+#
+CONFIG_USE_SYS_PORTS=y
+CONFIG_COMPONENT_PACKAGE="TQFP"
+CONFIG_SYS_PORTS_CN=n
+CONFIG_USE_SYS_PORTS_CN_INTERRUPT=n
+CONFIG_SYS_PORT_ADPCFG=0xffdf
+CONFIG_SYS_PORT_CNEN=0x0
+CONFIG_SYS_PORT_CNPU=0x0
+#
+# from $HARMONY_VERSION_PATH/framework/system/ports/config/sys_ports_idx.ftl
+#
+CONFIG_USE_PORT_B=y
+CONFIG_SYS_PORT_B_TRIS=0x3c20
+CONFIG_SYS_PORT_B_LAT=0x0
+CONFIG_SYS_PORT_B_ODC=0x0
+CONFIG_SYS_PORT_C_TRIS=0xf000
+CONFIG_SYS_PORT_C_LAT=0x0
+CONFIG_SYS_PORT_C_ODC=0x0
+CONFIG_SYS_PORT_D_TRIS=0xfff
+CONFIG_SYS_PORT_D_LAT=0x0
+CONFIG_SYS_PORT_D_ODC=0x0
+CONFIG_USE_PORT_E=y
+CONFIG_SYS_PORT_E_TRIS=0x0
+CONFIG_SYS_PORT_E_LAT=0x0
+CONFIG_SYS_PORT_E_ODC=0x0
+CONFIG_SYS_PORT_F_TRIS=0x3b
+CONFIG_SYS_PORT_F_LAT=0x0
+CONFIG_SYS_PORT_F_ODC=0x0
+CONFIG_SYS_PORT_G_TRIS=0x3cc
+CONFIG_SYS_PORT_G_LAT=0x0
+CONFIG_SYS_PORT_G_ODC=0x0
+#
+# from $HARMONY_VERSION_PATH/framework/system/random/config/sys_random.hconfig
+#
+CONFIG_USE_SYS_RANDOM=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/reset/config/sys_reset.hconfig
+#
+CONFIG_USE_SYS_RESET=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/touch/config/sys_touch.hconfig
+#
+CONFIG_USE_SYS_TOUCH=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/tmr/config/sys_tmr.hconfig
+#
+CONFIG_USE_SYS_TMR=y
+CONFIG_SYS_TMR_POWER_STATE="SYS_MODULE_POWER_RUN_FULL"
+CONFIG_SYS_TMR_DRIVER_INDEX="DRV_TMR_INDEX_0"
+CONFIG_SYS_TMR_MAX_CLIENT_OBJECTS=5
+CONFIG_SYS_TMR_FREQUENCY=1000
+CONFIG_SYS_TMR_FREQUENCY_TOLERANCE=10
+CONFIG_SYS_TMR_UNIT_RESOLUTION=10000
+CONFIG_SYS_TMR_CLIENT_TOLERANCE=10
+CONFIG_SYS_TMR_INTERRUPT_NOTIFICATION=n
+#
+# from $HARMONY_VERSION_PATH/framework/system/wdt/config/sys_wdt.hconfig
+#
+CONFIG_USE_SYS_WDT=n
+#
+# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcpip_stack.hconfig
+#
+CONFIG_USE_TCPIP_STACK=n
+#
+# from $HARMONY_VERSION_PATH/framework/usb/config/usb.hconfig
+#
+CONFIG_USE_USB_STACK=y
+CONFIG_DRV_USB_DRIVER_MODE="DYNAMIC"
+CONFIG_DRV_USB_INTERRUPT_MODE=y
+CONFIG_DRV_USB_DEVICE_SUPPORT=n
+CONFIG_DRV_USB_HOST_SUPPORT=y
+CONFIG_DRV_USB_BETA_SW_HOST_SUPPORT=n
+CONFIG_USB_HOST_SPEED_FS_IDX0="USB_SPEED_FULL"
+CONFIG_USB_HOST_DEVICE_NUMBER=1
+CONFIG_USB_HOST_TPL_ENTRY_NUMBER=1
+CONFIG_USB_HOST_MAX_INTERFACES=5
+CONFIG_USB_HOST_USE_HUB=n
+CONFIG_USB_HOST_USE_CDC=n
+CONFIG_USB_HOST_USE_HID=y
+CONFIG_USB_HOST_USE_MOUSE=n
+CONFIG_USB_HOST_USE_KEYBOARD=y
+CONFIG_USB_HOST_HID_NUMBER_OF_INSTANCES=1
+CONFIG_USB_HOST_HID_INTERRUPT_IN_ENDPOINTS_NUMBER=1
+CONFIG_USB_HID_TOTAL_USAGE_DRIVER_INSTANCES=1
+CONFIG_USB_HID_GLOBAL_PUSH_POP_STACK_SIZE=1
+CONFIG_USB_HOST_USE_AUDIO=n
+CONFIG_USB_HOST_USE_MSD=n
+#
+# from $HARMONY_VERSION_PATH/framework/sample/config/sample_module.hconfig
+#
+CONFIG_USE_SAMPLE_MODULE=n
+#
+# from $HARMONY_VERSION_PATH/framework/test/config/test.hconfig
+#
+CONFIG_USE_TEST_HARNESS=n
+#
+# from $HARMONY_VERSION_PATH/framework/decoder/config/decoder.hconfig
+#
+CONFIG_USE_DECODER=n
+#
+# from $HARMONY_VERSION_PATH/framework/net/pres/config/net_pres.hconfig
+#
+CONFIG_NET_PRES_USE=n
+#
+# from $HARMONY_VERSION_PATH/bsp/config/bsp.hconfig
+#
+CONFIG_USE_BSP=n
+#
+# from $HARMONY_VERSION_PATH/third_party/rtos/config/rtos.hconfig
+#
+CONFIG_USE_3RDPARTY_RTOS=n
+#
+# from $HARMONY_VERSION_PATH/third_party/tcpip/config/wolfssl.hconfig
+#
+CONFIG_USE_3RDPARTY_WOLFSSL=n
+#
+# from $HARMONY_VERSION_PATH/third_party/tcpip/iniche/config/embtcp.hconfig
+#
+CONFIG_IN_EMB_TCPIP_USE_TCP=n
+#
+# from $HARMONY_VERSION_PATH/third_party/tcpip/iniche/config/embdual.hconfig
+#
+CONFIG_IN_EMB_DUAL_USE_TCP=n
+#
+# from $HARMONY_VERSION_PATH/third_party/tcpip/iniche/config/stack.hconfig
+#
+CONFIG_IN_TCPIP=n
+#
+# from $HARMONY_VERSION_PATH/config/harmony.hconfig
+#
+CONFIG_DEVICE_CONFIGURATION=y
+#
+# from $HARMONY_VERSION_PATH/utilities/mhc/config/PIC32MX695F512H.hconfig
+#
+CONFIG_USERID=0xffff
+CONFIG_FSRSSEL="PRIORITY_7"
+CONFIG_FMIIEN="ON"
+CONFIG_FETHIO="ON"
+CONFIG_FUSBIDIO="ON"
+CONFIG_FVBUSONIO="ON"
+CONFIG_FPLLIDIV="DIV_2"
+CONFIG_FPLLMUL="MUL_20"
+CONFIG_UPLLIDIV="DIV_2"
+CONFIG_UPLLEN="OFF"
+CONFIG_FPLLODIV="DIV_1"
+CONFIG_FNOSC="FRCPLL"
+CONFIG_FSOSCEN="ON"
+CONFIG_IESO="OFF"
+CONFIG_POSCMOD="OFF"
+CONFIG_OSCIOFNC="OFF"
+CONFIG_FPBDIV="DIV_1"
+CONFIG_FCKSM="CSDCMD"
+CONFIG_WDTPS="PS1048576"
+CONFIG_FWDTEN="OFF"
+CONFIG_DEBUG="OFF"
+CONFIG_ICESEL="ICS_PGx2"
+CONFIG_PWP="OFF"
+CONFIG_BWP="OFF"
+CONFIG_CP="OFF"
+#
+# from $HARMONY_VERSION_PATH/utilities/mhc/config/project.hconfig
+#
+CONFIG_XC32_HEAP="4096"
diff --git a/firmware/src/system_config/pic32mx695f512h/system_config.h b/firmware/src/system_config/pic32mx695f512h/system_config.h
new file mode 100644
index 0000000..0183686
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/system_config.h
@@ -0,0 +1,238 @@
+/*******************************************************************************
+ MPLAB Harmony System Configuration Header
+
+ File Name:
+ system_config.h
+
+ Summary:
+ Build-time configuration header for the system defined by this MPLAB Harmony
+ project.
+
+ Description:
+ An MPLAB Project may have multiple configurations. This file defines the
+ build-time options for a single configuration.
+
+ Remarks:
+ This configuration header must not define any prototypes or data
+ definitions (or include any files that do). It only provides macro
+ definitions for build-time configuration options that are not instantiated
+ until used by another MPLAB Harmony module or application.
+
+ Created with MPLAB Harmony Version 1.06
+*******************************************************************************/
+
+// DOM-IGNORE-BEGIN
+/*******************************************************************************
+Copyright (c) 2013-2015 released Microchip Technology Inc. All rights reserved.
+
+Microchip licenses to you the right to use, modify, copy and distribute
+Software only when embedded on a Microchip microcontroller or digital signal
+controller that is integrated into your product or third party product
+(pursuant to the sublicense terms in the accompanying license agreement).
+
+You should refer to the license agreement accompanying this Software for
+additional information regarding your rights and obligations.
+
+SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
+IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
+CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
+OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
+INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
+CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
+SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
+(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
+*******************************************************************************/
+// DOM-IGNORE-END
+
+#ifndef _SYSTEM_CONFIG_H
+#define _SYSTEM_CONFIG_H
+
+/* This is a temporary workaround for an issue with the peripheral library "Exists"
+ functions that causes superfluous warnings. It "nulls" out the definition of
+ The PLIB function attribute that causes the warning. Once that issue has been
+ resolved, this definition should be removed. */
+#define _PLIB_UNSUPPORTED
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Included Files
+// *****************************************************************************
+// *****************************************************************************
+/* This section Includes other configuration headers necessary to completely
+ define this configuration.
+*/
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: System Service Configuration
+// *****************************************************************************
+// *****************************************************************************
+
+// *****************************************************************************
+/* Common System Service Configuration Options
+*/
+#define SYS_VERSION_STR "1.06"
+#define SYS_VERSION 10600
+
+// *****************************************************************************
+/* Clock System Service Configuration Options
+*/
+#define SYS_CLK_FREQ 80000000ul
+#define SYS_CLK_BUS_PERIPHERAL_1 80000000ul
+#define SYS_CLK_UPLL_BEFORE_DIV2_FREQ 48000000ul
+#define SYS_CLK_CONFIG_PRIMARY_XTAL 8000000ul
+#define SYS_CLK_CONFIG_SECONDARY_XTAL 0ul
+
+/*** Interrupt System Service Configuration ***/
+#define SYS_INT true
+
+/*** Ports System Service Configuration ***/
+#define SYS_PORT_AD1PCFG ~0xffff
+#define SYS_PORT_CNPUE 0x0
+#define SYS_PORT_CNEN 0x0
+
+#define SYS_PORT_B_TRIS 0x3c20
+#define SYS_PORT_B_LAT 0x0
+#define SYS_PORT_B_ODC 0x0
+
+#define SYS_PORT_E_TRIS 0x0
+#define SYS_PORT_E_LAT 0x0
+#define SYS_PORT_E_ODC 0x0
+/*** Timer System Service Configuration ***/
+#define SYS_TMR_POWER_STATE SYS_MODULE_POWER_RUN_FULL
+#define SYS_TMR_DRIVER_INDEX DRV_TMR_INDEX_0
+#define SYS_TMR_MAX_CLIENT_OBJECTS 5
+#define SYS_TMR_FREQUENCY 1000
+#define SYS_TMR_FREQUENCY_TOLERANCE 10
+#define SYS_TMR_UNIT_RESOLUTION 10000
+#define SYS_TMR_CLIENT_TOLERANCE 10
+#define SYS_TMR_INTERRUPT_NOTIFICATION false
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Driver Configuration
+// *****************************************************************************
+// *****************************************************************************
+
+/*** Timer Driver Configuration ***/
+#define DRV_TMR_INSTANCES_NUMBER 1
+#define DRV_TMR_CLIENTS_NUMBER 1
+#define DRV_TMR_INTERRUPT_MODE true
+
+/*** Timer Driver 0 Configuration ***/
+#define DRV_TMR_PERIPHERAL_ID_IDX0 TMR_ID_1
+#define DRV_TMR_INTERRUPT_SOURCE_IDX0 INT_SOURCE_TIMER_1
+#define DRV_TMR_INTERRUPT_VECTOR_IDX0 INT_VECTOR_T1
+#define DRV_TMR_ISR_VECTOR_IDX0 _TIMER_1_VECTOR
+#define DRV_TMR_INTERRUPT_PRIORITY_IDX0 INT_PRIORITY_LEVEL1
+#define DRV_TMR_INTERRUPT_SUB_PRIORITY_IDX0 INT_SUBPRIORITY_LEVEL0
+#define DRV_TMR_CLOCK_SOURCE_IDX0 DRV_TMR_CLKSOURCE_INTERNAL
+#define DRV_TMR_PRESCALE_IDX0 TMR_PRESCALE_VALUE_256
+#define DRV_TMR_OPERATION_MODE_IDX0 DRV_TMR_OPERATION_MODE_16_BIT
+#define DRV_TMR_ASYNC_WRITE_ENABLE_IDX0 false
+#define DRV_TMR_POWER_STATE_IDX0 SYS_MODULE_POWER_RUN_FULL
+
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Middleware & Other Library Configuration
+// *****************************************************************************
+// *****************************************************************************
+
+/*** USB Driver Configuration ***/
+
+
+/* Disable Device Support */
+#define DRV_USBFS_DEVICE_SUPPORT false
+
+/* Enables Device Support */
+#define DRV_USBFS_HOST_SUPPORT true
+
+/* Maximum USB driver instances */
+#define DRV_USBFS_INSTANCES_NUMBER 1
+
+
+/* Interrupt mode enabled */
+#define DRV_USBFS_INTERRUPT_MODE true
+
+
+/* Number of Endpoints used */
+#define DRV_USBFS_ENDPOINTS_NUMBER 1
+
+
+
+
+
+
+#define DRV_USBFS_HOST_NAK_LIMIT 2000
+/* Provides Host pipes number */
+#define DRV_USBFS_HOST_PIPES_NUMBER 10
+#define DRV_USBFS_HOST_ATTACH_DEBOUNCE_DURATION 500
+#define DRV_USBFS_HOST_RESET_DURATION 100
+// *****************************************************************************
+// *****************************************************************************
+// Section: USB Device Layer Configuration
+// *****************************************************************************
+// *****************************************************************************
+/* Provides Host pipes number */
+#define USB_HOST_PIPES_NUMBER 10
+/* NAK Limit for Control transfer data stage and Status Stage */
+#define DRV_USB_HOST_NAK_LIMIT 200
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: USB Host Layer Configuration
+// *****************************************************************************
+// **************************************************************************
+
+/* Total number of devices to be supported */
+#define USB_HOST_DEVICES_NUMBER 1
+
+/* Target peripheral list entries */
+#define USB_HOST_TPL_ENTRIES 1
+
+/* Maximum number of configurations supported per device */
+#define USB_HOST_DEVICE_INTERFACES_NUMBER 5
+
+#define USB_HOST_CONTROLLERS_NUMBER 1
+
+#define USB_HOST_TRANSFERS_NUMBER 10
+
+/* Number of Host Layer Clients */
+#define USB_HOST_CLIENTS_NUMBER 1
+
+
+/* Number of HID Client driver instances in the application */
+#define USB_HOST_HID_INSTANCES_NUMBER 1
+
+/* Maximum number of INTERRUPT IN endpoints supported per HID interface */
+#define USB_HOST_HID_INTERRUPT_IN_ENDPOINTS_NUMBER 1
+
+/* Number of total usage driver instances registered with HID client driver */
+#define USB_HOST_HID_USAGE_DRIVER_SUPPORT_NUMBER 1
+
+/* Maximum number PUSH items that can be saved in the Global item queue per field
+ * per HID interface */
+#define USB_HID_GLOBAL_PUSH_POP_STACK_SIZE 1
+
+
+
+
+
+
+
+
+
+
+
+#endif // _SYSTEM_CONFIG_H
+/*******************************************************************************
+ End of File
+*/
+
diff --git a/firmware/src/system_config/pic32mx695f512h/system_definitions.h b/firmware/src/system_config/pic32mx695f512h/system_definitions.h
new file mode 100644
index 0000000..c2d8147
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/system_definitions.h
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ System Definitions
+
+ File Name:
+ system_definitions.h
+
+ Summary:
+ MPLAB Harmony project system definitions.
+
+ Description:
+ This file contains the system-wide prototypes and definitions for an MPLAB
+ Harmony project.
+ *******************************************************************************/
+
+//DOM-IGNORE-BEGIN
+/*******************************************************************************
+Copyright (c) 2013-2014 released Microchip Technology Inc. All rights reserved.
+
+Microchip licenses to you the right to use, modify, copy and distribute
+Software only when embedded on a Microchip microcontroller or digital signal
+controller that is integrated into your product or third party product
+(pursuant to the sublicense terms in the accompanying license agreement).
+
+You should refer to the license agreement accompanying this Software for
+additional information regarding your rights and obligations.
+
+SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
+IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
+CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
+OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
+INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
+CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
+SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
+(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
+ *******************************************************************************/
+//DOM-IGNORE-END
+
+#ifndef _SYS_DEFINITIONS_H
+#define _SYS_DEFINITIONS_H
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Included Files
+// *****************************************************************************
+// *****************************************************************************
+
+#include <stdint.h>
+#include <stddef.h>
+#include <stdbool.h>
+#include "system/common/sys_common.h"
+#include "system/common/sys_module.h"
+#include "system/clk/sys_clk.h"
+#include "system/clk/sys_clk_static.h"
+#include "system/devcon/sys_devcon.h"
+#include "system/int/sys_int.h"
+#include "system/tmr/sys_tmr.h"
+#include "driver/tmr/drv_tmr.h"
+#include "system/ports/sys_ports.h"
+
+
+#include "driver/usb/usbfs/drv_usbfs.h"
+#include "usb/usb_host.h"
+#include "usb/usb_host_hub.h"
+#include "usb/usb_host_hub_interface.h"
+#include "usb/usb_host_hid.h"
+#include "usb/usb_host_hid_keyboard.h"
+#include "app.h"
+
+
+// DOM-IGNORE-BEGIN
+#ifdef __cplusplus // Provide C++ Compatibility
+
+extern "C" {
+
+#endif
+// DOM-IGNORE-END
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Type Definitions
+// *****************************************************************************
+// *****************************************************************************
+
+// *****************************************************************************
+/* System Objects
+
+ Summary:
+ Structure holding the system's object handles
+
+ Description:
+ This structure contains the object handles for all objects in the
+ MPLAB Harmony project's system configuration.
+
+ Remarks:
+ These handles are returned from the "Initialize" functions for each module
+ and must be passed into the "Tasks" function for each module.
+*/
+
+typedef struct
+{
+ SYS_MODULE_OBJ sysDevcon;
+ SYS_MODULE_OBJ sysTmr;
+ SYS_MODULE_OBJ drvTmr0;
+ SYS_MODULE_OBJ drvUSBObject;
+
+
+ SYS_MODULE_OBJ usbHostObject0;
+
+
+} SYSTEM_OBJECTS;
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: extern declarations
+// *****************************************************************************
+// *****************************************************************************
+
+extern SYSTEM_OBJECTS sysObj;
+
+
+
+//DOM-IGNORE-BEGIN
+#ifdef __cplusplus
+}
+#endif
+//DOM-IGNORE-END
+
+#endif /* _SYS_DEFINITIONS_H */
+/*******************************************************************************
+ End of File
+*/
+
diff --git a/firmware/src/system_config/pic32mx695f512h/system_exceptions.c b/firmware/src/system_config/pic32mx695f512h/system_exceptions.c
new file mode 100644
index 0000000..73a2380
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/system_exceptions.c
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ MPLAB Harmony Exceptions Source File
+
+ File Name:
+ system_exceptions.c
+
+ Summary:
+ This file contains a function which overrides the deafult _weak_ exception
+ handler provided by the XC32 compiler.
+
+ Description:
+ This file redefines the default _weak_ exception handler with a more debug
+ friendly one. If an unexpected exception occurs the code will stop in a
+ while(1) loop. The debugger can be halted and two variables _excep_code and
+ _except_addr can be examined to determine the cause and address where the
+ exception occured.
+ *******************************************************************************/
+
+// DOM-IGNORE-BEGIN
+/*******************************************************************************
+Copyright (c) 2013-2015 released Microchip Technology Inc. All rights reserved.
+
+Microchip licenses to you the right to use, modify, copy and distribute
+Software only when embedded on a Microchip microcontroller or digital signal
+controller that is integrated into your product or third party product
+(pursuant to the sublicense terms in the accompanying license agreement).
+
+You should refer to the license agreement accompanying this Software for
+additional information regarding your rights and obligations.
+
+SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
+IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
+CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
+OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
+INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
+CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
+SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
+(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
+ *******************************************************************************/
+// DOM-IGNORE-END
+
+
+#include <xc.h> /* Defines special funciton registers, CP0 regs */
+#include "system_config.h"
+#include "system_definitions.h"
+#include "system/debug/sys_debug.h"
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Global Data Definitions
+// *****************************************************************************
+// *****************************************************************************
+
+/*******************************************************************************
+ Exception Reason Data
+
+ <editor-fold defaultstate="expanded" desc="Exception Reason Data">
+
+ Remarks:
+ These global static items are used instead of local variables in the
+ _general_exception_handler function because the stack may not be available
+ if an exception has occured.
+*/
+
+/* Code identifying the cause of the exception (CP0 Cause register). */
+static unsigned int _excep_code;
+
+/* Address of instruction that caused the exception. */
+static unsigned int _excep_addr;
+
+/* Pointer to the string describing the cause of the exception. */
+static char *_cause_str;
+
+/* Array identifying the cause (indexed by _exception_code). */
+static char *cause[] =
+{
+ "Interrupt",
+ "Undefined",
+ "Undefined",
+ "Undefined",
+ "Load/fetch address error",
+ "Store address error",
+ "Instruction bus error",
+ "Data bus error",
+ "Syscall",
+ "Breakpoint",
+ "Reserved instruction",
+ "Coprocessor unusable",
+ "Arithmetic overflow",
+ "Trap",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved"
+};
+
+// </editor-fold>
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Exception Handling
+// *****************************************************************************
+// *****************************************************************************
+
+/*******************************************************************************
+ Function:
+ void _general_exception_handler ( void )
+
+ Summary:
+ Overrides the XC32 _weak_ _generic_exception_handler.
+
+ Description:
+ This function overrides the XC32 default _weak_ _generic_exception_handler.
+
+ Remarks:
+ Refer to the XC32 User's Guide for additional information.
+ */
+
+void _general_exception_handler ( void )
+{
+ /* Mask off Mask of the ExcCode Field from the Cause Register
+ Refer to the MIPs Software User's manual */
+ _excep_code = (_CP0_GET_CAUSE() & 0x0000007C) >> 2;
+ _excep_addr = _CP0_GET_EPC();
+ _cause_str = cause[_excep_code];
+
+ SYS_DEBUG_PRINT(SYS_ERROR_ERROR, "\nGeneral Exception %s (cause=%d, addr=%x).\n",
+ _cause_str, _excep_code, _excep_addr);
+
+ while (1)
+ {
+ SYS_DEBUG_BreakPoint();
+ }
+}
+
+/*******************************************************************************
+ End of File
+*/
diff --git a/firmware/src/system_config/pic32mx695f512h/system_init.c b/firmware/src/system_config/pic32mx695f512h/system_init.c
new file mode 100644
index 0000000..e709d69
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/system_init.c
@@ -0,0 +1,336 @@
+/*******************************************************************************
+ System Initialization File
+
+ File Name:
+ system_init.c
+
+ Summary:
+ This file contains source code necessary to initialize the system.
+
+ Description:
+ This file contains source code necessary to initialize the system. It
+ implements the "SYS_Initialize" function, defines the configuration bits,
+ and allocates any necessary global system resources, such as the
+ sysObj structure that contains the object handles to all the MPLAB Harmony
+ module objects in the system.
+ *******************************************************************************/
+
+// DOM-IGNORE-BEGIN
+/*******************************************************************************
+Copyright (c) 2013-2015 released Microchip Technology Inc. All rights reserved.
+
+Microchip licenses to you the right to use, modify, copy and distribute
+Software only when embedded on a Microchip microcontroller or digital signal
+controller that is integrated into your product or third party product
+(pursuant to the sublicense terms in the accompanying license agreement).
+
+You should refer to the license agreement accompanying this Software for
+additional information regarding your rights and obligations.
+
+SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
+IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
+CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
+OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
+INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
+CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
+SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
+(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
+ *******************************************************************************/
+// DOM-IGNORE-END
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Included Files
+// *****************************************************************************
+// *****************************************************************************
+
+#include "system_config.h"
+#include "system_definitions.h"
+
+
+// ****************************************************************************
+// ****************************************************************************
+// Section: Configuration Bits
+// ****************************************************************************
+// ****************************************************************************
+// <editor-fold defaultstate="collapsed" desc="Configuration Bits">
+
+/*** DEVCFG0 ***/
+
+#pragma config DEBUG = OFF
+#pragma config ICESEL = ICS_PGx2
+#pragma config PWP = OFF
+#pragma config BWP = OFF
+#pragma config CP = OFF
+
+/*** DEVCFG1 ***/
+
+#pragma config FNOSC = FRCPLL
+#pragma config FSOSCEN = ON
+#pragma config IESO = OFF
+#pragma config POSCMOD = OFF
+#pragma config OSCIOFNC = OFF
+#pragma config FPBDIV = DIV_1
+#pragma config FCKSM = CSDCMD
+#pragma config WDTPS = PS1048576
+#pragma config FWDTEN = OFF
+
+/*** DEVCFG2 ***/
+
+#pragma config FPLLIDIV = DIV_2
+#pragma config FPLLMUL = MUL_20
+#pragma config FPLLODIV = DIV_1
+#pragma config UPLLIDIV = DIV_2
+#pragma config UPLLEN = OFF
+
+/*** DEVCFG3 ***/
+
+#pragma config USERID = 0xffff
+#pragma config FSRSSEL = PRIORITY_7
+#pragma config FMIIEN = ON
+#pragma config FETHIO = ON
+#pragma config FUSBIDIO = ON
+#pragma config FVBUSONIO = ON
+// </editor-fold>
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Library/Stack Initialization Data
+// *****************************************************************************
+// *****************************************************************************
+
+//<editor-fold defaultstate="collapsed" desc="USB Stack Initialization Data">
+
+// </editor-fold>
+
+//<editor-fold defaultstate="collapsed" desc="USB Host Initialization Data">
+
+
+
+/****************************************************
+ * Endpoint Table needed by the controller driver .
+ ****************************************************/
+
+
+uint8_t __attribute__((aligned(512))) endpointTable[32];
+
+
+DRV_USBFS_INIT drvUSBFSInit =
+{
+ .endpointTable = endpointTable,
+ .interruptSource = INT_SOURCE_USB_1,
+ .moduleInit = {SYS_MODULE_POWER_RUN_FULL},
+ .operationMode = DRV_USBFS_OPMODE_HOST,
+ .operationSpeed = USB_SPEED_FULL,
+ .portIndication = NULL,
+ .portOverCurrentDetect = BSP_USBVBUSSwitchOverCurrentDetect,
+ .portPowerEnable = BSP_USBVBUSPowerEnable,
+ .rootHubAvailableCurrent = 500,
+ .stopInIdle = false,
+ .suspendInSleep = false,
+ .usbID = USB_ID_1
+};
+
+
+
+
+USB_HOST_HID_USAGE_DRIVER_INTERFACE usageDriverInterface =
+{
+ .initialize = NULL,
+ .deinitialize = NULL,
+ .usageDriverEventHandler = _USB_HOST_HID_KEYBOARD_EventHandler,
+ .usageDriverTask = _USB_HOST_HID_KEYBOARD_Task
+};
+
+USB_HOST_HID_USAGE_DRIVER_TABLE_ENTRY usageDriverTableEntry[1] =
+{
+ {
+ .usage = USB_HID_GENERIC_DESKTOP_KEYBOARD,
+ .initializeData = NULL,
+ .interface = &usageDriverInterface
+ }
+};
+
+
+USB_HOST_HID_INIT hidInitData =
+{
+ .nUsageDriver = 1,
+ .usageDriverTable = usageDriverTableEntry
+};
+const USB_HOST_TPL_ENTRY USBTPList[ 1 ] =
+{
+
+
+
+ TPL_INTERFACE_CLASS_SUBCLASS_PROTOCOL(0x03, 0x01, 0x01, &hidInitData, USB_HOST_HID_INTERFACE) ,
+
+
+
+
+};
+
+const USB_HOST_HCD hcdTable =
+{
+ .drvIndex = DRV_USBFS_INDEX_0,
+ .hcdInterface = DRV_USBFS_HOST_INTERFACE
+};
+
+
+const USB_HOST_INIT usbHostInitData =
+{
+ .nTPLEntries = 1 ,
+ .tplList = (USB_HOST_TPL_ENTRY *)USBTPList,
+ .hostControllerDrivers = (USB_HOST_HCD *)&hcdTable
+
+};
+
+
+
+
+
+
+// </editor-fold>
+
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Driver Initialization Data
+// *****************************************************************************
+// *****************************************************************************
+
+//<editor-fold defaultstate="collapsed" desc="DRV_Timer Initialization Data">
+
+/*** TMR Driver Initialization Data ***/
+
+const DRV_TMR_INIT drvTmr0InitData =
+{
+ .moduleInit.sys.powerState = DRV_TMR_POWER_STATE_IDX0,
+ .tmrId = DRV_TMR_PERIPHERAL_ID_IDX0,
+ .clockSource = DRV_TMR_CLOCK_SOURCE_IDX0,
+ .prescale = DRV_TMR_PRESCALE_IDX0,
+ .mode = DRV_TMR_OPERATION_MODE_IDX0,
+ .interruptSource = DRV_TMR_INTERRUPT_SOURCE_IDX0,
+ .asyncWriteEnable = false,
+};
+// </editor-fold>
+//<editor-fold defaultstate="collapsed" desc="SYS_TMR Initialization Data">
+/*** TMR Service Initialization Data ***/
+const SYS_TMR_INIT sysTmrInitData =
+{
+ .moduleInit = {SYS_MODULE_POWER_RUN_FULL},
+ .drvIndex = DRV_TMR_INDEX_0,
+ .tmrFreq = 1000,
+};
+
+// </editor-fold>
+//<editor-fold defaultstate="collapsed" desc="DRV_USB Initialization Data">
+// </editor-fold>
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: System Data
+// *****************************************************************************
+// *****************************************************************************
+
+/* Structure to hold the object handles for the modules in the system. */
+SYSTEM_OBJECTS sysObj;
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Module Initialization Data
+// *****************************************************************************
+// *****************************************************************************
+
+/*******************************************************************************
+ Device Control System Service Initialization Data
+
+ <editor-fold defaultstate="collapsed"
+ desc="Device Control System Service Initialization Data">
+*/
+
+const SYS_DEVCON_INIT sysDevconInit =
+{
+ .moduleInit = {0},
+};
+
+// </editor-fold>
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Static Initialization Functions
+// *****************************************************************************
+// *****************************************************************************
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: System Initialization
+// *****************************************************************************
+// *****************************************************************************
+
+/*******************************************************************************
+ Function:
+ void SYS_Initialize ( SYS_INIT_DATA *data )
+
+ Summary:
+ Initializes the board, services, drivers, application and other modules.
+
+ Remarks:
+ See prototype in system/common/sys_module.h.
+ */
+
+void SYS_Initialize ( void* data )
+{
+ /* Core Processor Initialization */
+ SYS_CLK_Initialize( NULL );
+ sysObj.sysDevcon = SYS_DEVCON_Initialize(SYS_DEVCON_INDEX_0, (SYS_MODULE_INIT*)&sysDevconInit);
+ SYS_DEVCON_PerformanceConfig(SYS_CLK_SystemFrequencyGet());
+ SYS_DEVCON_JTAGDisable();
+ SYS_PORTS_Initialize();
+
+ /* Initialize Drivers */
+
+ sysObj.drvTmr0 = DRV_TMR_Initialize(DRV_TMR_INDEX_0, (SYS_MODULE_INIT *)&drvTmr0InitData);
+
+ SYS_INT_VectorPrioritySet(INT_VECTOR_T1, INT_PRIORITY_LEVEL1);
+ SYS_INT_VectorSubprioritySet(INT_VECTOR_T1, INT_SUBPRIORITY_LEVEL0);
+
+
+
+ /* Initialize System Services */
+ SYS_INT_Initialize();
+
+ /*** TMR Service Initialization Code ***/
+ sysObj.sysTmr = SYS_TMR_Initialize(SYS_TMR_INDEX_0, (const SYS_MODULE_INIT * const)&sysTmrInitData);
+
+ /* Initialize Middleware */
+
+
+ sysObj.usbHostObject0 = USB_HOST_Initialize (( SYS_MODULE_INIT *)& usbHostInitData );
+ sysObj.drvUSBObject = DRV_USBFS_Initialize(DRV_USBFS_INDEX_0, (SYS_MODULE_INIT *)&drvUSBFSInit);
+
+
+ SYS_INT_VectorPrioritySet(INT_VECTOR_USB1, INT_PRIORITY_LEVEL4);
+ SYS_INT_VectorSubprioritySet(INT_VECTOR_USB1, INT_SUBPRIORITY_LEVEL0);
+
+
+
+ /* Enable Global Interrupts */
+ SYS_INT_Enable();
+
+ /* Initialize the Application */
+ APP_Initialize();
+}
+
+
+/*******************************************************************************
+ End of File
+*/
+
diff --git a/firmware/src/system_config/pic32mx695f512h/system_interrupt.c b/firmware/src/system_config/pic32mx695f512h/system_interrupt.c
new file mode 100644
index 0000000..4d35043
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/system_interrupt.c
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ System Interrupts File
+
+ File Name:
+ system_int.c
+
+ Summary:
+ Raw ISR definitions.
+
+ Description:
+ This file contains a definitions of the raw ISRs required to support the
+ interrupt sub-system.
+
+ Summary:
+ This file contains source code for the interrupt vector functions in the
+ system.
+
+ Description:
+ This file contains source code for the interrupt vector functions in the
+ system. It implements the system and part specific vector "stub" functions
+ from which the individual "Tasks" functions are called for any modules
+ executing interrupt-driven in the MPLAB Harmony system.
+
+ Remarks:
+ This file requires access to the systemObjects global data structure that
+ contains the object handles to all MPLAB Harmony module objects executing
+ interrupt-driven in the system. These handles are passed into the individual
+ module "Tasks" functions to identify the instance of the module to maintain.
+ *******************************************************************************/
+
+// DOM-IGNORE-BEGIN
+/*******************************************************************************
+Copyright (c) 2011-2014 released Microchip Technology Inc. All rights reserved.
+
+Microchip licenses to you the right to use, modify, copy and distribute
+Software only when embedded on a Microchip microcontroller or digital signal
+controller that is integrated into your product or third party product
+(pursuant to the sublicense terms in the accompanying license agreement).
+
+You should refer to the license agreement accompanying this Software for
+additional information regarding your rights and obligations.
+
+SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
+IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
+CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
+OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
+INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
+CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
+SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
+(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
+ *******************************************************************************/
+// DOM-IGNORE-END
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Included Files
+// *****************************************************************************
+// *****************************************************************************
+
+#include <xc.h>
+#include <sys/attribs.h>
+#include "app.h"
+#include "system_definitions.h"
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: System Interrupt Vector Functions
+// *****************************************************************************
+// *****************************************************************************
+void __ISR(_TIMER_1_VECTOR, ipl1AUTO) _IntHandlerDrvTmrInstance0(void)
+{
+
+ DRV_TMR_Tasks_ISR(sysObj.drvTmr0);
+
+}
+ void __ISR( _USB_1_VECTOR , IPL4AUTO)_IntHandler_USB_stub ( void )
+{
+ DRV_USBFS_Tasks_ISR(sysObj.drvUSBObject);
+}
+
+
+
+/*******************************************************************************
+ End of File
+*/
+
diff --git a/firmware/src/system_config/pic32mx695f512h/system_tasks.c b/firmware/src/system_config/pic32mx695f512h/system_tasks.c
new file mode 100644
index 0000000..c1d4b28
--- /dev/null
+++ b/firmware/src/system_config/pic32mx695f512h/system_tasks.c
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ System Tasks File
+
+ File Name:
+ system_tasks.c
+
+ Summary:
+ This file contains source code necessary to maintain system's polled state
+ machines.
+
+ Description:
+ This file contains source code necessary to maintain system's polled state
+ machines. It implements the "SYS_Tasks" function that calls the individual
+ "Tasks" functions for all polled MPLAB Harmony modules in the system.
+
+ Remarks:
+ This file requires access to the systemObjects global data structure that
+ contains the object handles to all MPLAB Harmony module objects executing
+ polled in the system. These handles are passed into the individual module
+ "Tasks" functions to identify the instance of the module to maintain.
+ *******************************************************************************/
+
+// DOM-IGNORE-BEGIN
+/*******************************************************************************
+Copyright (c) 2013-2015 released Microchip Technology Inc. All rights reserved.
+
+Microchip licenses to you the right to use, modify, copy and distribute
+Software only when embedded on a Microchip microcontroller or digital signal
+controller that is integrated into your product or third party product
+(pursuant to the sublicense terms in the accompanying license agreement).
+
+You should refer to the license agreement accompanying this Software for
+additional information regarding your rights and obligations.
+
+SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
+IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
+CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
+OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
+INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
+CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
+SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
+(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
+ *******************************************************************************/
+// DOM-IGNORE-END
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: Included Files
+// *****************************************************************************
+// *****************************************************************************
+
+#include "system_config.h"
+#include "system_definitions.h"
+
+
+// *****************************************************************************
+// *****************************************************************************
+// Section: System "Tasks" Routine
+// *****************************************************************************
+// *****************************************************************************
+
+/*******************************************************************************
+ Function:
+ void SYS_Tasks ( void )
+
+ Remarks:
+ See prototype in system/common/sys_module.h.
+*/
+
+void SYS_Tasks ( void )
+{
+ /* Maintain system services */
+ SYS_DEVCON_Tasks(sysObj.sysDevcon);
+ SYS_TMR_Tasks(sysObj.sysTmr);
+
+ /* Maintain Device Drivers */
+ DRV_TMR_Tasks(sysObj.drvTmr0);
+
+ /* Maintain Middleware & Other Libraries */
+
+
+ /* USBFS Driver Task Routine */
+ DRV_USBFS_Tasks(sysObj.drvUSBObject);
+
+
+
+ /* USB Host layer task routine.*/
+ USB_HOST_Tasks(sysObj.usbHostObject0);
+
+
+
+
+ /* Maintain the application's state machine. */
+ APP_Tasks();
+}
+
+
+/*******************************************************************************
+ End of File
+ */
+
diff --git a/firmware/src/t6963c_specific.h b/firmware/src/t6963c_specific.h
index 12be1f7..8833f8b 100644
--- a/firmware/src/t6963c_specific.h
+++ b/firmware/src/t6963c_specific.h
@@ -39,8 +39,8 @@
#define t6963c_t_ce TRISBbits.TRISB9 // TRIS bit of CE pin
#define t6963c_t_rd TRISBbits.TRISB10 // TRIS bit of RD pin
#define t6963c_t_wr TRISBbits.TRISB11 // TRIS bit of WR pin
-#define t6963c_data LATB // Data port (the lowest 8 bits are assumed)
-#define t6963c_t_data TRISB // TRIS register of data port
+#define t6963c_data LATE // Data port (the lowest 8 bits are assumed)
+#define t6963c_t_data TRISE // TRIS register of data port
#define t6963c_rows 16 // Number of rows of the LCD
#define t6963c_columns 40 // Number of columns of the LCD