diff --git a/.gitignore b/.gitignore index f6bae3a..b01cb43 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ Sales.xlsx TODO.txt Hardware/Case/case.scad.* Costs.xlsx +Hardware/Case/outputs/ diff --git a/Firmware/Keyboard/Config.c b/Firmware/Keyboard/Config.c index 7e7c36e..f293adc 100644 --- a/Firmware/Keyboard/Config.c +++ b/Firmware/Keyboard/Config.c @@ -16,8 +16,11 @@ static sdvx_config_t defaults PROGMEM = { HID_KEYBOARD_SC_ENTER}, .ledsOn = true, .debounce = 30, - .macroClick = KEYPADPLUS, - .macroPin = {KEYPAD0,KEYPAD0,KEYPAD0,KEYPAD0} + .macroClick = HID_KEYBOARD_SC_KEYPAD_PLUS, + .macroPin = {HID_KEYBOARD_SC_KEYPAD_0_AND_INSERT, + HID_KEYBOARD_SC_KEYPAD_0_AND_INSERT, + HID_KEYBOARD_SC_KEYPAD_0_AND_INSERT, + HID_KEYBOARD_SC_KEYPAD_0_AND_INSERT} }; uint8_t firstRun EEMEM; // init to 255 diff --git a/Firmware/Keyboard/Descriptors.c b/Firmware/Keyboard/Descriptors.c index b1fdd50..0b3beb8 100644 --- a/Firmware/Keyboard/Descriptors.c +++ b/Firmware/Keyboard/Descriptors.c @@ -1,18 +1,5 @@ -/** \file - * - * USB Device Descriptors, for library use when in USB device mode. Descriptors are special - * computer-readable structures which the host requests upon device enumeration, to determine - * the device's capabilities and functions. - */ - #include "Descriptors.h" -/** HID class report descriptor. This is a special descriptor constructed with values from the - * USBIF HID class specification to describe the reports and capabilities of the HID device. This - * descriptor is parsed by the host and its contents used to determine what data (and in what encoding) - * the device will send, and what it may be sent back from the host. Refer to the HID specification for - * more details on HID report descriptors. - */ const USB_Descriptor_HIDReport_Datatype_t PROGMEM GenericReport[] = { HID_RI_USAGE_PAGE(16, 0xFFDC), /* Vendor Page 0xDC */ @@ -65,26 +52,12 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM LEDReport[] = HID_RI_END_COLLECTION(0), }; -/** HID class report descriptor. This is a special descriptor constructed with values from the - * USBIF HID class specification to describe the reports and capabilities of the HID device. This - * descriptor is parsed by the host and its contents used to determine what data (and in what encoding) - * the device will send, and what it may be sent back from the host. Refer to the HID specification for - * more details on HID report descriptors. - */ const USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] = { // Use the HID class driver's standard Keyboard report HID_DESCRIPTOR_KEYBOARD(SWITCH_COUNT) }; -/** HID class report descriptor. This is a special descriptor constructed with values from the - * USBIF HID class specification to describe the reports and capabilities of the HID device. This - * descriptor is parsed by the host and its contents used to determine what data (and in what encoding) - * the device will send, and what it may be sent back from the host. Refer to the HID specification for - * more details on HID report descriptors. - * - * This descriptor describes the mouse HID interface's report structure. - */ const USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] = { /* Use the HID class driver's standard Mouse report. @@ -95,11 +68,6 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] = HID_DESCRIPTOR_MOUSE(-128, 127, -128, 127, 1, false) }; -/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall - * device characteristics, including the supported USB version, control endpoint size and the - * number of device configurations. The descriptor is read out by the USB host when the enumeration - * process begins. - */ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, @@ -122,11 +90,6 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS }; -/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage - * of the device in one of its supported configurations, including information about any device interfaces - * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting - * a configuration so that the host may correctly communicate with the USB device. - */ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Config = @@ -293,22 +256,8 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = }, }; -/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests - * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate - * via the language ID table available at USB.org what languages the device supports for its string descriptors. - */ const USB_Descriptor_String_t PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG); - -/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable - * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device - * Descriptor. - */ const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"mon.im"); - -/** Product descriptor string. This is a Unicode string containing the product's details in human readable form, - * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device - * Descriptor. - */ const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"Pocket Voltex"); const USB_Descriptor_String_t PROGMEM ConfigString = USB_STRING_DESCRIPTOR(L"Pocket Voltex Config"); const USB_Descriptor_String_t PROGMEM LEDString = USB_STRING_DESCRIPTOR(L"Pocket Voltex LEDs"); diff --git a/Firmware/Keyboard/Keyboard.c b/Firmware/Keyboard/Keyboard.c index f969892..d5b242e 100644 --- a/Firmware/Keyboard/Keyboard.c +++ b/Firmware/Keyboard/Keyboard.c @@ -167,21 +167,21 @@ int main(void) InitConfig(); - SetupHardware(); + SetupHardware(); - GlobalInterruptEnable(); + GlobalInterruptEnable(); // Blink to show we're not in bootloader led_anim_flash(); - for (;;) - { - HID_Device_USBTask(&Keyboard_HID_Interface); + for (;;) + { + HID_Device_USBTask(&Keyboard_HID_Interface); HID_Device_USBTask(&Mouse_HID_Interface); - HID_Device_USBTask(&Generic_HID_Interface); - HID_Device_USBTask(&LED_HID_Interface); - USB_USBTask(); - } + HID_Device_USBTask(&Generic_HID_Interface); + HID_Device_USBTask(&LED_HID_Interface); + USB_USBTask(); + } } /** Configures the board hardware and chip peripherals */ @@ -189,9 +189,9 @@ void SetupHardware() { uint8_t i; - /* Disable watchdog if enabled by bootloader/fuses */ - MCUSR &= ~(1 << WDRF); - wdt_disable(); + /* Disable watchdog if enabled by bootloader/fuses */ + MCUSR &= ~(1 << WDRF); + wdt_disable(); for(i = 0; i < SWITCH_COUNT; i++) { switches[i].state = 0; @@ -210,11 +210,11 @@ void SetupHardware() RebootToBootloader(); } - /* Hardware Initialization */ + /* Hardware Initialization */ encoder_init(); led_init(); - USB_Init(); + USB_Init(); } /** HID class driver callback function for the creation of HID reports to the host. @@ -277,8 +277,8 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn encoder_set(0, 0); encoder_set(1, 0); - *ReportSize = sizeof(USB_MouseReport_Data_t); - return true; + *ReportSize = sizeof(USB_MouseReport_Data_t); + return true; } else if(HIDInterfaceInfo == &Generic_HID_Interface) { uint8_t* ConfigReport = (uint8_t*)ReportData; memcpy(ConfigReport, &sdvxConfig, sizeof(sdvx_config_t)); @@ -337,7 +337,7 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI /** Event handler for the library USB Connection event. */ void EVENT_USB_Device_Connect(void) { - + } /** Event handler for the library USB Disconnection event. */ @@ -349,12 +349,12 @@ void EVENT_USB_Device_Disconnect(void) /** Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void) { - HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface); + HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface); HID_Device_ConfigureEndpoints(&Mouse_HID_Interface); - HID_Device_ConfigureEndpoints(&Generic_HID_Interface); - HID_Device_ConfigureEndpoints(&LED_HID_Interface); + HID_Device_ConfigureEndpoints(&Generic_HID_Interface); + HID_Device_ConfigureEndpoints(&LED_HID_Interface); - USB_Device_EnableSOFEvents(); + USB_Device_EnableSOFEvents(); } /** Event handler for the library USB Control Request reception event. */