Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_PCA10056.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
46 config->pinDimmer = 16;
47 config->pinRelayDebug = 15;
48 config->pinRelayOn = 11;
49 config->pinRelayOff = 12;
52 config->pinAinDimmerTemp = GpioToAin(2);
53
54 config->pinRx = 8;
55 config->pinTx = 6;
56
57 config->pinGpio[0] = 27;
58 config->pinGpio[1] = 26;
59 config->pinGpio[2] = GetGpioPin(1, 15);
60 config->pinGpio[3] = PIN_NONE;
61
62 config->pinButton[0] = 11;
63 config->pinButton[1] = 12;
64 config->pinButton[2] = 24;
65 config->pinButton[3] = 25;
66
67 // The third and fourth LEDs are used to indicate the state of the relay and dimmer.
68 config->pinLed[0] = 13;
69 config->pinLed[1] = 14;
70 config->pinLed[2] = PIN_NONE;
71 config->pinLed[3] = PIN_NONE;
72
73 config->flags.dimmerInverted = true;
74 config->flags.enableUart = true;
75 config->flags.enableLeds = true;
76 config->flags.ledInverted = true;
77 config->flags.dimmerTempInverted = false;
78 config->flags.usesNfcPins = true;
79
81
82 // All values below are set to something rather than nothing, but are not truly in use.
83 config->voltageOffset[GAIN_SINGLE] = 1000;
84 config->currentOffset[GAIN_SINGLE] = 1000;
85 config->powerOffsetMilliWatt = 0;
86
87 // ADC values [0, 4095] map to [0, 3.6V].
88 config->voltageAdcRangeMilliVolt = 3600;
89 config->currentAdcRangeMilliVolt = 3600;
90
91 config->pwmTempVoltageThreshold = 2.0;
92 config->pwmTempVoltageThresholdDown = 1.0;
93
94 config->minTxPower = -40;
95
96 config->scanWindowUs = 3 * config->scanIntervalUs / 4;
98}
uint8_t GpioToAin(uint8_t gpio)
uint8_t GetGpioPin(uint8_t major, uint8_t minor)
#define PIN_NONE
Definition: cs_Boards.h:94
@ GAIN_SINGLE
Definition: cs_Boards.h:101
#define DEVICE_CROWNSTONE_PLUG
Definition: cs_DeviceTypes.h:24
void asPca10056(boards_config_t *config)
This is the development board for the nRF52840.
Definition: cs_PCA10056.h:45
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
uint8_t pinRelayDebug
GPIO to debug the relay: turns on when relay is turned on, and vice versa. Inverted when LEDs are inv...
Definition: cs_Boards.h:180
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
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
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
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