From 3d5239f235212b1e15b8f2bac1162ad24c6e8601 Mon Sep 17 00:00:00 2001 From: Kemal Hadimli Date: Fri, 17 Feb 2023 19:49:59 +0000 Subject: [PATCH] Add instructions for LD2410 --- CMakeLists.txt | 2 +- README.md | 8 +++++++- mbedtls_util.c | 22 ---------------------- 3 files changed, 8 insertions(+), 24 deletions(-) delete mode 100644 mbedtls_util.c diff --git a/CMakeLists.txt b/CMakeLists.txt index d661e5e..270a25c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ add_compile_options(-Wall if ((PICO_CYW43_SUPPORTED) AND (TARGET pico_cyw43_arch)) add_executable(${NAME} - main.cpp ledcontrol.cpp ledcontrol.h util.h config.h encoder.cpp encoder.h iot.cpp iot.h presence.cpp presence.h config_iot.h mbedtls_util.c cJSON/cJSON.c cJSON/cJSON.h DFRobot_mmWave_Radar.cpp DFRobot_mmWave_Radar.h + main.cpp ledcontrol.cpp ledcontrol.h util.h config.h encoder.cpp encoder.h iot.cpp iot.h presence.cpp presence.h config_iot.h cJSON/cJSON.c cJSON/cJSON.h DFRobot_mmWave_Radar.cpp DFRobot_mmWave_Radar.h ) else() add_executable(${NAME} diff --git a/README.md b/README.md index 96a207c..dcf856d 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,13 @@ Only a single (right) side of the Pico is used for connections to allow for crea Pinout diagram is [here](./doc/pinout.png) or [from the back](./doc/pinout-back.png) (courtesy of [pinout.xyz](https://pico.pinout.xyz/)) +#### Using LD2410 sensor instead of DFRobot mmWave Radar + +Set `PRESENCE_UART_RX_PIN` and `PRESENCE_UART_TX_PIN` to `0` in `config.h` and connect the [LD2410](https://www.aliexpress.com/item/1005004351593073.html) sensor as such: + - `VCC` to `VSYS` (Pin 39) + - `GND` to any `GND` pin + - `OUT` to Pin 22 (see `PRESENCE_PIN`) + ## Usage ### TL;DR @@ -108,7 +115,6 @@ And the Pico SDK: ```bash git clone https://github.com/raspberrypi/pico-sdk cd pico-sdk -git checkout develop # Switch to develop branch git submodule update --init export PICO_SDK_PATH=`pwd` cd ../ diff --git a/mbedtls_util.c b/mbedtls_util.c deleted file mode 100644 index aa3f235..0000000 --- a/mbedtls_util.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "hardware/structs/rosc.h" -#include "pico/stdlib.h" - -/* cribbed from https://github.com/peterharperuk/pico-examples/tree/add_mbedtls_example */ -/* Function to feed mbedtls entropy. May be better to move it to pico-sdk */ -int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen) { - /* Code borrowed from pico_lwip_random_byte(), which is static, so we cannot call it directly */ - static uint8_t byte; - - for(size_t p=0; prandombit) ^ (byte & 0x80u ? 0x35u : 0); - // delay a little because the random bit is a little slow - busy_wait_at_least_cycles(30); - } - output[p] = byte; - } - - *olen = len; - return 0; -}