Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
boards_config_t Struct Reference

Board configuration. More...

#include <cs_Boards.h>

Public Attributes

uint32_t hardwareBoard
 The hardware board type (number). More...
 
uint8_t pinDimmer
 GPIO pin to control the IGBTs. More...
 
uint8_t pinEnableDimmer
 GPIO pin to enable the IGBT circuit. More...
 
uint8_t pinRelayDebug
 GPIO to debug the relay: turns on when relay is turned on, and vice versa. Inverted when LEDs are inverted. More...
 
uint8_t pinRelayOn
 GPIO pin to switch the relay on. More...
 
uint8_t pinRelayOff
 GPIO pin to switch the relay off. More...
 
uint8_t pinAinCurrent [GAIN_COUNT]
 Analog input pins to read the current with different gains (if present). More...
 
uint8_t pinAinVoltage [GAIN_COUNT]
 Analog input pins to read the voltage with different gains (if present). More...
 
uint8_t pinAinVoltageAfterLoad [GAIN_COUNT]
 Analog input pins to read the voltage after the load with different gains (if present). More...
 
uint8_t pinAinZeroRef
 Analog input pin to read 'zero' / offset (to be used for both current and voltage measurements). More...
 
uint8_t pinAinDimmerTemp
 Analog input pin to read the dimmer temperature. More...
 
uint8_t pinAinEarth
 Analog input pin to measure EARTH. More...
 
uint8_t pinCurrentZeroCrossing
 GPIO pin to get zero-crossing information for current. More...
 
uint8_t pinVoltageZeroCrossing
 GPIO pin to get zero-crossing information for voltage. More...
 
uint8_t pinRx
 GPIO pin to receive UART. More...
 
uint8_t pinTx
 GPIO pin to send UART. More...
 
uint8_t pinGpio [GPIO_INDEX_COUNT]
 GPIO pins that can be used as GPIO by the user, for example microapps. More...
 
uint8_t pinButton [BUTTON_COUNT]
 GPIO pins of buttons (on dev. kit). More...
 
uint8_t pinLed [LED_COUNT]
 GPIO pins of LEDs. More...
 
struct {
   uint8_t   cs
 Chip select pin. More...
 
   uint8_t   clk
 Clock pin. More...
 
   uint8_t   dio [4]
 Data pins. More...
 
pinFlash
 JTAG / SWD pins for flashing. More...
 
struct {
   bool   dimmerInverted: 1
 True if the dimmer is inverted (setting gpio high turns dimmer off). More...
 
   bool   enableUart: 1
 True if the board should have UART enabled by default. More...
 
   bool   enableLeds: 1
 True if the board has LEDs that should be enabled by default. More...
 
   bool   ledInverted: 1
 True if LED is off when GPIO is set high. More...
 
   bool   dimmerTempInverted: 1
 True if the temperature sensor of the dimmer is inverted (NTC). More...
 
   bool   usesNfcPins: 1
 True if the NFC pins (p0.09 and p0.10) are used as GPIO. More...
 
   bool   hasAccuratePowerMeasurement: 1
 True if the Crownstone has a more accurate power measurement. More...
 
   bool   canTryDimmingOnBoot: 1
 True if the Crownstone can try dimming at boot, because it has an accurate enough power measurement, and a lower startup time of the dimmer circuit. More...
 
   bool   canDimOnWarmBoot: 1
 True if the Crownstone can dim immediately after a warm boot. More...
 
