From 086aaabd39d3c6736ace56f2badac06b75567651 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 18 Aug 2017 23:31:11 -0600 Subject: First RoundTable example actually works (simple momentary 1-mode UI). Changed how tk-attiny.h detects whether a layout was defined. Changed how tk-attiny.h detects number of PWM channels for new-style layouts. Added no-underscore versions of delay functions. Lots of RoundTable refactoring and blank-filling. --- tk-attiny.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'tk-attiny.h') diff --git a/tk-attiny.h b/tk-attiny.h index ebd997f..22b73f9 100644 --- a/tk-attiny.h +++ b/tk-attiny.h @@ -55,8 +55,11 @@ #endif +#include + /******************** I/O pin and register layout ************************/ #ifdef FET_7135_LAYOUT +#define LAYOUT_DEFINED /* * ---- * Reset -|1 8|- VCC @@ -92,6 +95,7 @@ #endif // FET_7135_LAYOUT #ifdef TRIPLEDOWN_LAYOUT +#define LAYOUT_DEFINED /* * ---- * Reset -|1 8|- VCC @@ -128,6 +132,7 @@ #endif // TRIPLEDOWN_LAYOUT #ifdef FERRERO_ROCHER_LAYOUT +#define LAYOUT_DEFINED /* * ---- * Reset -|1 8|- VCC @@ -142,6 +147,7 @@ #endif // FERRERO_ROCHER_LAYOUT #ifdef NANJG_LAYOUT +#define LAYOUT_DEFINED #define STAR2_PIN PB0 #define STAR3_PIN PB4 #define STAR4_PIN PB3 @@ -160,6 +166,7 @@ #ifdef RT_EMISAR_D4_LAYOUT +#define LAYOUT_DEFINED /* * ---- * Reset -|1 8|- VCC @@ -169,9 +176,12 @@ * ---- */ +#define PWM_CHANNELS 2 + #define AUXLED_PIN PB4 // pin 3 -#define SWITCH_PIN PB3 // pin 2, OTC +#define SWITCH_PIN PB3 // pin 2 +#define SWITCH_PCINT PCINT3 // pin 2 pin change interrupt #define CAP_CHANNEL 0x03 // MUX 03 corresponds with PB3 (Star 4) #define CAP_DIDR ADC3D // Digital input disable bit corresponding with PB3 @@ -195,6 +205,7 @@ #ifdef RT_TKSABER_LAYOUT +#define LAYOUT_DEFINED /* * ---- * Reset -|1 8|- VCC @@ -204,6 +215,7 @@ * ---- */ +#define PWM_CHANNELS 4 #define PWM1_PIN PB0 // pin 5 #define PWM1_LVL OCR0A #define PWM2_PIN PB1 // pin 6 @@ -214,6 +226,7 @@ #define PWM4_LVL OCR1A // FIXME: does this work? #define SWITCH_PIN PB2 // pin 7 +#define SWITCH_PCINT PCINT2 // pin 7 pin change interrupt #define ADC_PRSCL 0x07 // clk/128 (no need to be super fast) // FIXME: What is the DIDR for pin 8? @@ -225,7 +238,7 @@ #endif // TKSABER_LAYOUT -#ifndef PWM_LVL +#ifndef LAYOUT_DEFINED Hey, you need to define an I/O pin layout. #endif -- cgit v1.2.3