rev6 code fixes

This commit is contained in:
Will Toohey
2017-12-05 13:04:06 +10:00
parent 9ac330aadb
commit 7e5c449955
3 changed files with 15 additions and 12 deletions
+4 -4
View File
@@ -60,11 +60,11 @@ void Application_Jump_Check(void)
if(!(PINC & _BV(1)))
return;
#else
/* New board - enable pullup for MACRO switch on PB6 */
DDRB &= ~_BV(5);
PORTB |= _BV(5);
/* New board - enable pullup for MACRO switch on PB4 */
DDRB &= ~_BV(4);
PORTB |= _BV(4);
_delay_us(500);
if(!(PINB & _BV(5)))
if(!(PINB & _BV(4)))
return;
#endif
/* If power on boot or magic key set */
+6 -3
View File
@@ -2,13 +2,16 @@
#define G 1
#define B 2
#define SK9822_BRIGHTNESS 1
// range 0-31
#define SK9822_BRIGHTNESS 31
static const uint8_t SK9822_map[] = {0, 2, 4, 6, 7, 5, 3, 1};
void led_init(void) {
// SCLK/MOSI PB1/2
DDRB |= _BV(1)|_BV(2);
// SS/SCLK/MOSI PB0/1/2
// We set SS to output so it's not used for SPI things
// If SS = input, it can freeze SPI comms - see "SS Pin functionality"
DDRB |= _BV(0) | _BV(1) | _BV(2);
// SPI enabled, master mode, CLK/4 speed
SPCR = _BV(SPE)|_BV(MSTR);
+5 -5
View File
@@ -15,8 +15,8 @@
// D 4,5,6,7
#define SWITCH_MASKD 0b11110000
#else
// B 0,4,5
#define SWITCH_MASKB 0b00110001
// B 4,5,6
#define SWITCH_MASKB 0b01110000
// C 2
#define SWITCH_MASKC 0b00000100
// D 4,5,6,7
@@ -123,9 +123,9 @@ uint8_t load_switches(void) {
LOAD_SWITCH(tmp, 1, result, 7); // PINC1, MACRO
#else
tmp = PINB;
LOAD_SWITCH(tmp, 4, result, 1); // PINB4, A
LOAD_SWITCH(tmp, 0, result, 5); // PINB0, FX L
LOAD_SWITCH(tmp, 5, result, 7); // PINB5, MACRO
LOAD_SWITCH(tmp, 6, result, 1); // PINB6, A
LOAD_SWITCH(tmp, 5, result, 5); // PINB5, FX L
LOAD_SWITCH(tmp, 4, result, 7); // PINB4, MACRO
tmp = PINC;
LOAD_SWITCH(tmp, 2, result, 0); // PINC2, START
#endif