add initial support for left leds on an ergodox ez
This commit is contained in:
parent
b45b223389
commit
bcfba27101
2 changed files with 63 additions and 0 deletions
|
@ -61,11 +61,46 @@ void ergodox_blink_all_leds(void)
|
|||
_delay_ms(50);
|
||||
ergodox_right_led_3_on();
|
||||
_delay_ms(50);
|
||||
#ifdef LEFT_LEDS
|
||||
ergodox_left_led_1_on();
|
||||
_delay_ms(50);
|
||||
if (!mcp23018_status) {
|
||||
mcp23018_status = ergodox_left_leds_update();
|
||||
}
|
||||
ergodox_left_led_2_on();
|
||||
_delay_ms(50);
|
||||
if (!mcp23018_status) {
|
||||
mcp23018_status = ergodox_left_leds_update();
|
||||
}
|
||||
ergodox_left_led_3_on();
|
||||
_delay_ms(50);
|
||||
if (!mcp23018_status) {
|
||||
mcp23018_status = ergodox_left_leds_update();
|
||||
}
|
||||
#endif
|
||||
ergodox_right_led_1_off();
|
||||
_delay_ms(50);
|
||||
ergodox_right_led_2_off();
|
||||
_delay_ms(50);
|
||||
ergodox_right_led_3_off();
|
||||
#ifdef LEFT_LEDS
|
||||
_delay_ms(50);
|
||||
ergodox_left_led_1_off();
|
||||
if (!mcp23018_status) {
|
||||
mcp23018_status = ergodox_left_leds_update();
|
||||
}
|
||||
_delay_ms(50);
|
||||
ergodox_left_led_2_off();
|
||||
if (!mcp23018_status) {
|
||||
mcp23018_status = ergodox_left_leds_update();
|
||||
}
|
||||
_delay_ms(50);
|
||||
ergodox_left_led_3_off();
|
||||
if (!mcp23018_status) {
|
||||
mcp23018_status = ergodox_left_leds_update();
|
||||
}
|
||||
#endif
|
||||
|
||||
//ergodox_led_all_on();
|
||||
//_delay_ms(333);
|
||||
ergodox_led_all_off();
|
||||
|
@ -107,6 +142,10 @@ uint8_t init_mcp23018(void) {
|
|||
out:
|
||||
i2c_stop();
|
||||
|
||||
#ifdef LEFT_LEDS
|
||||
if (!mcp23018_status) mcp23018_status = ergodox_left_leds_update();
|
||||
#endif // LEFT_LEDS
|
||||
|
||||
// SREG=sreg_prev;
|
||||
|
||||
return mcp23018_status;
|
||||
|
|
|
@ -46,12 +46,31 @@ inline void ergodox_right_led_2_off(void) { DDRB &= ~(1<<6); PORTB &= ~(1<<6);
|
|||
inline void ergodox_right_led_3_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); }
|
||||
inline void ergodox_right_led_off(uint8_t led) { DDRB &= ~(1<<(led+4)); PORTB &= ~(1<<(led+4)); }
|
||||
|
||||
#ifdef LEFT_LEDS
|
||||
bool ergodox_left_led_1;
|
||||
bool ergodox_left_led_2;
|
||||
bool ergodox_left_led_3;
|
||||
|
||||
inline void ergodox_left_led_1_on(void) { ergodox_left_led_1 = 1; }
|
||||
inline void ergodox_left_led_2_on(void) { ergodox_left_led_2 = 1; }
|
||||
inline void ergodox_left_led_3_on(void) { ergodox_left_led_3 = 1; }
|
||||
|
||||
inline void ergodox_left_led_1_off(void) { ergodox_left_led_1 = 0; }
|
||||
inline void ergodox_left_led_2_off(void) { ergodox_left_led_2 = 0; }
|
||||
inline void ergodox_left_led_3_off(void) { ergodox_left_led_3 = 0; }
|
||||
#endif // LEFT_LEDS
|
||||
|
||||
inline void ergodox_led_all_on(void)
|
||||
{
|
||||
ergodox_board_led_on();
|
||||
ergodox_right_led_1_on();
|
||||
ergodox_right_led_2_on();
|
||||
ergodox_right_led_3_on();
|
||||
#ifdef LEFT_LEDS
|
||||
ergodox_left_led_1_on();
|
||||
ergodox_left_led_2_on();
|
||||
ergodox_left_led_3_on();
|
||||
#endif // LEFT_LEDS
|
||||
}
|
||||
|
||||
inline void ergodox_led_all_off(void)
|
||||
|
@ -60,6 +79,11 @@ inline void ergodox_led_all_off(void)
|
|||
ergodox_right_led_1_off();
|
||||
ergodox_right_led_2_off();
|
||||
ergodox_right_led_3_off();
|
||||
#ifdef LEFT_LEDS
|
||||
ergodox_left_led_1_off();
|
||||
ergodox_left_led_2_off();
|
||||
ergodox_left_led_3_off();
|
||||
#endif // LEFT_LEDS
|
||||
}
|
||||
|
||||
inline void ergodox_right_led_1_set(uint8_t n) { OCR1A = n; }
|
||||
|
|
Loading…
Reference in a new issue