keyboard: dynamically derive UBRR values from BAUDRATE
This commit is contained in:
parent
9bed136cd5
commit
7479c9ed3f
@ -12,7 +12,6 @@
|
|||||||
#define DELAY_ROW_SWITCH() _delay_ms(1) //_delay_us(1)
|
#define DELAY_ROW_SWITCH() _delay_ms(1) //_delay_us(1)
|
||||||
|
|
||||||
#define BAUDRATE 9600
|
#define BAUDRATE 9600
|
||||||
#define UBRR 51 // (F_CPU / BAUDRATE) / 32
|
|
||||||
|
|
||||||
/* Keycode from include/linux/input.h */
|
/* Keycode from include/linux/input.h */
|
||||||
#define KEY_RESERVED 0
|
#define KEY_RESERVED 0
|
||||||
@ -259,8 +258,8 @@ int main()
|
|||||||
MATRIX_Y1(PORT) &= ~MASK_Y1; /* Pull row low when selected */
|
MATRIX_Y1(PORT) &= ~MASK_Y1; /* Pull row low when selected */
|
||||||
MATRIX_Y2(PORT) &= ~MASK_Y2; /* Pull row low when selected */
|
MATRIX_Y2(PORT) &= ~MASK_Y2; /* Pull row low when selected */
|
||||||
UCSRB = (1 << TXEN);
|
UCSRB = (1 << TXEN);
|
||||||
UBRRH = (UBRR >> 8) & 0xFF;
|
UBRRH = ((((F_CPU / BAUDRATE) / 16) - 1) >> 8);
|
||||||
UBRRL = UBRR & 0xFF;
|
UBRRL = (((F_CPU / BAUDRATE) / 16) - 1);
|
||||||
|
|
||||||
fn_active = 0;
|
fn_active = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user