ESP: first implementation; compiles fine; not tested with MCU
This commit is contained in:
1 parent
5bdcb51bff
commit
6bda641ce8
36 files changed
+6234
No files matched your search
@@ -0,0 +1,131 @@
|
||||
// board_pins.h — single place where physical wiring is declared.
|
||||
//
|
||||
// Hardware is not in hand yet, so every free-pin assignment here is a default
|
||||
// that can be overridden with a -D build flag without touching source. The
|
||||
// camera pins are fixed by the XIAO ESP32S3 Sense expansion board and are not
|
||||
// overridable; they are listed so the wiring is documented in one place.
|
||||
#pragma once
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// XIAO ESP32S3 Sense — OV2640 on the expansion board. Fixed by the PCB.
|
||||
// ---------------------------------------------------------------------------
|
||||
#define CAM_PIN_PWDN -1
|
||||
#define CAM_PIN_RESET -1
|
||||
#define CAM_PIN_XCLK 10
|
||||
#define CAM_PIN_SIOD 40 // SCCB SDA
|
||||
#define CAM_PIN_SIOC 39 // SCCB SCL
|
||||
#define CAM_PIN_D7 48
|
||||
#define CAM_PIN_D6 11
|
||||
#define CAM_PIN_D5 12
|
||||
#define CAM_PIN_D4 14
|
||||
#define CAM_PIN_D3 16
|
||||
#define CAM_PIN_D2 18
|
||||
#define CAM_PIN_D1 17
|
||||
#define CAM_PIN_D0 15
|
||||
#define CAM_PIN_VSYNC 38
|
||||
#define CAM_PIN_HREF 47
|
||||
#define CAM_PIN_PCLK 13
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// HLK-LD2410 24 GHz radar
|
||||
//
|
||||
// Wiring (module -> XIAO):
|
||||
// VCC -> 5V (plain LD2410, no Bluetooth)
|
||||
// GND -> GND
|
||||
// TX -> D1 / GPIO2 (ESP RX)
|
||||
// RX -> D0 / GPIO1 (ESP TX)
|
||||
// OUT -> D2 / GPIO3 (presence, active HIGH; RTC-capable so it can also
|
||||
// serve as a deep-sleep wake source later)
|
||||
//
|
||||
// MEASURE THE LOGIC LEVELS BEFORE CONNECTING. The LD2410's logic is supposed
|
||||
// to be 3.3 V even when VCC is 5 V (it regulates internally), but this varies
|
||||
// between batches and clones, and the ESP32-S3 is not 5 V tolerant. A 5 V OUT
|
||||
// into GPIO3 damages the pin, and on a camera you cannot physically reach
|
||||
// that is an expensive way to find out.
|
||||
//
|
||||
// Two minutes with a multimeter on OUT and TX (wave a hand in front of the
|
||||
// module so OUT asserts) settles it. If either reads ~5 V, drop it with a
|
||||
// divider -- 10k from the module into the GPIO, 20k from the GPIO to GND
|
||||
// gives 3.3 V from 5 V. The ESP's TX into the module's RX needs nothing:
|
||||
// 3.3 V comfortably clears the module's input threshold.
|
||||
//
|
||||
// Baud rate is autodetected (see radarBegin), so a module at the factory
|
||||
// 256000 and one reconfigured to 115200 both just work, and a factory reset
|
||||
// does not take the trigger offline.
|
||||
//
|
||||
// Deliberately NOT on D6/D7 (GPIO43/44): those are UART0, which the ROM
|
||||
// bootloader spews boot logs onto at every reset. Harmless for the radar, but
|
||||
// it costs you the one easy hardware debug port. Keep 43/44 free.
|
||||
// ---------------------------------------------------------------------------
|
||||
#ifndef PIN_RADAR_TX
|
||||
#define PIN_RADAR_TX 1 // D0 — ESP transmits, goes to LD2410 RX
|
||||
#endif
|
||||
#ifndef PIN_RADAR_RX
|
||||
#define PIN_RADAR_RX 2 // D1 — ESP receives, comes from LD2410 TX
|
||||
#endif
|
||||
#ifndef PIN_RADAR_OUT
|
||||
#define PIN_RADAR_OUT 3 // D2 — presence output
|
||||
#endif
|
||||
#ifndef RADAR_UART_NUM
|
||||
#define RADAR_UART_NUM 1 // UART1 via the GPIO matrix
|
||||
#endif
|
||||
#ifndef RADAR_BAUD
|
||||
#define RADAR_BAUD 256000 // LD2410 factory default
|
||||
#endif
|
||||
|
||||
// Optional high-side MOSFET gating the radar's supply. -1 = permanently powered.
|
||||
// Only worth wiring if you run deep sleep with sleep_wake_on_radar = false:
|
||||
// the LD2410 draws ~80 mA continuously, which dwarfs anything the ESP saves by
|
||||
// sleeping. See the note at the top of power_mgr.h.
|
||||
#ifndef PIN_RADAR_EN
|
||||
#define PIN_RADAR_EN -1
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Spare I/O — reserved, nothing wired yet.
|
||||
// ---------------------------------------------------------------------------
|
||||
#ifndef PIN_AUX_ADC
|
||||
#define PIN_AUX_ADC 4 // D3 / A3 — spare ADC, or a PIR fallback
|
||||
#endif
|
||||
#ifndef PIN_I2C_SDA
|
||||
#define PIN_I2C_SDA 5 // D4 — future BME280 / DS3231
|
||||
#endif
|
||||
#ifndef PIN_I2C_SCL
|
||||
#define PIN_I2C_SCL 6 // D5
|
||||
#endif
|
||||
|
||||
// Battery / supply sensing. Defaults to the spare ADC pin above. The XIAO
|
||||
// does not expose its battery rail on a readable pin, so this needs an
|
||||
// external divider — see the wiring diagram at the top of battery.h.
|
||||
// Set to -1 to disable; voltage then reports as invalid rather than as zero.
|
||||
#ifndef PIN_BATTERY_ADC
|
||||
#define PIN_BATTERY_ADC PIN_AUX_ADC
|
||||
#endif
|
||||
|
||||
// Optional MOSFET on the divider's low side, so it only draws current during
|
||||
// a measurement (SPEC §9). -1 = divider permanently connected.
|
||||
#ifndef PIN_BATTERY_EN
|
||||
#define PIN_BATTERY_EN -1
|
||||
#endif
|
||||
|
||||
// Nightlight / illuminator, PWM driven. -1 = not fitted.
|
||||
// Drive a MOSFET or a constant-current module, never the LED directly: an
|
||||
// ESP32 pin is good for ~20 mA short-term and an illuminator worth having
|
||||
// draws far more. Read the warning at the top of nightlight.h before choosing
|
||||
// between IR and white.
|
||||
#ifndef PIN_NIGHTLIGHT
|
||||
#define PIN_NIGHTLIGHT -1
|
||||
#endif
|
||||
|
||||
// D8/D9/D10 (GPIO7/8/9) are the Sense board's microSD (SD_MMC 1-bit:
|
||||
// CLK=7, D0=8, CMD=9). Leave them alone if you ever want local buffering.
|
||||
|
||||
// Onboard user LED. Active LOW on the XIAO ESP32S3.
|
||||
// NOTE: verify against your board revision before trusting it — Seeed has
|
||||
// moved this pin between revisions.
|
||||
#ifndef PIN_STATUS_LED
|
||||
#define PIN_STATUS_LED 21
|
||||
#endif
|
||||
#ifndef STATUS_LED_ACTIVE_LOW
|
||||
#define STATUS_LED_ACTIVE_LOW 1
|
||||
#endif
|
||||
Reference in new issue
Block a user