   bool   dimmerOnWhenPinsFloat: 1
 True if the dimmer can be on when the pins are floating (during boot). More...
 
flags
 Flags about pin order, presence of components, etc. More...
 
uint8_t deviceType
 Device type, e.g. More...
 
float voltageMultiplier [GAIN_COUNT]
 Multiplication factor for voltage measurement. More...
 
float voltageAfterLoadMultiplier [GAIN_COUNT]
 Multiplication factor for voltage measurement after the load. More...
 
float currentMultiplier [GAIN_COUNT]
 Multiplication factor for current measurement. More...
 
int32_t voltageOffset [GAIN_COUNT]
 Offset for voltage measurement (in ADC values). More...
 
int32_t voltageAfterLoadOffset [GAIN_COUNT]
 Offset for voltage measurement after the load (in ADC values). More...
 
int32_t currentOffset [GAIN_COUNT]
 Offset for current measurement (in ADC values). More...
 
int32_t powerOffsetMilliWatt
 Measured power when there is no load (mW). More...
 
uint32_t voltageAdcRangeMilliVolt
 Range in mV to be used for the voltage pin. More...
 
uint32_t currentAdcRangeMilliVolt
 Range in mV to be used for the current pin. More...
 
int8_t minTxPower
 The minimum radio transmission power to be used. More...
 
float pwmTempVoltageThreshold
 Voltage of PWM thermometer at which the dimmer is too hot. More...
 
float pwmTempVoltageThresholdDown
 Voltage of PWM thermometer at which the dimmer is cool enough again. More...
 
uint32_t scanIntervalUs
 Scan interval in μs. More...
 
uint32_t scanWindowUs
 Scan window in μs. More...
 
int8_t tapToToggleDefaultRssiThreshold
 Default RSSI threshold, above which tap to toggle will trigger. More...
 

Detailed Description

Board configuration.

Configure pins for control relays, IGBTs, LEDs, UART, current sensing, etc.

Member Data Documentation

◆ canDimOnWarmBoot

bool boards_config_t::canDimOnWarmBoot

True if the Crownstone can dim immediately after a warm boot.

◆ canTryDimmingOnBoot

bool boards_config_t::canTryDimmingOnBoot

True if the Crownstone can try dimming at boot, because it has an accurate enough power measurement, and a lower startup time of the dimmer circuit.

◆ clk

uint8_t boards_config_t::clk

Clock pin.

◆ cs

uint8_t boards_config_t::cs

Chip select pin.

◆ currentAdcRangeMilliVolt

uint32_t boards_config_t::currentAdcRangeMilliVolt

Range in mV to be used for the current pin.

Determines the ADC gain. See adcRangeVoltage.

◆ currentMultiplier

float boards_config_t::currentMultiplier[GAIN_COUNT]

Multiplication factor for current measurement.

Current through mains = (ADC value - offset) * multiplier

◆ currentOffset

int32_t boards_config_t::currentOffset[GAIN_COUNT]

Offset for current measurement (in ADC values).

◆ deviceType

uint8_t boards_config_t::deviceType

Device type, e.g.

crownstone plug, crownstone builtin, guidestone.

This can be overwritten for debug purposes at compile time, but is otherwise determined by the board type.

◆ dimmerInverted

bool boards_config_t::dimmerInverted

True if the dimmer is inverted (setting gpio high turns dimmer off).

◆ dimmerOnWhenPinsFloat

bool boards_config_t::dimmerOnWhenPinsFloat

True if the dimmer can be on when the pins are floating (during boot).

◆ dimmerTempInverted

bool boards_config_t::dimmerTempInverted

True if the temperature sensor of the dimmer is inverted (NTC).

◆ dio

uint8_t boards_config_t::dio[4]

Data pins.

◆ enableLeds

bool boards_config_t::enableLeds

True if the board has LEDs that should be enabled by default.

Some boards do have LEDs, but cannot deliver enough power when also listening (scanning / meshing).

◆ enableUart

bool boards_config_t::enableUart

True if the board should have UART enabled by default.

◆ 

struct { ... } boards_config_t::flags

Flags about pin order, presence of components, etc.

◆ hardwareBoard

uint32_t boards_config_t::hardwareBoard

The hardware board type (number).

◆ hasAccuratePowerMeasurement

bool boards_config_t::hasAccuratePowerMeasurement

True if the Crownstone has a more accurate power measurement.

◆ ledInverted

bool boards_config_t::ledInverted

True if LED is off when GPIO is set high.

◆ minTxPower

int8_t boards_config_t::minTxPower

The minimum radio transmission power to be used.

Builtins need higher TX power than plugs because of surrounding metal and wall material.

◆ pinAinCurrent

uint8_t boards_config_t::pinAinCurrent[GAIN_COUNT]

Analog input pins to read the current with different gains (if present).

◆ pinAinDimmerTemp

uint8_t boards_config_t::pinAinDimmerTemp

Analog input pin to read the dimmer temperature.

◆ pinAinEarth

uint8_t boards_config_t::pinAinEarth

Analog input pin to measure EARTH.

◆ pinAinVoltage

uint8_t boards_config_t::pinAinVoltage[GAIN_COUNT]

Analog input pins to read the voltage with different gains (if present).

◆ pinAinVoltageAfterLoad

uint8_t boards_config_t::pinAinVoltageAfterLoad[GAIN_COUNT]

Analog input pins to read the voltage after the load with different gains (if present).

◆ pinAinZeroRef

uint8_t boards_config_t::pinAinZeroRef

Analog input pin to read 'zero' / offset (to be used for both current and voltage measurements).

◆ pinButton

uint8_t boards_config_t::pinButton[BUTTON_COUNT]

GPIO pins of buttons (on dev. kit).

◆ pinCurrentZeroCrossing

uint8_t boards_config_t::pinCurrentZeroCrossing

GPIO pin to get zero-crossing information for current.

◆ pinDimmer

uint8_t boards_config_t::pinDimmer

GPIO pin to control the IGBTs.

◆ pinEnableDimmer

uint8_t boards_config_t::pinEnableDimmer

GPIO pin to enable the IGBT circuit.

◆ 

struct { ... } boards_config_t::pinFlash

JTAG / SWD pins for flashing.

◆ pinGpio

uint8_t boards_config_t::pinGpio[GPIO_INDEX_COUNT]

GPIO pins that can be used as GPIO by the user, for example microapps.

◆ pinLed

uint8_t boards_config_t::pinLed[LED_COUNT]

GPIO pins of LEDs.

◆ pinRelayDebug

uint8_t boards_config_t::pinRelayDebug

GPIO to debug the relay: turns on when relay is turned on, and vice versa. Inverted when LEDs are inverted.

◆ pinRelayOff

uint8_t boards_config_t::pinRelayOff

GPIO pin to switch the relay off.

◆ pinRelayOn

uint8_t boards_config_t::pinRelayOn

GPIO pin to switch the relay on.

◆ pinRx

uint8_t boards_config_t::pinRx

GPIO pin to receive UART.

◆ pinTx

uint8_t boards_config_t::pinTx

GPIO pin to send UART.

◆ pinVoltageZeroCrossing

uint8_t boards_config_t::pinVoltageZeroCrossing

GPIO pin to get zero-crossing information for voltage.

◆ powerOffsetMilliWatt

int32_t boards_config_t::powerOffsetMilliWatt

Measured power when there is no load (mW).

◆ pwmTempVoltageThreshold

float boards_config_t::pwmTempVoltageThreshold

Voltage of PWM thermometer at which the dimmer is too hot.

◆ pwmTempVoltageThresholdDown

float boards_config_t::pwmTempVoltageThresholdDown

Voltage of PWM thermometer at which the dimmer is cool enough again.

◆ scanIntervalUs

uint32_t boards_config_t::scanIntervalUs

Scan interval in μs.

Since this setting is also used when connecting, it influences the time it takes to make an outgoing connection. For some reason, if the scan interval is 2s, it takes at least 2s before a connection is made.

It's also best to make this interval not a multiple of the advertising interval, because in that case, it can happen that the advertisements are outside the scan window every time.

Must not be larger than (1000 * BEARER_SCAN_INT_MAX_MS).

◆ scanWindowUs

uint32_t boards_config_t::scanWindowUs

Scan window in μs.

Must not be larger than scan interval, and not smaller than (1000 * BEARER_SCAN_WIN_MIN_MS). See https://devzone.nordicsemi.com/f/nordic-q-a/14733/s132-scan-interval-window-adv-interval

◆ tapToToggleDefaultRssiThreshold

int8_t boards_config_t::tapToToggleDefaultRssiThreshold

Default RSSI threshold, above which tap to toggle will trigger.

◆ usesNfcPins

bool boards_config_t::usesNfcPins

True if the NFC pins (p0.09 and p0.10) are used as GPIO.

◆ voltageAdcRangeMilliVolt

uint32_t boards_config_t::voltageAdcRangeMilliVolt

Range in mV to be used for the voltage pin.

Determines the ADC gain. Example: if the ADC should measure [0V, 3.6V] then range is 3600. Example with zero ref pin: if the ADC should measure [-0.6V, 0.6V] then range is 600.

◆ voltageAfterLoadMultiplier

float boards_config_t::voltageAfterLoadMultiplier[GAIN_COUNT]

Multiplication factor for voltage measurement after the load.

Voltage on mains after load = (ADC value - offset) * multiplier

◆ voltageAfterLoadOffset

int32_t boards_config_t::voltageAfterLoadOffset[GAIN_COUNT]

Offset for voltage measurement after the load (in ADC values).

◆ voltageMultiplier

float boards_config_t::voltageMultiplier[GAIN_COUNT]

Multiplication factor for voltage measurement.

Voltage on mains = (ADC value - offset) * multiplier

◆ voltageOffset

int32_t boards_config_t::voltageOffset[GAIN_COUNT]

Offset for voltage measurement (in ADC values).


The documentation for this struct was generated from the following file: