2012-03-19 08:01:41 +01:00
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* ergoDOX controller: Teensy 2.0 specific exports
|
|
|
|
* ----------------------------------------------------------------------------
|
2012-03-22 00:51:42 +01:00
|
|
|
* 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>
|
2012-03-19 08:01:41 +01:00
|
|
|
* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
2012-03-22 00:51:42 +01:00
|
|
|
#ifndef TEENSY_2_0_h
|
|
|
|
#define TEENSY_2_0_h
|
2012-03-19 08:01:41 +01:00
|
|
|
|
2012-03-22 00:51:42 +01:00
|
|
|
#include <avr/io.h> // for the register macros
|
2012-04-29 08:40:00 +02:00
|
|
|
#include "lib/data-types.h"
|
2012-04-05 12:08:20 +02:00
|
|
|
|
2012-04-10 10:44:27 +02:00
|
|
|
#include "matrix.h"
|
|
|
|
|
2012-06-01 09:50:45 +02:00
|
|
|
|
2012-03-22 00:51:42 +01:00
|
|
|
// LED control
|
2012-06-01 09:50:45 +02:00
|
|
|
#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))
|
2012-05-27 07:50:33 +02:00
|
|
|
//
|
2012-06-01 09:50:45 +02:00
|
|
|
#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))
|
2012-05-27 07:50:33 +02:00
|
|
|
//
|
2012-06-01 09:50:45 +02:00
|
|
|
#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)
|
2012-03-19 08:01:41 +01:00
|
|
|
|
|
|
|
|
2012-04-10 10:44:27 +02:00
|
|
|
#ifdef KEYBOARD_INCLUDE_PRIVATE
|
2012-03-27 12:06:52 +02:00
|
|
|
|
|
|
|
uint8_t teensy_init(void);
|
2012-04-06 09:19:57 +02:00
|
|
|
uint8_t teensy_update_matrix(
|
2012-04-10 10:44:27 +02:00
|
|
|
bool matrix[KB_ROWS][KB_COLUMNS] );
|
2012-03-19 08:01:41 +01:00
|
|
|
|
2012-03-27 12:06:52 +02:00
|
|
|
#endif
|
2012-03-19 08:01:41 +01:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|