Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_ACR01B2G.h
Go to the documentation of this file.
1/*
2 * Author: Crownstone Team
3 * Copyright: Crownstone (https://crownstone.rocks)
4 * Date: Jan 25, 2022
5 * License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
6 */
7
8#pragma once
9
10#include <cfg/cs_Boards.h>
11#include <cfg/cs_DeviceTypes.h>
12
40 config->pinDimmer = 8;
41 config->pinRelayOn = 6;
42 config->pinRelayOff = 7;
43
46
47 config->pinAinZeroRef = GpioToAin(2);
48 config->pinAinDimmerTemp = GpioToAin(5);
49
50 config->pinRx = 20;
51 config->pinTx = 19;
52
53 config->pinLed[LED_RED] = 9;
54 config->pinLed[LED_GREEN] = 10;
55
56 config->flags.dimmerInverted = false;
57 config->flags.enableUart = false;
58 config->flags.enableLeds = false;
59 config->flags.ledInverted = false;
60 config->flags.dimmerTempInverted = true;
61 config->flags.usesNfcPins = false; // Set to true if you want to use the LEDs.
62 config->flags.canTryDimmingOnBoot = false;
63 config->flags.canDimOnWarmBoot = false;
64 config->flags.dimmerOnWhenPinsFloat = true;
65
67
68 // The following two values are empirically determined, through calibration over 10 production crownstones
69 config->voltageMultiplier[GAIN_SINGLE] = 0.171f;
70 config->currentMultiplier[GAIN_SINGLE] = 0.00385f;
71
72 // Calibrated by noisy data from 1 crownstone
73 // The following two values are empirically determined, through calibration over noisy data from 1 Crownstone.
74 config->voltageOffset[GAIN_SINGLE] = -99;
75 config->currentOffset[GAIN_SINGLE] = -270;
76
77 // The following value is empirically determined, through calibration over 10 production crownstones
78 config->powerOffsetMilliWatt = 9000;
79
80 // ADC values [-2048, 2047] map to [REF - 1.2V, REF + 1.2V].
81 config->voltageAdcRangeMilliVolt = 1200;
82
83 // ADC values [-2048, 2047] map to [REF - 0.6V, REF + 0.6V].
84 config->currentAdcRangeMilliVolt = 600;
85
86 config->pwmTempVoltageThreshold = 0.70;
87 config->pwmTempVoltageThresholdDown = 0.25;
88
89 config->minTxPower = -20;
90
91 // This board cannot provide enough power for 100% scanning.
92 config->scanWindowUs = 3 * config->scanIntervalUs / 4;
94}
void asACR01B2G(boards_config_t *config)
The second type of plug that is delivered to Crownstone users.
Definition: cs_ACR01B2G.h:39
uint8_t GpioToAin(uint8_t gpio)
@ LED_GREEN
Definition: cs_Boards.h:133
@ LED_RED
Definition: cs_Boards.h:132
@ GAIN_SINGLE
Definition: cs_Boards.h:101
#define DEVICE_CROWNSTONE_PLUG
Definition: cs_DeviceTypes.h:24
Board configuration.
Definition: cs_Boards.h:169
uint8_t pinDimmer
GPIO pin to control the IGBTs.
Definition: cs_Boards.h:174
int32_t powerOffsetMilliWatt
Measured power when there is no load (mW).
Definition: cs_Boards.h:306
int8_t minTxPower
The minimum radio transmission power to be used.
Definition: cs_Boards.h:326
int32_t currentOffset[GAIN_COUNT]
Offset for current measurement (in ADC values).
Definition: cs_Boards.h:303
struct boards_config_t::@7 flags
Flags about pin order, presence of components, etc.
bool enableUart
True if the board should have UART enabled by default.
Definition: cs_Boards.h:243
uint8_t pinAinDimmerTemp
Analog input pin to read the dimmer temperature.
Definition: cs_Boards.h:201
bool ledInverted
True if LED is off when GPIO is set high.
Definition: cs_Boards.h:250
uint8_t pinAinCurrent[GAIN_COUNT]
Analog input pins to read the current with different gains (if present).
Definition: cs_Boards.h:189
uint32_t scanIntervalUs
Scan interval in μs.
Definition: cs_Boards.h:345
bool canTryDimmingOnBoot
True if the Crownstone can try dimming at boot, because it has an accurate enough power measurement,...
Definition: cs_Boards.h:263
float pwmTempVoltageThresholdDown
Voltage of PWM thermometer at which the dimmer is cool enough again.
Definition: cs_Boards.h:332
bool dimmerOnWhenPinsFloat
True if the dimmer can be on when the pins are floating (during boot).
Definition: cs_Boards.h:269
uint32_t currentAdcRangeMilliVolt
Range in mV to be used for the current pin.
Definition: cs_Boards.h:319
float voltageMultiplier[GAIN_COUNT]
Multiplication factor for voltage measurement.
Definition: cs_Boards.h:282
uint32_t scanWindowUs
Scan window in μs.
Definition: cs_Boards.h:353
int8_t tapToToggleDefaultRssiThreshold
Default RSSI threshold, above which tap to toggle will trigger.
Definition: cs_Boards.h:358
uint8_t pinTx
GPIO pin to send UART.
Definition: cs_Boards.h:216
bool dimmerInverted
True if the dimmer is inverted (setting gpio high turns dimmer off).
Definition: cs_Boards.h:240
uint8_t pinLed[LED_COUNT]
GPIO pins of LEDs.
Definition: cs_Boards.h:225
bool enableLeds
True if the board has LEDs that should be enabled by default.
Definition: cs_Boards.h:247
uint8_t deviceType
Device type, e.g.
Definition: cs_Boards.h:276
bool dimmerTempInverted
True if the temperature sensor of the dimmer is inverted (NTC).
Definition: cs_Boards.h:253
bool canDimOnWarmBoot
True if the Crownstone can dim immediately after a warm boot.
Definition: cs_Boards.h:266
float pwmTempVoltageThreshold
Voltage of PWM thermometer at which the dimmer is too hot.
Definition: cs_Boards.h:329
float currentMultiplier[GAIN_COUNT]
Multiplication factor for current measurement.
Definition: cs_Boards.h:294
uint8_t pinRelayOn
GPIO pin to switch the relay on.
Definition: cs_Boards.h:183
uint8_t pinAinVoltage[GAIN_COUNT]
Analog input pins to read the voltage with different gains (if present).
Definition: cs_Boards.h:192
uint8_t pinRelayOff
GPIO pin to switch the relay off.
Definition: cs_Boards.h:186
bool usesNfcPins
True if the NFC pins (p0.09 and p0.10) are used as GPIO.
Definition: cs_Boards.h:256
uint8_t pinAinZeroRef
Analog input pin to read 'zero' / offset (to be used for both current and voltage measurements).
Definition: cs_Boards.h:198
int32_t voltageOffset[GAIN_COUNT]
Offset for voltage measurement (in ADC values).
Definition: cs_Boards.h:297
uint32_t voltageAdcRangeMilliVolt
Range in mV to be used for the voltage pin.
Definition: cs_Boards.h:313
uint8_t pinRx
GPIO pin to receive UART.
Definition: cs_Boards.h:213