Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_ACR01B10D.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
13/* ********************************************************************************************************************
14 * Crownstone Built-in One
15 * *******************************************************************************************************************/
16
76 config->pinDimmer = 8;
77 config->pinEnableDimmer = 10;
78 config->pinRelayOn = 14;
79 config->pinRelayOff = 13;
80
81 config->pinAinCurrent[GAIN_LOW] = GpioToAin(30);
82 config->pinAinCurrent[GAIN_MIDDLE] = GpioToAin(29);
83 config->pinAinCurrent[GAIN_HIGH] = GpioToAin(28);
84
86
87 config->pinAinZeroRef = GpioToAin(2);
88 config->pinAinDimmerTemp = GpioToAin(4);
89
90 config->pinRx = 20;
91 config->pinTx = 19;
92
93 config->pinGpio[0] = 18;
94 config->pinGpio[1] = 17;
95 config->pinGpio[2] = 16;
96 config->pinGpio[3] = 15;
97
98 config->flags.dimmerInverted = false;
99 config->flags.enableUart = false;
100 config->flags.enableLeds = false;
101 config->flags.dimmerTempInverted = true;
102 config->flags.usesNfcPins = true;
103 config->flags.hasAccuratePowerMeasurement = true;
104 config->flags.canTryDimmingOnBoot = true;
105 config->flags.canDimOnWarmBoot = true;
106 config->flags.dimmerOnWhenPinsFloat = false;
107
109
110 // TODO: Explain why not -0.26632 (see above). If incorrect, replace.
111 config->voltageMultiplier[GAIN_SINGLE] = -0.2547;
112
113 // TODO: Explain this value
114 config->currentMultiplier[GAIN_LOW] = 0.01486f;
115
116 // TODO: Calculate the following values (now set to something arbitrary)
117 config->currentMultiplier[GAIN_MIDDLE] = 0.015;
118 config->currentMultiplier[GAIN_HIGH] = 0.015;
119
120 config->voltageOffset[GAIN_SINGLE] = 512;
121
122 // TODO: Explain this value
123 config->currentOffset[GAIN_LOW] = -125;
124
125 // TODO: Calculate the following values (now set to something arbitrary)
126 config->currentOffset[GAIN_MIDDLE] = -125;
127 config->currentOffset[GAIN_HIGH] = -125;
128
129 // TODO: Explain this value
130 config->powerOffsetMilliWatt = 800;
131
132 // ADC values [-2048, 2047] map to [REF - 1.8V, REF + 1.8V].
133 config->voltageAdcRangeMilliVolt = 1800;
134 // ADC values [-2048, 2047] map to [REF - 1.2V, REF + 1.2V].
135 config->currentAdcRangeMilliVolt = 1200;
136
137 // TODO: These are incorrectly calculated with R_12 = 16k and B_ntc = 3380 K.
138 config->pwmTempVoltageThreshold = 0.35; // 0.3518
139 config->pwmTempVoltageThresholdDown = 0.30; // 0.3036
140
141 // TODO: It should be with R_12 = 18k and B_ntc = 3434 K (enable the following).
142 // config->pwmTempVoltageThreshold = 0.3090;
143 // config->pwmTempVoltageThresholdDown = 0.2655;
144
145 config->minTxPower = -20;
146
147 config->scanWindowUs = config->scanIntervalUs;
149}
void asACR01B10D(boards_config_t *config)
The ACR01B10D is also known as the Crownstone Built-in One.
Definition: cs_ACR01B10D.h:75
uint8_t GpioToAin(uint8_t gpio)
@ GAIN_LOW
Definition: cs_Boards.h:97
@ GAIN_MIDDLE
Definition: cs_Boards.h:98
@ GAIN_SINGLE
Definition: cs_Boards.h:101
@ GAIN_HIGH
Definition: cs_Boards.h:99
#define DEVICE_CROWNSTONE_BUILTIN_ONE
Definition: cs_DeviceTypes.h:28
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
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
uint8_t pinGpio[GPIO_INDEX_COUNT]
GPIO pins that can be used as GPIO by the user, for example microapps.
Definition: cs_Boards.h:219
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
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
bool hasAccuratePowerMeasurement
True if the Crownstone has a more accurate power measurement.
Definition: cs_Boards.h:259
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 pinEnableDimmer
GPIO pin to enable the IGBT circuit.
Definition: cs_Boards.h:177
uint8_t pinRx
GPIO pin to receive UART.
Definition: cs_Boards.h:213