X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=protocol%2Fps2.h;h=acde679cf42352fc4c7750bfdbf33ae77c5b19d0;hb=1f96edaed60def1f513ddd8adcdfa3e12b971006;hp=b780d01a29079029f9085c532346042d7e5be54a;hpb=9ae9742ac59b18cf989370f53d669daeb75bd7a3;p=tmk_firmware.git diff --git a/protocol/ps2.h b/protocol/ps2.h index b780d01..acde679 100644 --- a/protocol/ps2.h +++ b/protocol/ps2.h @@ -39,8 +39,9 @@ POSSIBILITY OF SUCH DAMAGE. #define PS2_H #include -#include -#include +#include "wait.h" +#include "ps2_io.h" +#include "print.h" /* * Primitive PS/2 Library for AVR @@ -70,11 +71,13 @@ POSSIBILITY OF SUCH DAMAGE. #define PS2_RESEND 0xFE #define PS2_SET_LED 0xED +// TODO: error numbers #define PS2_ERR_NONE 0 #define PS2_ERR_STARTBIT1 1 #define PS2_ERR_STARTBIT2 2 #define PS2_ERR_STARTBIT3 3 #define PS2_ERR_PARITY 0x10 +#define PS2_ERR_NODATA 0x20 #define PS2_LED_SCROLL_LOCK 0 #define PS2_LED_NUM_LOCK 1 @@ -90,79 +93,27 @@ uint8_t ps2_host_recv(void); void ps2_host_set_led(uint8_t usb_led); -/* Check port settings for clock and data line */ -#if !(defined(PS2_CLOCK_PORT) && \ - defined(PS2_CLOCK_PIN) && \ - defined(PS2_CLOCK_DDR) && \ - defined(PS2_CLOCK_BIT)) -# error "PS/2 clock port setting is required in config.h" -#endif - -#if !(defined(PS2_DATA_PORT) && \ - defined(PS2_DATA_PIN) && \ - defined(PS2_DATA_DDR) && \ - defined(PS2_DATA_BIT)) -# error "PS/2 data port setting is required in config.h" -#endif - /*-------------------------------------------------------------------- * static functions *------------------------------------------------------------------*/ -static inline void clock_lo(void) -{ - PS2_CLOCK_PORT &= ~(1<