- added high-level (logical) led macros, so that the top level firmware doens't need to know what numbers leds are (or how many there are) - left low-level (processor specific) led macros in keyboard/.../teensy-2-0.h , where they were - put non processor|layout specific led macros in keyboard/.../led.h - put layout specific led macros into keyboard/.../layout/*.h (with default empty macro definitions in keyboard/.../layout.h) also - cleaned up some typos and such - moved the debounce time macro to 'keyboard/ergodox.h', since it's technically keyboard (keyswitch) specific aggregate changes for PCB update - documentation updated to reflect that the columns are now the driving pins, and the columns are the read pins. both are still treated as open drain. - macros for led pins 1 and 2 were swapped - update functions now cycle through columns->low, read rows - added a matrix macro to map from how we want the key layouts represented, to how things are scanned into the matrix
67 lines
1.9 KiB
C
67 lines
1.9 KiB
C
/* ----------------------------------------------------------------------------
|
|
* ergoDOX controller: Teensy 2.0 specific exports
|
|
* ----------------------------------------------------------------------------
|
|
* 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>
|
|
* ------------------------------------------------------------------------- */
|
|
|
|
|
|
#ifndef TEENSY_2_0_h
|
|
#define TEENSY_2_0_h
|
|
|
|
#include <avr/io.h> // for the register macros
|
|
#include "lib/data-types.h"
|
|
|
|
#include "matrix.h"
|
|
|
|
|
|
// LED control
|
|
#define _led_1_on() (DDRB |= (1<<6))
|
|
#define _led_1_off() (DDRB &= ~(1<<6))
|
|
#define _led_1_set(n) (OCR1B = (uint8_t)(n))
|
|
#define _led_1_set_percent(n) (OCR1B = (uint8_t)((n) * 0xFF))
|
|
//
|
|
#define _led_2_on() (DDRB |= (1<<5))
|
|
#define _led_2_off() (DDRB &= ~(1<<5))
|
|
#define _led_2_set(n) (OCR1A = (uint8_t)(n))
|
|
#define _led_2_set_percent(n) (OCR1A = (uint8_t)((n) * 0xFF))
|
|
//
|
|
#define _led_3_on() (DDRB |= (1<<7))
|
|
#define _led_3_off() (DDRB &= ~(1<<7))
|
|
#define _led_3_set(n) (OCR1C = (uint8_t)(n))
|
|
#define _led_3_set_percent(n) (OCR1C = (uint8_t)((n) * 0xFF))
|
|
// ---
|
|
#define _led_all_on() do { \
|
|
_led_1_on(); \
|
|
_led_2_on(); \
|
|
_led_3_on(); \
|
|
} while(0)
|
|
#define _led_all_off() do { \
|
|
_led_1_off(); \
|
|
_led_2_off(); \
|
|
_led_3_off(); \
|
|
} while(0)
|
|
#define _led_all_set(n) do { \
|
|
_led_1_set(n); \
|
|
_led_2_set(n); \
|
|
_led_3_set(n); \
|
|
} while(0)
|
|
#define _led_all_set_percent(n) do { \
|
|
_led_1_set_percent(n); \
|
|
_led_2_set_percent(n); \
|
|
_led_3_set_percent(n); \
|
|
} while(0)
|
|
|
|
|
|
#ifdef KEYBOARD_INCLUDE_PRIVATE
|
|
|
|
uint8_t teensy_init(void);
|
|
uint8_t teensy_update_matrix(
|
|
bool matrix[KB_ROWS][KB_COLUMNS] );
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|