b-parasite-esp32/code/nrf-connect/prstlib/boards/arm/bparasite_nrf52840/bparasite_nrf52840.dts
rbaron e82c1b6bc1 Implements button handling
- DTS bindings
- Debouncing logic
- New `input` for testing and interrupt power profiling
2023-03-29 21:28:24 +02:00

175 lines
3.3 KiB
Text

/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "bparasite_nrf52840-pinctrl.dtsi"
/ {
model = "A soil moisture sensor based on Nordic's nRF52840";
compatible = "rbaron,bparasite_nrf52840";
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,ieee802154 = &ieee802154;
};
zephyr,user {
io-channels = <&adc 0>, <&adc 2>;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
// P0.28.
gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
};
};
buttons {
compatible = "gpio-keys";
button0: button_0 {
// P0.30.
gpios = <&gpio0 30 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Push button SW1";
};
};
soil_pwm: soil_pwm {
compatible = "pwm-fixed";
pwms = <&pwm0 0 PWM_USEC(2) PWM_POLARITY_NORMAL>;
pulse = <PWM_USEC(1)>;
};
soil_calibration_coeffs: soil_calibration_coeffs {
compatible = "soil-calibration-coeffs";
dry = <306000 101000 (-11700)>;
wet = <19000 (-4980) 3420>;
};
ctrl {
compatible = "gpio-keys";
fast_disch: fast_disch {
// P1.10.
gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
label = "Fast discharge circuitry";
};
};
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
// For low-power EDGE interrupts.
// github.com/zephyrproject-rtos/zephyr/issues/28499
sense-edge-mask = <0xffffffff>;
};
&gpio1 {
status = "okay";
};
&ieee802154 {
status = "okay";
};
&uart0 {
compatible = "nordic,nrf-uart";
status = "disabled";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};
&i2c0 {
compatible = "nordic,nrf-twi";
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
shtc3: shtc3@70 {
compatible = "i2c-device";
reg = <0x70>;
label = "SHTC3";
};
};
&pwm0 {
status = "okay";
pinctrl-0 = <&pwm0_default>;
pinctrl-1 = <&pwm0_sleep>;
pinctrl-names = "default", "sleep";
};
&adc {
#address-cells = <1>;
#size-cells = <0>;
status = "ok";
// Soil.
channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_VDD_1_4";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
// P0.03.
zephyr,input-positive = <NRF_SAADC_AIN1>;
zephyr,resolution = <10>;
};
// Battery.
channel@2 {
reg = <2>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_VDD>;
zephyr,resolution = <10>;
};
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x0000C000>;
};
slot0_partition: partition@c000 {
label = "image-0";
reg = <0x0000C000 0x00067000>;
};
slot1_partition: partition@73000 {
label = "image-1";
reg = <0x00073000 0x00067000>;
};
scratch_partition: partition@da000 {
label = "image-scratch";
reg = <0x000da000 0x0001e000>;
};
/*
* The flash starting at 0x000f8000 and ending at
* 0x000fffff is reserved for use by the application.
*/
/*
* Storage partition will be used by FCB/LittleFS/NVS
* if enabled.
*/
storage_partition: partition@f8000 {
label = "storage";
reg = <0x000f8000 0x00008000>;
};
};
};