Mercurial > louis > kiibohd-controller
comparison Output/pjrcUSB/arm/usb_dev.c @ 370:39e338a6733d
Fixing default ErgoDox layout and adding FlashMode button
- Adds proper flashMode support for all keyboards and microcontrollers (usb and serial)
- flashModeEnabled must be set to 1 otherwise it will only show an error
* This is on purpose (somewhat dangerous feature as it allows remote flashing)
- Capability cleanup
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Fri, 21 Aug 2015 19:43:45 -0700 |
parents | 06a54d582bf8 |
children | 47f89f1bfdb7 |
comparison
equal
deleted
inserted
replaced
369:ce9720634c15 | 370:39e338a6733d |
---|---|
32 // ----- Includes ----- | 32 // ----- Includes ----- |
33 | 33 |
34 // Project Includes | 34 // Project Includes |
35 #include <Lib/OutputLib.h> | 35 #include <Lib/OutputLib.h> |
36 #include <print.h> | 36 #include <print.h> |
37 #include <kll_defs.h> | |
37 | 38 |
38 // Local Includes | 39 // Local Includes |
39 #include "usb_dev.h" | 40 #include "usb_dev.h" |
40 #include "usb_mem.h" | 41 #include "usb_mem.h" |
41 | 42 |
870 } | 871 } |
871 | 872 |
872 | 873 |
873 void usb_device_reload() | 874 void usb_device_reload() |
874 { | 875 { |
876 if ( flashModeEnabled_define == 0 ) | |
877 { | |
878 print( NL ); | |
879 warn_print("flashModeEnabled not set, cancelling firmware reload..."); | |
880 info_msg("Set flashModeEnabled to 1 in your kll configuration."); | |
881 return; | |
882 } | |
883 | |
875 // MCHCK | 884 // MCHCK |
876 #if defined(_mk20dx128vlf5_) | 885 #if defined(_mk20dx128vlf5_) |
877 | 886 |
878 // MCHCK Kiibohd Variant | 887 // MCHCK Kiibohd Variant |
879 // Check to see if PTA3 (has a pull-up) is connected to GND (usually via jumper) | 888 // Check to see if PTA3 (has a pull-up) is connected to GND (usually via jumper) |
880 // Only allow reload if the jumper is present (security) | 889 // Only allow reload if the jumper is present (security) |
881 GPIOA_PDDR &= ~(1<<3); // Input | 890 GPIOA_PDDR &= ~(1<<3); // Input |
882 PORTA_PCR3 = PORT_PCR_PFE | PORT_PCR_MUX(1); // Internal pull-up | 891 PORTA_PCR3 = PORT_PCR_PFE | PORT_PCR_MUX(1); // Internal pull-up |
883 | 892 |
884 // Check for jumper | 893 // Check for jumper |
885 if ( GPIOA_PDIR & (1<<3) ) | 894 if ( GPIOA_PDIR & (1<<3) && flashModeEnabled_define != 0 ) |
886 { | 895 { |
887 print( NL ); | 896 print( NL ); |
888 warn_print("Security jumper not present, cancelling firmware reload..."); | 897 warn_print("Security jumper not present, cancelling firmware reload..."); |
889 info_msg("Replace jumper on middle 2 pins, or manually press the firmware reload button."); | 898 info_msg("Replace jumper on middle 2 pins, or manually press the firmware reload button."); |
890 } | 899 } |