made LED_BRIGHTNESS a makefile option

partial-rewrite
Ben Blazak 2012-10-12 10:29:50 -07:00
parent f7bff8184b
commit 467886299b
3 changed files with 15 additions and 13 deletions

View File

@ -17,28 +17,28 @@
*/ */
#ifndef kb_led_state_power_on #ifndef kb_led_state_power_on
#define kb_led_state_power_on() do { \ #define kb_led_state_power_on() do { \
_kb_led_all_set_percent(0.05); \ _kb_led_all_set_percent(MAKEFILE_LED_BRIGHTNESS/10); \
_kb_led_all_on(); \ _kb_led_all_on(); \
} while(0) } while(0)
#endif #endif
// note: need to delay for a total of ~1 second // note: need to delay for a total of ~1 second
#ifndef kb_led_delay_usb_init #ifndef kb_led_delay_usb_init
#define kb_led_delay_usb_init() do { \ #define kb_led_delay_usb_init() do { \
_kb_led_1_set_percent(0.5); \ _kb_led_1_set_percent(MAKEFILE_LED_BRIGHTNESS); \
_delay_ms(333); \ _delay_ms(333); \
_kb_led_2_set_percent(0.5); \ _kb_led_2_set_percent(MAKEFILE_LED_BRIGHTNESS); \
_delay_ms(333); \ _delay_ms(333); \
_kb_led_3_set_percent(0.5); \ _kb_led_3_set_percent(MAKEFILE_LED_BRIGHTNESS); \
_delay_ms(333); \ _delay_ms(333); \
} while(0) } while(0)
#endif #endif
#ifndef kb_led_state_ready #ifndef kb_led_state_ready
#define kb_led_state_ready() do { \ #define kb_led_state_ready() do { \
_kb_led_all_off(); \ _kb_led_all_off(); \
_kb_led_all_set_percent(0.5); \ _kb_led_all_set_percent(MAKEFILE_LED_BRIGHTNESS); \
} while(0) } while(0)
#endif #endif

View File

@ -58,6 +58,7 @@ CFLAGS += -DMAKEFILE_BOARD='$(strip $(BOARD))'
CFLAGS += -DMAKEFILE_KEYBOARD='$(strip $(KEYBOARD))' CFLAGS += -DMAKEFILE_KEYBOARD='$(strip $(KEYBOARD))'
CFLAGS += -DMAKEFILE_KEYBOARD_LAYOUT='$(strip $(LAYOUT))' CFLAGS += -DMAKEFILE_KEYBOARD_LAYOUT='$(strip $(LAYOUT))'
CFLAGS += -DMAKEFILE_DEBOUNCE_TIME='$(strip $(DEBOUNCE_TIME))' CFLAGS += -DMAKEFILE_DEBOUNCE_TIME='$(strip $(DEBOUNCE_TIME))'
CFLAGS += -DMAKEFILE_LED_BRIGHTNESS='$(strip $(LED_BRIGHTNESS))'
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CFLAGS += -std=gnu99 # use C99 plus GCC extensions CFLAGS += -std=gnu99 # use C99 plus GCC extensions
CFLAGS += -Os # optimize for size CFLAGS += -Os # optimize for size

View File

@ -12,6 +12,7 @@ KEYBOARD := ergodox # keyboard model; see "src/keyboard" for what's available
LAYOUT := qwerty # keyboard layout; see "src/keyboard/*/layout" for what's LAYOUT := qwerty # keyboard layout; see "src/keyboard/*/layout" for what's
# available # available
LED_BRIGHTNESS := 0.5 # a multiplier, with 1 being the max
DEBOUNCE_TIME := 5 # in ms; see keyswitch spec for necessary value; 5ms should DEBOUNCE_TIME := 5 # in ms; see keyswitch spec for necessary value; 5ms should
# be good for cherry mx switches # be good for cherry mx switches