From 827bcdb38627e5ff7d1809fb9ea9ef4bb5ccf386 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Wed, 30 Dec 2020 21:04:37 +0100 Subject: [PATCH] Added buffering to output --- include/keyboard.h | 4 ++++ src/main.c | 39 +++++++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/include/keyboard.h b/include/keyboard.h index b63841c..2322987 100644 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -3,6 +3,10 @@ #include +// SCHEMATIC +// #define KEYBOARD_CLK 2 +// #define KEYBOARD_DATA 3 + #define KEYBOARD_CLK 2 #define KEYBOARD_DATA 7 diff --git a/src/main.c b/src/main.c index c76ff59..0466743 100644 --- a/src/main.c +++ b/src/main.c @@ -5,9 +5,18 @@ #include "scancode.h" #include "keyboard.h" +#include "fifo.h" +// SCHEMATIC +/* #define CLK 4 */ +/* #define DATA 5 */ +/* #define RDY 6 */ +/* #define WAIT 7 */ + +#define RDY 3 #define CLK 4 #define DATA 5 +#define WAIT 6 // Clock the value to 74164 void write_value(uint8_t value) { @@ -16,24 +25,34 @@ void write_value(uint8_t value) { PORTD |= (1<>WAIT & 1)) { + // We currently need this to make sure that RDY gets set + // However that is possibly because of the button + // And might not be a problem on actual hardware + _delay_ms(1); + write_value(FIFO_pop(&buffer)); + } } }