Home2L - C/C++ API  v1.2-2-ga4fe (2023-04-15)
Smart Tools for a Private Home
Classes | Macros
core.h File Reference

Description

This file contains core functionality of the Brownie firmware.

Definition in file core.h.

#include "configure.h"
Include dependency graph for core.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SBrEeprom
 Structure to describe the complete EEPROM content. More...
 

Macros

#define EMPTY_MODULE(NAME)
 Helper to declare an empty / deactivated module (see Microcontroller: API).
 

Functions

Timer ...
uint16_t TimerNow ()
 Get current time in ticks. More...
 
Interface Functions of the "core" Module ...

The feature modules (e.g. gpio.[hc], shades.[hc]) have a common set of interface functions. The following functions are the interface for the pseudo-module "core", which implements some core functionality.

If you are developing a feature module: Never call these functions directly. They are only documented here in order to document the general module interface functions.

void CoreInit ()
 Initialize the module. More...
 
static void CoreIterate ()
 Iterate the module. More...
 
void CoreOnRegRead (uint8_t reg)
 Update a register when it is read. More...
 
void CoreOnRegWrite (uint8_t reg, uint8_t val)
 Write a register. More...
 

Variables

Persistent Storage (EEPROM) ...
struct SBrEeprom brEeprom
 Complete EEPROM contents.
 

Memory and Registers ...

#define brConfigRecord   ((const TBrConfigRecord) _brConfigRecord)
 The Brownie config recourd.
 
#define RegGet(REG)   (_regFile[REG])
 Get a register value.
 
#define RegSet(REG, VAL)   do { _regFile[REG] = (VAL); } while (0)
 Set a register to a new value.
 
const __flash TBrFeatureRecord brFeatureRecord
 The Brownie feature recourd.
 

Mini-Timer ...

8-bit counter with a cycle time of 8µs to be used locally in modules. Presently, the mini-timer is used by the ISRs of the UART and the 'temperature' modules. Minitimers must be used with interrupts disabled.

Note: MinitimerReset() and MinitimerNow() are implemented as macros to ensure that they are inlined. Otherwise, ISRs may get a very long prologue saving many registers. This causes problems in 'TemperatureISR()' on the ATtiny861.

#define MINITICKS_OF_US(X)   (X * (BR_CPU_FREQ / 1000000) / 8)
 Number of 8-bit timer ticks of a microsecond value for a clock selection of clk_io/8.
 
#define MINI_CLOCK_SCALE_1
 Minitimer clock period of 1/BR_CPU_FREQ.
 
#define MINI_CLOCK_SCALE_8
 Minitimer clock period of 8 * 1/BR_CPU_FREQ.
 
#define MINI_CLOCK_SCALE_64
 Minitimer clock period of 64 * 1/BR_CPU_FREQ.
 
#define MINI_CLOCK_SCALE_256
 Minitimer clock period of 256 * 1/BR_CPU_FREQ.
 
#define MINI_CLOCK_SCALE_1024
 Minitimer clock period of 1024 * 1/BR_CPU_FREQ.
 
void MinitimerStart (int clockScale)
 Start the minitimer (pass any MINI_CLOCK_SCALE_* constants)
 
void MinitimerStop ()
 Stop the minitimer.
 
void MinitimerReset ()
 Reset the minitimer.
 
uint8_t MinitimerNow ()
 Get the current minitimer value.
 

Change Reporting ...

uint8_t chgShadow
 
static void ReportChange (uint8_t mask)
 Set (a) bit(s) in the BR_REG_CHANGED register.
 
void ReportChangeAndNotify (uint8_t mask)
 Set (a) bit(s) in the BR_REG_CHANGED register and issue a TWI host notification.