39#define EMPTY_MODULE(NAME) \
40 static inline void NAME##Init () {} \
41 static inline void NAME##Iterate () {} \
42 static inline void NAME##OnRegRead (uint8_t reg) {} \
43 static inline void NAME##OnRegWrite (uint8_t reg, uint8_t val) {} \
44 static inline void NAME##ISR () {}
68#define brConfigRecord ((const TBrConfigRecord) _brConfigRecord)
78#define RegGet(REG) (_regFile[REG])
80#define RegSet(REG, VAL) do { _regFile[REG] = (VAL); } while (0)
123#if !IS_MAINTENANCE || DOXYGEN
126extern uint8_t chgShadow;
129static inline void ReportChange (uint8_t mask) { chgShadow |= mask; }
149#if WITH_TIMER || DOXYGEN
164static inline uint16_t
TimerNow () {
return 0; }
188#define MINITICKS_OF_US(X) (X * (BR_CPU_FREQ / 1000000) / 8)
194#define MINI_CLOCK_SCALE_1
195#define MINI_CLOCK_SCALE_8
196#define MINI_CLOCK_SCALE_64
197#define MINI_CLOCK_SCALE_256
198#define MINI_CLOCK_SCALE_1024
206#elif MCU_TYPE == BR_MCU_ATTINY85 || MCU_TYPE == BR_MCU_ATTINY84
209#define MINI_CLOCK_SCALE_1 1
210#define MINI_CLOCK_SCALE_8 2
211#define MINI_CLOCK_SCALE_64 3
212#define MINI_CLOCK_SCALE_256 4
213#define MINI_CLOCK_SCALE_1024 5
217 TCCR0B = CLOCK_SCALE;
224#define MinitimerReset() do { TCNT0 = 0; } while (0)
226#define MinitimerNow() ((uint8_t) TCNT0)
229#elif MCU_TYPE == BR_MCU_ATTINY861
232#define MINI_CLOCK_SCALE_1 1
233#define MINI_CLOCK_SCALE_8 4
234#define MINI_CLOCK_SCALE_64 7
235#define MINI_CLOCK_SCALE_256 9
236#define MINI_CLOCK_SCALE_1024 11
240 TCCR1B = (1 << PSR1) | CLOCK_SCALE;
250#define MinitimerReset() do { TCNT1 = 0; TCCR1B |= (1 << PSR1); } while (0)
255#define MinitimerNow() ((uint8_t) TCNT1)
void MinitimerStop()
Stop the minitimer.
static void CoreIterate()
Iterate the module.
const __flash TBrFeatureRecord brFeatureRecord
The Brownie feature recourd.
static void ReportChange(uint8_t mask)
Set (a) bit(s) in the BR_REG_CHANGED register.
void CoreInit()
Initialize the module.
uint16_t TimerNow()
Get current time in ticks.
void ReportChangeAndNotify(uint8_t mask)
Set (a) bit(s) in the BR_REG_CHANGED register and issue a TWI host notification.
struct SBrEeprom brEeprom
Complete EEPROM contents.
void MinitimerReset()
Reset the minitimer.
void CoreOnRegWrite(uint8_t reg, uint8_t val)
Write a register.
uint8_t MinitimerNow()
Get the current minitimer value.
void MinitimerStart(int clockScale)
Start the minitimer (pass any MINI_CLOCK_SCALE_* constants)
void CoreOnRegRead(uint8_t reg)
Update a register when it is read.
char TBrIdRecord[32]
Brownie ID (stored in EEPROM).
#define BR_REGISTERS
Number of registers.
Brownie configuration record (stored in EEPROM).
Structure to describe the complete EEPROM content.
TBrIdRecord id
Brownie ID record
uint8_t shadesPos[2]
(shades) Position
TBrConfigRecord cfg
Brownie config record (persistent EEPROM copy)
Brownie feature record (stored in VROM).