diff options
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/avr.mk | 8 | ||||
| -rw-r--r-- | tmk_core/chibios.mk | 4 | ||||
| -rw-r--r-- | tmk_core/common/action.c | 3 | ||||
| -rw-r--r-- | tmk_core/common/action_layer.h | 14 | ||||
| -rw-r--r-- | tmk_core/common/avr/bootloader.c | 10 | ||||
| -rw-r--r-- | tmk_core/common/avr/timer.c | 19 | ||||
| -rw-r--r-- | tmk_core/common/progmem.h | 2 | ||||
| -rw-r--r-- | tmk_core/common/util.c | 6 | ||||
| -rw-r--r-- | tmk_core/protocol/lufa/lufa.h | 6 | ||||
| -rw-r--r-- | tmk_core/protocol/vusb/usbconfig.h | 2 | ||||
| -rw-r--r-- | tmk_core/protocol/vusb/vusb.c | 4 |
11 files changed, 40 insertions, 38 deletions
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index 2c65a34aa3..a8d01a9e8c 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -98,10 +98,6 @@ ifndef TEENSY_LOADER_CLI endif endif -# Program the device. -program: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep check-size - $(PROGRAM_CMD) - define EXEC_TEENSY $(TEENSY_LOADER_CLI) -mmcu=$(MCU) -w -v $(BUILD_DIR)/$(TARGET).hex endef @@ -314,7 +310,9 @@ production: $(BUILD_DIR)/$(TARGET).hex bootloader cpfirmware $(SIZE) $(TARGET).hex $(TARGET)_bootloader.hex $(TARGET)_production.hex flash: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware -ifeq ($(strip $(BOOTLOADER)), caterina) +ifneq ($(strip $(PROGRAM_CMD)),) + $(PROGRAM_CMD) +else ifeq ($(strip $(BOOTLOADER)), caterina) $(call EXEC_AVRDUDE) else ifeq ($(strip $(BOOTLOADER)), halfkay) $(call EXEC_TEENSY) diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index f3b4b399cc..6bacabbbf3 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -327,7 +327,9 @@ bin: $(BUILD_DIR)/$(TARGET).bin sizeafter flash: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter -ifeq ($(strip $(BOOTLOADER)),dfu) +ifneq ($(strip $(PROGRAM_CMD)),) + $(PROGRAM_CMD) +else ifeq ($(strip $(BOOTLOADER)),dfu) $(call EXEC_DFU_UTIL) else ifeq ($(strip $(MCU_FAMILY)),KINETIS) $(call EXEC_TEENSY) diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 19c3569d55..74db245c12 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -775,11 +775,12 @@ void register_code(uint8_t code) { add_mods(MOD_BIT(code)); send_keyboard_report(); } +#ifdef EXTRAKEY_ENABLE else if IS_SYSTEM(code) { host_system_send(KEYCODE2SYSTEM(code)); } else if IS_CONSUMER(code) { host_consumer_send(KEYCODE2CONSUMER(code)); } - +#endif #ifdef MOUSEKEY_ENABLE else if IS_MOUSEKEY(code) { diff --git a/tmk_core/common/action_layer.h b/tmk_core/common/action_layer.h index b8562f5a46..c283d26232 100644 --- a/tmk_core/common/action_layer.h +++ b/tmk_core/common/action_layer.h @@ -82,13 +82,13 @@ void layer_xor(layer_state_t state); # define layer_debug() # define layer_clear() -# define layer_move(layer) -# define layer_on(layer) -# define layer_off(layer) -# define layer_invert(layer) -# define layer_or(state) -# define layer_and(state) -# define layer_xor(state) +# define layer_move(layer) (void)layer +# define layer_on(layer) (void)layer +# define layer_off(layer) (void)layer +# define layer_invert(layer) (void)layer +# define layer_or(state) (void)state +# define layer_and(state) (void)state +# define layer_xor(state) (void)state #endif layer_state_t layer_state_set_user(layer_state_t state); diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c index ca9746f327..7e5d2b0579 100644 --- a/tmk_core/common/avr/bootloader.c +++ b/tmk_core/common/avr/bootloader.c @@ -237,17 +237,17 @@ void bootloader_jump(void) { "bootloader_startup_loop%=: \n\t" "rjmp bootloader_startup_loop%= \n\t" : - : [ mcucsrio ] "I"(_SFR_IO_ADDR(MCUCSR)), + : [mcucsrio] "I"(_SFR_IO_ADDR(MCUCSR)), # if (FLASHEND > 131071) - [ ramendhi ] "M"(((RAMEND - 2) >> 8) & 0xff), [ ramendlo ] "M"(((RAMEND - 2) >> 0) & 0xff), [ bootaddrhi ] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 16) & 0xff), + [ramendhi] "M"(((RAMEND - 2) >> 8) & 0xff), [ramendlo] "M"(((RAMEND - 2) >> 0) & 0xff), [bootaddrhi] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 16) & 0xff), # else - [ ramendhi ] "M"(((RAMEND - 1) >> 8) & 0xff), [ ramendlo ] "M"(((RAMEND - 1) >> 0) & 0xff), + [ramendhi] "M"(((RAMEND - 1) >> 8) & 0xff), [ramendlo] "M"(((RAMEND - 1) >> 0) & 0xff), # endif - [ bootaddrme ] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 8) & 0xff), [ bootaddrlo ] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 0) & 0xff)); + [bootaddrme] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 8) & 0xff), [bootaddrlo] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 0) & 0xff)); #else // Assume remaining boards are DFU, even if the flag isn't set -# if !(defined(__AVR_ATmega32A__) || defined(__AVR_ATmega328P__)) // no USB - maybe BOOTLOADER_BOOTLOADHID instead though? +# if !(defined(__AVR_ATmega32A__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATtiny85__)) // no USB - maybe BOOTLOADER_BOOTLOADHID instead though? UDCON = 1; USBCON = (1 << FRZCLK); // disable USB UCSR1B = 0; diff --git a/tmk_core/common/avr/timer.c b/tmk_core/common/avr/timer.c index 88fa1dfa65..c2e6c6e081 100644 --- a/tmk_core/common/avr/timer.c +++ b/tmk_core/common/avr/timer.c @@ -45,19 +45,26 @@ void timer_init(void) { # error "Timer prescaler value is not valid" #endif -#ifndef __AVR_ATmega32A__ +#if defined(__AVR_ATmega32A__) + // Timer0 CTC mode + TCCR0 = _BV(WGM01) | prescaler; + + OCR0 = TIMER_RAW_TOP; + TIMSK = _BV(OCIE0); +#elif defined(__AVR_ATtiny85__) // Timer0 CTC mode TCCR0A = _BV(WGM01); TCCR0B = prescaler; - OCR0A = TIMER_RAW_TOP; - TIMSK0 = _BV(OCIE0A); + OCR0A = TIMER_RAW_TOP; + TIMSK = _BV(OCIE0A); #else // Timer0 CTC mode - TCCR0 = _BV(WGM01) | prescaler; + TCCR0A = _BV(WGM01); + TCCR0B = prescaler; - OCR0 = TIMER_RAW_TOP; - TIMSK = _BV(OCIE0); + OCR0A = TIMER_RAW_TOP; + TIMSK0 = _BV(OCIE0A); #endif } diff --git a/tmk_core/common/progmem.h b/tmk_core/common/progmem.h index be8485117c..39a918fe98 100644 --- a/tmk_core/common/progmem.h +++ b/tmk_core/common/progmem.h @@ -8,7 +8,7 @@ # define pgm_read_byte(address_short) *((uint8_t*)(address_short)) # define pgm_read_word(address_short) *((uint16_t*)(address_short)) # define pgm_read_dword(address_short) *((uint32_t*)(address_short)) -# define pgm_read_ptr(address_short) *((void*)(address_short)) +# define pgm_read_ptr(address_short) *((void**)(address_short)) # define strcmp_P(s1, s2) strcmp(s1, s2) # define strcpy_P(dest, src) strcpy(dest, src) # define strlen_P(src) strlen(src) diff --git a/tmk_core/common/util.c b/tmk_core/common/util.c index f4f018de8d..861cca0054 100644 --- a/tmk_core/common/util.c +++ b/tmk_core/common/util.c @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "util.h" // bit population - return number of on-bit -uint8_t bitpop(uint8_t bits) { +__attribute__((noinline)) uint8_t bitpop(uint8_t bits) { uint8_t c; for (c = 0; bits; c++) bits &= bits - 1; return c; @@ -42,7 +42,7 @@ uint8_t bitpop32(uint32_t bits) { // most significant on-bit - return highest location of on-bit // NOTE: return 0 when bit0 is on or all bits are off -uint8_t biton(uint8_t bits) { +__attribute__((noinline)) uint8_t biton(uint8_t bits) { uint8_t n = 0; if (bits >> 4) { bits >>= 4; @@ -105,7 +105,7 @@ uint8_t biton32(uint32_t bits) { return n; } -uint8_t bitrev(uint8_t bits) { +__attribute__((noinline)) uint8_t bitrev(uint8_t bits) { bits = (bits & 0x0f) << 4 | (bits & 0xf0) >> 4; bits = (bits & 0b00110011) << 2 | (bits & 0b11001100) >> 2; bits = (bits & 0b01010101) << 1 | (bits & 0b10101010) >> 1; diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h index 1b88060f14..82a5f8e05f 100644 --- a/tmk_core/protocol/lufa/lufa.h +++ b/tmk_core/protocol/lufa/lufa.h @@ -69,14 +69,8 @@ extern host_driver_t lufa_driver; # define MIDI_SYSEX_BUFFER (API_SYSEX_MAX_SIZE + API_SYSEX_MAX_SIZE / 7 + (API_SYSEX_MAX_SIZE % 7 ? 1 : 0)) #endif -// #if LUFA_VERSION_INTEGER < 0x120730 -// /* old API 120219 */ -// #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint(epnum, eptype, epdir, epsize, epbank) -// #else -/* new API >= 120730 */ #define ENDPOINT_BANK_SINGLE 1 #define ENDPOINT_BANK_DOUBLE 2 #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint((epdir) | (epnum), eptype, epsize, epbank) -// #endif #endif diff --git a/tmk_core/protocol/vusb/usbconfig.h b/tmk_core/protocol/vusb/usbconfig.h index f3cfd84aba..f156163510 100644 --- a/tmk_core/protocol/vusb/usbconfig.h +++ b/tmk_core/protocol/vusb/usbconfig.h @@ -123,7 +123,7 @@ section at the end of this file). * data from a static buffer, set it to 0 and return the data from * usbFunctionSetup(). This saves a couple of bytes. */ -#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 +#define USB_CFG_IMPLEMENT_FN_WRITEOUT 1 /* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints. * You must implement the function usbFunctionWriteOut() which receives all * interrupt/bulk data sent to any endpoint other than 0. The endpoint number diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index 47dc1245d0..00314ebe83 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c @@ -106,8 +106,6 @@ void raw_hid_send(uint8_t *data, uint8_t length) { usbPoll(); } usbSetInterrupt3(0, 0); - usbPoll(); - _delay_ms(1); } __attribute__((weak)) void raw_hid_receive(uint8_t *data, uint8_t length) { @@ -160,10 +158,12 @@ typedef struct { } __attribute__((packed)) vusb_mouse_report_t; static void send_mouse(report_mouse_t *report) { +#if defined(MOUSE_ENABLE) vusb_mouse_report_t r = {.report_id = REPORT_ID_MOUSE, .report = *report}; if (usbInterruptIsReady3()) { usbSetInterrupt3((void *)&r, sizeof(vusb_mouse_report_t)); } +#endif } #ifdef EXTRAKEY_ENABLE |
