moved the twi library
parent
66a5932fa8
commit
2009c160e4
|
@ -9,5 +9,5 @@
|
||||||
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
#include KEYBOARD
|
#include MAKEFILE_KEYBOARD
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "matrix.h" // for number of rows and columns
|
#include "matrix.h" // for number of rows and columns
|
||||||
|
|
||||||
#include KEYBOARD_LAYOUT // for number of layers
|
#include MAKEFILE_KEYBOARD_LAYOUT // for number of layers
|
||||||
|
|
||||||
extern uint8_t
|
extern uint8_t
|
||||||
kb_layout [KB_LAYERS][KB_ROWS][KB_COLUMNS];
|
kb_layout [KB_LAYERS][KB_ROWS][KB_COLUMNS];
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <util/twi.h>
|
#include <util/twi.h>
|
||||||
|
|
||||||
#include "lib/_data-types.h"
|
#include "lib/_data-types.h"
|
||||||
#include "lib/_teensy-2-0/twi.h" // `TWI_FREQ` defined in "teensy-2-0.c"
|
#include "lib/_twi.h" // `TWI_FREQ` defined in "teensy-2-0.c"
|
||||||
|
|
||||||
#define KEYBOARD_INCLUDE_PRIVATE
|
#define KEYBOARD_INCLUDE_PRIVATE
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "lib/_data-types.h"
|
#include "lib/_data-types.h"
|
||||||
#define TWI_FREQ 400000
|
#define TWI_FREQ 400000
|
||||||
#include "lib/_teensy-2-0/twi.h"
|
#include "lib/_twi.h"
|
||||||
|
|
||||||
#define KEYBOARD_INCLUDE_PRIVATE
|
#define KEYBOARD_INCLUDE_PRIVATE
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* TWI (I2C) : exports
|
||||||
|
*
|
||||||
|
* Code specific to different development boards is used by modifying a
|
||||||
|
* variable in the makefile.
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
* Copyright (c) 2012 Ben Blazak <benblazak.dev@gmail.com>
|
||||||
|
* Released under The MIT License (MIT) (see "license.md")
|
||||||
|
* Project located at <https://github.com/benblazak/ergodox-firmware>
|
||||||
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
#define str(s) #s // stringify
|
||||||
|
#define expstr(s) str(s) // expand -> stringify
|
||||||
|
#define inc expstr(_twi/MAKEFILE_BOARD.h) // inc(lude)
|
||||||
|
#include inc
|
||||||
|
#undef str
|
||||||
|
#undef expstr
|
||||||
|
#undef inc
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
*
|
*
|
||||||
* - This is mostly straight from the datasheet, section 20.6.6, figure 20-11
|
* - This is mostly straight from the datasheet, section 20.6.6, figure 20-11
|
||||||
* (the code example in C), and section 20.8.1, figure 20-12
|
* (the code example in C), and section 20.8.1, figure 20-12
|
||||||
* - Also see the documentation for `<util/twi.h>` at <http://www.nongnu.org/avr-libc/user-manual/group__util__twi.html#ga8d3aca0acc182f459a51797321728168>
|
* - Also see the documentation for `<util/twi.h>` at
|
||||||
|
* <http://www.nongnu.org/avr-libc/user-manual/group__util__twi.html#ga8d3aca0acc182f459a51797321728168>
|
||||||
*
|
*
|
||||||
* Some other (more complete) TWI libraries for the Teensy 2.0 (and other Atmel
|
* Some other (more complete) TWI libraries for the Teensy 2.0 (and other Atmel
|
||||||
* processors):
|
* processors):
|
||||||
|
@ -23,7 +24,7 @@
|
||||||
#include <util/delay.h> //dbg
|
#include <util/delay.h> //dbg
|
||||||
#include <util/twi.h>
|
#include <util/twi.h>
|
||||||
|
|
||||||
#include "twi.h"
|
#include "../_twi.h"
|
||||||
|
|
||||||
|
|
||||||
void twi_init(void) {
|
void twi_init(void) {
|
|
@ -1,4 +1,4 @@
|
||||||
# Documentation : Teensy 2.0 I²C
|
# Documentation : I²C : Teensy 2.0
|
||||||
|
|
||||||
## I²C Status Codes (for Master modes)
|
## I²C Status Codes (for Master modes)
|
||||||
|
|
10
src/makefile
10
src/makefile
|
@ -15,8 +15,9 @@
|
||||||
|
|
||||||
TARGET = firmware
|
TARGET = firmware
|
||||||
FORMAT = ihex
|
FORMAT = ihex
|
||||||
KEYBOARD = ergodox # see "src/keyboard" for what's available
|
BOARD = teensy-2-0 # see the libraries you're using for what's available
|
||||||
LAYOUT = qwerty # see "src/keyboard/*/layout" for what's available
|
KEYBOARD = ergodox # see "src/keyboard" for what's available
|
||||||
|
LAYOUT = qwerty # see "src/keyboard/*/layout" for what's available
|
||||||
|
|
||||||
# firmware stuff
|
# firmware stuff
|
||||||
SRC = $(wildcard *.c)
|
SRC = $(wildcard *.c)
|
||||||
|
@ -46,8 +47,9 @@ CFLAGS += -DF_CPU=16000000 # processor frequency; must match initialization
|
||||||
# in source
|
# in source
|
||||||
CFLAGS += -I. # search for includes in the current directory
|
CFLAGS += -I. # search for includes in the current directory
|
||||||
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||||
CFLAGS += -DKEYBOARD='"keyboard/$(strip $(KEYBOARD)).h"'
|
CFLAGS += -DMAKEFILE_BOARD='$(strip $(BOARD))'
|
||||||
CFLAGS += -DKEYBOARD_LAYOUT='"layout/$(strip $(LAYOUT)).h"'
|
CFLAGS += -DMAKEFILE_KEYBOARD='"keyboard/$(strip $(KEYBOARD)).h"'
|
||||||
|
CFLAGS += -DMAKEFILE_KEYBOARD_LAYOUT='"layout/$(strip $(LAYOUT)).h"'
|
||||||
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||||
CFLAGS += -std=gnu99 # use C99 plus GCC extensions
|
CFLAGS += -std=gnu99 # use C99 plus GCC extensions
|
||||||
CFLAGS += -Os # optimize for size
|
CFLAGS += -Os # optimize for size
|
||||||
|
|
Loading…
Reference in New Issue