Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_ACR01B15A.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
20
22
23 config->pinDimmer = GetGpioPin(1, 13); // Gate-N
24 config->pinEnableDimmer = GetGpioPin(1, 14); // Gate-P
25
26 config->pinRelayOn = 13;
27 config->pinRelayOff = 15;
28
29 config->pinAinCurrent[GAIN_LOW] = GpioToAin(2);
30 config->pinAinCurrent[GAIN_HIGH] = GpioToAin(30);
31
32 config->pinAinVoltage[GAIN_LOW] = GpioToAin(28);
33 config->pinAinVoltage[GAIN_HIGH] = GpioToAin(3);
34
37
38 config->pinAinZeroRef = GpioToAin(5);
39 config->pinAinDimmerTemp = GpioToAin(4);
40
41 config->pinCurrentZeroCrossing = 8;
42 config->pinVoltageZeroCrossing = GetGpioPin(1, 9);
43
44 config->pinRx = 22;
45 config->pinTx = 20;
46
47 config->pinGpio[0] = 24;
48 config->pinGpio[1] = GetGpioPin(1, 0);
49 config->pinGpio[2] = GetGpioPin(1, 2);
50 config->pinGpio[3] = GetGpioPin(1, 4);
51 config->pinGpio[4] = GetGpioPin(1, 6);
52 config->pinGpio[5] = GetGpioPin(1, 7);
53 config->pinGpio[6] = 9;
54 config->pinGpio[7] = 16;
55 config->pinGpio[8] = 21;
56 config->pinGpio[9] = GetGpioPin(1, 15);
57
58 config->flags.dimmerInverted = true;
59 config->flags.enableUart = false;
60 config->flags.enableLeds = false;
61 config->flags.dimmerTempInverted = true;
62 config->flags.usesNfcPins = true;
63 config->flags.canTryDimmingOnBoot = true;
64 config->flags.canDimOnWarmBoot = true;
65 config->flags.dimmerOnWhenPinsFloat = false;
66
67 // ADC values [-2048, 2047] map to [REF - 1.8V, REF + 1.8V].
68 config->voltageAdcRangeMilliVolt = 1800;
69 config->currentAdcRangeMilliVolt = 1800;
70
71 // TODO: All the following values have to be calculated still, now set to some guessed values.
72 config->voltageMultiplier[GAIN_LOW] = -0.25;
73 config->voltageMultiplier[GAIN_HIGH] = -0.25;
74
75 config->voltageAfterLoadMultiplier[GAIN_LOW] = -0.25;
77
78 config->currentMultiplier[GAIN_LOW] = 0.01;
79 config->currentMultiplier[GAIN_HIGH] = 0.01;
80
81 config->voltageOffset[GAIN_LOW] = 0;
82 config->voltageOffset[GAIN_HIGH] = 0;
83
84 config->currentOffset[GAIN_LOW] = 0;
85 config->currentOffset[GAIN_HIGH] = 0;
86
87 config->powerOffsetMilliWatt = 0;
88
89 config->pwmTempVoltageThreshold = 0.2;
90 config->pwmTempVoltageThresholdDown = 0.18;
91
92 config->minTxPower = -20;
93
94 config->scanWindowUs = config->scanIntervalUs;
96}
void asACR01B15A(boards_config_t *config)
This prototype of the Crownstone Built-in Two is based on the nRF52840.
Definition: cs_ACR01B15A.h:19
uint8_t GpioToAin(uint8_t gpio)
uint8_t GetGpioPin(uint8_t major, uint8_t minor)
@ GAIN_LOW
Definition: cs_Boards.h:97
@ GAIN_HIGH
Definition: cs_Boards.h:99
#define DEVICE_CROWNSTONE_BUILTIN_TWO
Definition: cs_DeviceTypes.h:31
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
float voltageAfterLoadMultiplier[GAIN_COUNT]
Multiplication factor for voltage measurement after the load.
Definition: cs_Boards.h:288
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 pinVoltageZeroCrossing
GPIO pin to get zero-crossing information for voltage.
Definition: cs_Boards.h:210
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
uint8_t pinAinVoltageAfterLoad[GAIN_COUNT]
Analog input pins to read the voltage after the load with different gains (if present).
Definition: cs_Boards.h:195
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
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
uint8_t pinCurrentZeroCrossing
GPIO pin to get zero-crossing information for current.
Definition: cs_Boards.h:207