Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_CR01R02v4.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 * Dev board
15 * *******************************************************************************************************************/
16
42 config->pinDimmer = PIN_NONE;
43 config->pinRelayOn = 12;
44 config->pinRelayOff = 11;
45 config->pinAinCurrent[GAIN_LOW] = GpioToAin(2);
46 config->pinAinCurrent[GAIN_HIGH] = GpioToAin(3);
47 config->pinAinVoltage[GAIN_SINGLE] = GpioToAin(30);
48 config->pinAinZeroRef = GpioToAin(5);
49 config->pinAinEarth = GpioToAin(29);
50 // config->pinAinDimmerTemp = PIN_NONE;
51 config->pinAinDimmerTemp = GpioToAin(4);
52
53 config->pinRx = 9;
54 config->pinTx = 10;
55
56 config->pinGpio[0] = GetGpioPin(1, 0);
57 config->pinGpio[1] = GetGpioPin(1, 15);
58 config->pinGpio[2] = GetGpioPin(1, 8);
59 config->pinGpio[3] = GetGpioPin(1, 9);
60
61 config->pinButton[0] = PIN_NONE;
62 config->pinButton[1] = 8;
63 config->pinButton[2] = 24;
64 config->pinButton[3] = 25;
65
66 config->pinLed[0] = 13;
67 config->pinLed[1] = 14;
68 config->pinLed[2] = 17;
69 config->pinLed[3] = PIN_NONE;
70
71 config->pinFlash.cs = 19;
72 config->pinFlash.clk = 20;
73 config->pinFlash.dio[0] = 21;
74 config->pinFlash.dio[1] = 22;
75 config->pinFlash.dio[2] = 23;
76 config->pinFlash.dio[3] = 24;
77
78 config->flags.dimmerInverted = false;
79 config->flags.enableUart = true;
80 config->flags.enableLeds = true;
81 config->flags.ledInverted = false;
82 config->flags.dimmerTempInverted = false;
83 config->flags.usesNfcPins = true;
84
86
87 // All values below are set to something rather than nothing, but are not truly in use.
88 config->voltageOffset[GAIN_SINGLE] = 1000;
89 config->currentOffset[GAIN_LOW] = 1000;
90 config->currentOffset[GAIN_HIGH] = 1000;
91 config->powerOffsetMilliWatt = 0;
92
93 // ADC values [0, 4095] map to [0, 3.6V].
94 config->voltageAdcRangeMilliVolt = 3600;
95 config->currentAdcRangeMilliVolt = 3600;
96
97 config->pwmTempVoltageThreshold = 2.0;
98 config->pwmTempVoltageThresholdDown = 1.0;
99
100 config->minTxPower = -40;
101
102 config->scanWindowUs = config->scanIntervalUs;
104}
uint8_t GpioToAin(uint8_t gpio)
uint8_t GetGpioPin(uint8_t major, uint8_t minor)
#define PIN_NONE
Definition: cs_Boards.h:94
@ GAIN_LOW
Definition: cs_Boards.h:97
@ GAIN_SINGLE
Definition: cs_Boards.h:101
@ GAIN_HIGH
Definition: cs_Boards.h:99
void asCR01R02v4(boards_config_t *config)
This is a smart outlet.
Definition: cs_CR01R02v4.h:41
#define DEVICE_CROWNSTONE_OUTLET
Definition: cs_DeviceTypes.h:33
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
struct boards_config_t::@6 pinFlash
JTAG / SWD pins for flashing.
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 clk
Clock pin.
Definition: cs_Boards.h:232
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
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
uint8_t dio[4]
Data pins.
Definition: cs_Boards.h:234
uint32_t currentAdcRangeMilliVolt
Range in mV to be used for the current pin.
Definition: cs_Boards.h:319
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 pinAinEarth
Analog input pin to measure EARTH.
Definition: cs_Boards.h:204
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
uint8_t pinButton[BUTTON_COUNT]
GPIO pins of buttons (on dev. kit).
Definition: cs_Boards.h:222
float pwmTempVoltageThreshold
Voltage of PWM thermometer at which the dimmer is too hot.
Definition: cs_Boards.h:329
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 cs
Chip select pin.
Definition: cs_Boards.h:230
uint8_t pinRx
GPIO pin to receive UART.
Definition: cs_Boards.h:213