Home2L - C/C++ API  v1.2-2-ga4fe (2023-04-15)
Smart Tools for a Private Home
Microcontroller: Feature Selection

Description

Microcontroller firmware feature options.

This module documents all changeable feature settings for Brownie firmwares. New customized firmwares can be added to the Brownie family by changing the file brownies/avr/Family.mk.

Collaboration diagram for Microcontroller: Feature Selection:

General ...

#define IS_MAINTENANCE   0
 This firmware is a maintenance system?
 
#define TWI_SL_NOTIFY   (!IS_MAINTENANCE)
 Device may perform notifications via its slave interface? More...
 
#define TWI_SL_NOTIFY_US   10000.0
 Duration of a notification in microseconds. More...
 

Timer ...

#define WITH_TIMER   0
 The timer is enabled if this is 1 or any other feature requires the timer.
 

GPIO ...

#define GPIO_IN_PRESENCE   0
 Pins to be used as general-purpose inputs.
 
#define GPIO_IN_PULLUP   0
 Inputs with activated internal pullups.
 
#define GPIO_OUT_PRESENCE   0
 Pins to be used as general-purpose outputs.
 
#define GPIO_OUT_PRESET   0
 Output default state (will be set before Z-state is left)
 

TWI Master / Hub ...

Note: Presently, only a single TWI master is supported, which then acts as hub, i.e. all requests/replies to other nodes of the same subnet are forwarded via the master port currently set (#0 at present). In the future, this may change: There may be multiple master ports, and master ports may be used independently of the hub functionality - for example, to work with i2c devices locally.

#define WITH_TWIHUB   0
 Enable TWI hub functionality over master port #0.
 
#define TWIHUB_PORT   0
 TWI master port to use for the hub (must be 0 presently).
 
#define TWI_MA_PORTS   (WITH_TWIHUB ? 1 : 0)
 Number of TWI master ports.
 
#define TWI_MA_INTERNAL_PULLUP   0
 Activate internal pullups for the master SCL/SDA lines (DEPRECATED).
 

Matrix ...

The diode switch matrix uses the pins avaliable as GPIO for the MCU, which may then not be used as GPIOs.

If MATRIX_ROWS > 1, the last MATRIX_ROWS ports are the stimulation ports. The MATRIX_COLS ports before those (or the last ports at all, if no stimulating ports exist) are the sensing ports.

In the special case of MATRIX_ROWS == 1, no stimulation ports are assigned, and no active stimulation is performed by the software module. In the circuitry, the row lines of the switches should be connected to VCC (i.e. constantly be pulled high via some resistor) instead of a stimulation port.

#define MATRIX_ROWS   0
 Number of stimulating lines (rows) (max. 8).
 
#define MATRIX_COLS   0
 Number of sensing lines (columns) (max. 8).
 
#define MATRIX_ROWS_GSHIFT   GPIO_PINS_MAX
 
#define MATRIX_COLS_GSHIFT   (MATRIX_ROWS_GSHIFT - MATRIX_COLS)
 Index of the first GPIO pin to be assigned to column lines. More...
 
#define MATRIX_T_SAMPLE   4
 Time (ticks) a row is driven to 1 to sample.
 
#define MATRIX_T_PERIOD   16
 Time (ticks) before switching to the next row.
 
#define MATRIX_BUFSIZE   8
 Event buffer size.
 

ADCs ...

#define ADC_PORTS   0
 Number of ADC input ports (max. 2)
 
#define ADC_PERIOD   1024
 Sample period in ticks (max. 32767) More...
 
#define P_ADC_0_STROBE   0
 Pin to output a strobe signal before each sampling (0 = no strobe) More...
 
#define ADC_0_STROBE_VALUE   1
 Strobe value (the other times, the pin drives the opposite value)
 
#define ADC_0_STROBE_TICKS   0
 Duration of a strobe if ADC_STROBE_PIN != 0.
 
#define P_ADC_1_STROBE   0
 
#define ADC_1_STROBE_VALUE   1
 
#define ADC_1_STROBE_TICKS   0
 

UART ...

#define WITH_UART   0
 Enable UART.
 
#define UART_WITH_DRIVE   1
 Enable "driver enable" output (e.g. for RS485)
 
#define UART_TX_LISTEN   10
 If "drive enable" is set, this is the number of milliseconds to await silence before sending.
 
#define UART_TX_INV   1
 Set to invert TX output (e.g. for RS485 via MAX485)
 
#define UART_RX_INV   1
 Set to invert RX input (e.g. for RS485 via MAX485)
 
#define UART_BAUDRATE   9600
 Baud rate.
 
#define UART_STOPBITS   1
 Stop bits.
 
#define UART_PARITY   0
 Parity (0 = none, 1 = odd, 2 = even) (ONLY 0 IMPLEMENTED YET)
 
#define UART_TX_BUFSIZE   16
 Capacity of the TX buffer (in bytes, must be power of 2)
 
#define UART_RX_BUFSIZE   16
 Capacity of the RX buffer (in bytes, must be power of 2)
 
#define UART_MULTI_BYTE_ISR   1
 Allow to receive multiple bytes (at most UART_RX_BUFSIZE) within one ISR call.
 

Temperature ...

#define WITH_TEMP_ZACWIRE   0
 Enable ZACwire temperature interface.
 
#define TEMP_NOTIFY   0
 Enable bus notification for temperature changes (does not affect BR_REG_CHANGED).
 

Shades ...

The 'shades' module allows to control up to two window shades (blinds) or actuators in a wider sense (e.g. including actuators to open/close windows or gates). Each actuator is associated with two output pins to active its engine in the "up" or "down" direction and two input pins connected to two push buttons for the two directions.

Note on the shades ports:

  1. For the buttons ('P_SHADES_n_BTN_*'), the internal pullup is activated, and the pin must be pulled to GND (logical 0) by the button.
  2. The actor pins ('P_SHADES_n_ACT_*') are driven high (+VDD) if the engine must be started and low (GND) to stop the engine.
#define SHADES_PORTS   0
 Number of (shades) actuators (max. 2)
 
#define SHADES_TIMEOUT   30000
 Number of milliseconds without connection before the brownie assumes that the master is offline. More...
 
#define SHADES_REVERSE_DELAY   1000
 Minimum time (in ms) the actor is kept off before it is switched on again (either in the same or other direction).
 
#define SHADES_0_RINT_FAILSAFE   0xff
 Failsafe internal request value(s) (RINT) for the case the brownie has lost its connection to the master (-1 = RINT is not changed on time-out). More...
 
#define SHADES_1_RINT_FAILSAFE   0xff
 
#define SHADES_PERSISTENCE   1
 If set, the position is stored in EEPROM to minimize calibrations. If unset, the position is reset to "unknown" on power up.
 
#define SHADES_TOLERANCE   2
 Tolerated deviation between the real and requested position in %. If the difference between real and requested state is no more than this, shades are not started to move.
 

Macro Definition Documentation

◆ TWI_SL_NOTIFY

#define TWI_SL_NOTIFY   (!IS_MAINTENANCE)

Device may perform notifications via its slave interface?

If the device must comply to the i2c standard, this option must be switched off (e.g. if the master is the Linux host).

Definition at line 102 of file configure.h.

◆ TWI_SL_NOTIFY_US

#define TWI_SL_NOTIFY_US   10000.0

Duration of a notification in microseconds.

This time must be at least the transmission time of approx. 2 bytes, so that in case of a collision the observed address becomes all-0. 10 ms is sufficient for an effective bit rate of 2 kbit/s including processing times and clock stretching (20 bits in 10 ms).

Definition at line 112 of file configure.h.

◆ MATRIX_COLS_GSHIFT

#define MATRIX_COLS_GSHIFT   (MATRIX_ROWS_GSHIFT - MATRIX_COLS)

Index of the first GPIO pin to be assigned to column lines.

By default, the last MATRIX_COLS pins just before the row lines are the sensing (column) lines.

Definition at line 219 of file configure.h.

◆ ADC_PERIOD

#define ADC_PERIOD   1024

Sample period in ticks (max. 32767)

If set to 0, the ADCs are driven in passive mode, in which sampling is performed (only) on demand at the time the respective register is read. This may have a negative impact on the TWI communication, which is stalled for the time of an eventual strobe and the ADC readout time. If set >0, the ADC is read out periodically with this period, an the BR_CHANGED_ADC bit is set whenever a new value has been read. The feature flag BR_FEATURE_ADC_PASSIVE indicates whether the ADCs operate in passive mode.

Note: Passive mode is presently not supported by the Brownies Resource driver.

Definition at line 254 of file configure.h.

◆ P_ADC_0_STROBE

#define P_ADC_0_STROBE   0

Pin to output a strobe signal before each sampling (0 = no strobe)

The strobe pin may be any pin that can be used as a GPIO. It must be excluded from use as a GPIO and will be configured as a digital output by the ADC feature module.

Definition at line 260 of file configure.h.

◆ SHADES_TIMEOUT

#define SHADES_TIMEOUT   30000

Number of milliseconds without connection before the brownie assumes that the master is offline.

After the timeout,

  • all external requests (REXT) are reset to 0xff,
  • all internal requests (RINT) are set to BR_SHADES_<n>_RINT_FAILSAFE.

A value of 0 means "no timeout".

Definition at line 383 of file configure.h.

◆ SHADES_0_RINT_FAILSAFE

#define SHADES_0_RINT_FAILSAFE   0xff

Failsafe internal request value(s) (RINT) for the case the brownie has lost its connection to the master (-1 = RINT is not changed on time-out).

Typically used values are:

  • -1: For normal shades: Shades eventually stop and become controllable by local buttons.
  • 0: For window openers: The window is closed and afterwards becomes controllable by local buttons.

The failsafe request is activated (and REXT set to -1) in the following situations:

  • after reset,
  • after the first successful read or write access to any of the shades registers or the BR_REG_CHANGED register: if no further such access happens within the time period specified by SHADES_TIMEOUT.

Definition at line 404 of file configure.h.