Skip to content

Commit 58230ee

Browse files
committed
feat(xiao): expose onboard BOOT0 user button
1 parent 619814b commit 58230ee

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎variants/STM32C5xx/C593C(E-G)(T-U)_C5A3CG(T-U)/variant_XIAO_STM32C5.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const PinName digitalPin[] = {
2727
PB_3, // Onboard IMU / I2C2_SCL
2828
PB_4, // Onboard IMU / I2C2_SDA
2929
PC_13, // Onboard IMU / INT1
30-
PA_8 // Onboard IMU heater / TIM1_CH1
30+
PA_8, // Onboard IMU heater / TIM1_CH1
31+
PH_2 // BOOT0 / user button (active low)
3132
};
3233

3334
const pin_size_t analogInputPin[] = {

‎variants/STM32C5xx/C593C(E-G)(T-U)_C5A3CG(T-U)/variant_XIAO_STM32C5.h‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,27 @@
2828
#define PIN_IMU_SDA 18 // PB4 / I2C2_SDA
2929
#define PIN_IMU_INT1 19 // PC13 / LSM6DS3TR-C INT1
3030
#define PIN_IMU_HEATER 20 // PA8 / TIM1_CH1
31+
#define PH2 21 // BOOT0 / user button
3132

3233
/* Alternate functions used by the default board peripherals. */
3334
#define PA9_ALT1 (PA9 | ALT1)
3435
#define PA10_ALT1 (PA10 | ALT1)
3536
#define PB15_ALT2 (PB15 | ALT2)
3637

37-
#define NUM_DIGITAL_PINS 21
38+
#define NUM_DIGITAL_PINS 22
3839
#define NUM_ANALOG_INPUTS 4
3940

4041
#ifndef LED_BUILTIN
4142
#define LED_BUILTIN PB12
4243
#endif
4344

45+
// On-board user button. The physical button is active low and is also
46+
// connected to the MCU BOOT0/PH2 pin.
47+
#define B1_BTN PH2
48+
#ifndef USER_BTN
49+
#define USER_BTN B1_BTN
50+
#endif
51+
4452
/* SPI3: D8/SCK (PE2), D9/MISO (PB0), D10/MOSI (PB15).
4553
* No board-default chip-select is assigned; sketches control device CS. */
4654
#define PIN_SPI_SS NUM_DIGITAL_PINS

0 commit comments

Comments
 (0)