master
Stefan Dorn 2016-08-22 16:28:10 +01:00
parent 6e94b69be4
commit 24891b6108
3 changed files with 453 additions and 457 deletions

File diff suppressed because it is too large Load Diff

View File

@ -52,41 +52,41 @@
// -------------------------------------------------------------------- // --------------------------------------------------------------------
uint8_t kb_init(void); u8 kb_init(void);
uint8_t kb_update_matrix(bool matrix[KB_ROWS][KB_COLUMNS]); u8 kb_update_matrix(bool matrix[KB_ROWS][KB_COLUMNS]);
// -------------------------------------------------------------------- // --------------------------------------------------------------------
#define MCP23018_TWI_ADDRESS 0b0100000 #define MCP23018_TWI_ADDRESS 0b0100000
uint8_t mcp23018_init(void); u8 mcp23018_init(void);
uint8_t mcp23018_update_matrix( bool matrix[KB_ROWS][KB_COLUMNS] ); u8 mcp23018_update_matrix( bool matrix[KB_ROWS][KB_COLUMNS] );
// -------------------------------------------------------------------- // --------------------------------------------------------------------
uint8_t teensy_init(void); u8 teensy_init(void);
uint8_t teensy_update_matrix( bool matrix[KB_ROWS][KB_COLUMNS] ); u8 teensy_update_matrix( bool matrix[KB_ROWS][KB_COLUMNS] );
// -------------------------------------------------------------------- // --------------------------------------------------------------------
#define TWI_FREQ 400000 #define TWI_FREQ 400000
void twi_init (void); void twi_init (void);
uint8_t twi_start (void); u8 twi_start (void);
void twi_stop (void); void twi_stop (void);
uint8_t twi_send (uint8_t data); u8 twi_send (u8 data);
uint8_t twi_read (uint8_t * data); u8 twi_read (u8 * data);
// -------------------------------------------------------------------- // --------------------------------------------------------------------
void usb_init(void); // initialize everything void usb_init(void); // initialize everything
uint8_t usb_configured(void); // is the USB port configured u8 usb_configured(void); // is the USB port configured
int8_t usb_keyboard_send(void); i8 usb_keyboard_send(void);
extern uint8_t keyboard_modifier_keys; extern u8 keyboard_modifier_keys;
extern uint8_t keyboard_keys[6]; extern u8 keyboard_keys[6];
extern uint16_t consumer_key; extern u16 consumer_key;
// Everything below this point is only intended for usb_serial.c // Everything below this point is only intended for usb_serial.c
@ -101,10 +101,10 @@ extern uint16_t consumer_key;
#define EP_SINGLE_BUFFER 0x02 #define EP_SINGLE_BUFFER 0x02
#define EP_DOUBLE_BUFFER 0x06 #define EP_DOUBLE_BUFFER 0x06
#define EP_SIZE(s) ((s) == 64 ? 0x30 : \ #define EP_SIZE(s) ((s) == 64 ? 0x30 : \
((s) == 32 ? 0x20 : \ ((s) == 32 ? 0x20 : \
((s) == 16 ? 0x10 : \ ((s) == 16 ? 0x10 : \
0x00))) 0x00)))
#define MAX_ENDPOINT 4 #define MAX_ENDPOINT 4
@ -142,12 +142,12 @@ extern uint16_t consumer_key;
// debug // debug
// ----------------------------------------------------------------- // -----------------------------------------------------------------
extern volatile uint8_t debug_flush_timer; extern volatile u8 debug_flush_timer;
void usb_debug_free_memory(void); void usb_debug_free_memory(void);
void usb_debug_print(const char *s); void usb_debug_print(const char *s);
void usb_debug_printf(const char *fmt, ...); void usb_debug_printf(const char *fmt, ...);
int8_t usb_debug_putchar(char c); i8 usb_debug_putchar(char c);
void usb_debug_flush_output(void); void usb_debug_flush_output(void);
#ifdef KBD_DEBUG #ifdef KBD_DEBUG

View File

@ -6,26 +6,16 @@
* Project located at <https://github.com/benblazak/ergodox-firmware> * Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
// --------------------------------------------------------------------
// hardware
// --------------------------------------------------------------------
// comment out this define to disable the debug interface completely
// however, just not using the functions gets rid of most of the firmware bloat already
#define KBD_DEBUG
#include "./keyboard/controller.c"
#include "./keyboard/keyboard.h"
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// types and forward declarations // types and forward declarations
// -------------------------------------------------------------------- // --------------------------------------------------------------------
typedef int8_t i8; typedef int8_t i8;
typedef uint8_t u8; typedef uint8_t u8;
typedef int16_t i16;
typedef uint16_t u16; typedef uint16_t u16;
typedef uint32_t u32; typedef uint32_t u32;
@ -38,6 +28,16 @@ typedef void (*keyfunc)(keycode, bool);
#include "./main.h" #include "./main.h"
// --------------------------------------------------------------------
// hardware
// --------------------------------------------------------------------
// comment out this define to disable the debug interface completely
// however, just not using the functions gets rid of most of the firmware bloat already
#define KBD_DEBUG
#include "./keyboard/controller.c"
#include "./keyboard/keyboard.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// layout data // layout data
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------