From b3400a462daa7292075c9a3be3978f64dee56323 Mon Sep 17 00:00:00 2001 From: bendiabdallah Date: Mon, 16 Oct 2023 20:34:59 +0200 Subject: [PATCH] variants(U5): add Iot continuum devkit board Signed-off-by: bendiabdallah --- README.md | 7 + boards.txt | 87 ++++- .../PeripheralPins_DEVKIT_IOT_CONTINUUM.c | 299 ++++++++++++++++++ .../README_IOTCONTINUUM_DEVKIT.md | 47 +++ .../variant_DEVKIT_IOT_CONTINUUM.cpp | 126 ++++++++ .../variant_DEVKIT_IOT_CONTINUUM.h | 256 +++++++++++++++ 6 files changed, 821 insertions(+), 1 deletion(-) create mode 100644 variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/PeripheralPins_DEVKIT_IOT_CONTINUUM.c create mode 100644 variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/README_IOTCONTINUUM_DEVKIT.md create mode 100644 variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/variant_DEVKIT_IOT_CONTINUUM.cpp create mode 100644 variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/variant_DEVKIT_IOT_CONTINUUM.h diff --git a/README.md b/README.md index 5574a02bf6..f108692c8a 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d - [Electronic Speed Controller boards](#electronic-speed-controller-boards) - [Garatronic/McHobby boards](#garatronicmchobby-boards) - [Generic flight controllers](#generic-flight-controllers) + - [IoT continuum boards](#iot-continuum-boards) - [LoRa boards](#lora-boards) - [Midatronics boards](#midatronics-boards) - [SparkFun boards](#sparkfun-boards) @@ -774,6 +775,12 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d | :green_heart: | STM32F103CB | Afro Flight Rev5 (8/12MHz) | *1.7.0* | | | :green_heart: | STM32F303CC | [Sparky V1](https://github.com/TauLabs/TauLabs/wiki/Sparky) | *1.6.0* | | +### [IoT continuum](https://iotjourney.orange.com/fr-FR) boards + +| Status | Device(s) | Name | Release | Notes | +| :----: | :-------: | ---- | :-----: | :---- | +| :yellow_heart: | STM32U585CIU6 | [IoT continuum DevKit Board - STM32U585CIU6](https://iotjourney.orange.com/en/iotcontinuum/kits) | **2.7.0** | | + ### LoRa boards | Status | Device(s) | Name | Release | Notes | diff --git a/boards.txt b/boards.txt index c1ae04a83e..a6772f8989 100644 --- a/boards.txt +++ b/boards.txt @@ -10757,6 +10757,48 @@ GenFlight.menu.upload_method.dfuoMethod.upload.altID=1 GenFlight.menu.upload_method.dfuoMethod.build.flash_offset=0x5000 GenFlight.menu.upload_method.dfuoMethod.build.bootloader_flags=-DBL_LEGACY_LEAF +################################################################################ +# IoT continuum Boards + +IotContinuum.name=IoT continuum boards + +IotContinuum.build.core=arduino +IotContinuum.build.board=IOT_CONTINUUM +IotContinuum.build.variant_h=variant_{build.board}.h +IotContinuum.build.st_extra_flags=-D{build.product_line} {build.xSerial} +IotContinuum.build.flash_offset=0x0 +IotContinuum.upload.maximum_size=0 +IotContinuum.upload.maximum_data_size=0 + +# IoT continuum Dev Kit Board +IotContinuum.menu.pnum.DEVKIT_IOT_CONTINUUM=IoT continuum Dev Kit +IotContinuum.menu.pnum.DEVKIT_IOT_CONTINUUM.upload.maximum_size=2097152 +IotContinuum.menu.pnum.DEVKIT_IOT_CONTINUUM.upload.maximum_data_size=786432 +IotContinuum.menu.pnum.DEVKIT_IOT_CONTINUUM.build.mcu=cortex-m33 +IotContinuum.menu.pnum.DEVKIT_IOT_CONTINUUM.build.fpu=-mfpu=fpv4-sp-d16 +IotContinuum.menu.pnum.DEVKIT_IOT_CONTINUUM.build.float-abi=-mfloat-abi=hard +IotContinuum.menu.pnum.DEVKIT_IOT_CONTINUUM.build.board=DEVKIT_IOT_CONTINUUM +IotContinuum.menu.pnum.DEVKIT_IOT_CONTINUUM.build.series=STM32U5xx +IotContinuum.menu.pnum.DEVKIT_IOT_CONTINUUM.build.product_line=STM32U585xx +IotContinuum.menu.pnum.DEVKIT_IOT_CONTINUUM.build.variant=STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U) +IotContinuum.menu.pnum.DEVKIT_IOT_CONTINUUM.build.peripheral_pins=-DCUSTOM_PERIPHERAL_PINS + +# Upload menu +IotContinuum.menu.upload_method.swdMethod=STM32CubeProgrammer (SWD) +IotContinuum.menu.upload_method.swdMethod.upload.protocol=0 +IotContinuum.menu.upload_method.swdMethod.upload.options= +IotContinuum.menu.upload_method.swdMethod.upload.tool=stm32CubeProg + +IotContinuum.menu.upload_method.serialMethod=STM32CubeProgrammer (Serial) +IotContinuum.menu.upload_method.serialMethod.upload.protocol=1 +IotContinuum.menu.upload_method.serialMethod.upload.options={serial.port.file} +IotContinuum.menu.upload_method.serialMethod.upload.tool=stm32CubeProg + +IotContinuum.menu.upload_method.dfuMethod=STM32CubeProgrammer (DFU) +IotContinuum.menu.upload_method.dfuMethod.upload.protocol=2 +IotContinuum.menu.upload_method.dfuMethod.upload.options= +IotContinuum.menu.upload_method.dfuMethod.upload.tool=stm32CubeProg + ################################################################################ # LoRa boards @@ -10998,7 +11040,6 @@ SparkFun.menu.upload_method.dfuMethod.upload.protocol=2 SparkFun.menu.upload_method.dfuMethod.upload.options= SparkFun.menu.upload_method.dfuMethod.upload.tool=stm32CubeProg - ################################################################################ # Serialx activation Nucleo_144.menu.xserial.generic=Enabled (generic 'Serial') @@ -11189,6 +11230,12 @@ GenFlight.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_N GenFlight.menu.xserial.disabled=Disabled (no Serial support) GenFlight.menu.xserial.disabled.build.xSerial= +IotContinuum.menu.xserial.generic=Enabled (generic 'Serial') +IotContinuum.menu.xserial.none=Enabled (no generic 'Serial') +IotContinuum.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE +IotContinuum.menu.xserial.disabled=Disabled (no Serial support) +IotContinuum.menu.xserial.disabled.build.xSerial= + LoRa.menu.xserial.generic=Enabled (generic 'Serial') LoRa.menu.xserial.none=Enabled (no generic 'Serial') LoRa.menu.xserial.none.build.xSerial=-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE @@ -12157,6 +12204,26 @@ GenFlight.menu.opt.ogstd.build.flags.optimize=-Og GenFlight.menu.opt.o0std=No Optimization (-O0) GenFlight.menu.opt.o0std.build.flags.optimize=-O0 +IotContinuum.menu.opt.osstd=Smallest (-Os default) +IotContinuum.menu.opt.oslto=Smallest (-Os) with LTO +IotContinuum.menu.opt.oslto.build.flags.optimize=-Os -flto +IotContinuum.menu.opt.o1std=Fast (-O1) +IotContinuum.menu.opt.o1std.build.flags.optimize=-O1 +IotContinuum.menu.opt.o1lto=Fast (-O1) with LTO +IotContinuum.menu.opt.o1lto.build.flags.optimize=-O1 -flto +IotContinuum.menu.opt.o2std=Faster (-O2) +IotContinuum.menu.opt.o2std.build.flags.optimize=-O2 +IotContinuum.menu.opt.o2lto=Faster (-O2) with LTO +IotContinuum.menu.opt.o2lto.build.flags.optimize=-O2 -flto +IotContinuum.menu.opt.o3std=Fastest (-O3) +IotContinuum.menu.opt.o3std.build.flags.optimize=-O3 +IotContinuum.menu.opt.o3lto=Fastest (-O3) with LTO +IotContinuum.menu.opt.o3lto.build.flags.optimize=-O3 -flto +IotContinuum.menu.opt.ogstd=Debug (-Og) +IotContinuum.menu.opt.ogstd.build.flags.optimize=-Og +IotContinuum.menu.opt.o0std=No Optimization (-O0) +IotContinuum.menu.opt.o0std.build.flags.optimize=-O0 + LoRa.menu.opt.osstd=Smallest (-Os default) LoRa.menu.opt.oslto=Smallest (-Os) with LTO LoRa.menu.opt.oslto.build.flags.optimize=-Os -flto @@ -12446,6 +12513,14 @@ GenFlight.menu.dbg.enable_log.build.flags.debug= GenFlight.menu.dbg.enable_all=Core Logs and Symbols Enabled (-g) GenFlight.menu.dbg.enable_all.build.flags.debug=-g +IotContinuum.menu.dbg.none=None +IotContinuum.menu.dbg.enable_sym=Symbols Enabled (-g) +IotContinuum.menu.dbg.enable_sym.build.flags.debug=-g -DNDEBUG +IotContinuum.menu.dbg.enable_log=Core logs Enabled +IotContinuum.menu.dbg.enable_log.build.flags.debug= +IotContinuum.menu.dbg.enable_all=Core Logs and Symbols Enabled (-g) +IotContinuum.menu.dbg.enable_all.build.flags.debug=-g + LoRa.menu.dbg.none=None LoRa.menu.dbg.enable_sym=Symbols Enabled (-g) LoRa.menu.dbg.enable_sym.build.flags.debug=-g -DNDEBUG @@ -12771,6 +12846,16 @@ GenFlight.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs -u _printf_f GenFlight.menu.rtlib.full=Newlib Standard GenFlight.menu.rtlib.full.build.flags.ldspecs= +IotContinuum.menu.rtlib.nano=Newlib Nano (default) +IotContinuum.menu.rtlib.nanofp=Newlib Nano + Float Printf +IotContinuum.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs -u _printf_float +IotContinuum.menu.rtlib.nanofs=Newlib Nano + Float Scanf +IotContinuum.menu.rtlib.nanofs.build.flags.ldspecs=--specs=nano.specs -u _scanf_float +IotContinuum.menu.rtlib.nanofps=Newlib Nano + Float Printf/Scanf +IotContinuum.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs -u _printf_float -u _scanf_float +IotContinuum.menu.rtlib.full=Newlib Standard +IotContinuum.menu.rtlib.full.build.flags.ldspecs= + LoRa.menu.rtlib.nano=Newlib Nano (default) LoRa.menu.rtlib.nanofp=Newlib Nano + Float Printf LoRa.menu.rtlib.nanofp.build.flags.ldspecs=--specs=nano.specs -u _printf_float diff --git a/variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/PeripheralPins_DEVKIT_IOT_CONTINUUM.c b/variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/PeripheralPins_DEVKIT_IOT_CONTINUUM.c new file mode 100644 index 0000000000..18d049bfec --- /dev/null +++ b/variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/PeripheralPins_DEVKIT_IOT_CONTINUUM.c @@ -0,0 +1,299 @@ +/* + ******************************************************************************* + * Copyright (c) 2020, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +/* + * Automatically generated from STM32U575CGTx.xml, STM32U575CGUx.xml + * STM32U575CITx.xml, STM32U575CIUx.xml + * STM32U585CITx.xml, STM32U585CIUx.xml + * CubeMX DB release 6.0.90 + */ +#if defined(ARDUINO_DEVKIT_IOT_CONTINUUM) +#include "Arduino.h" +#include "PeripheralPins.h" + +/* ===== + * Notes: + * - The pins mentioned Px_y_ALTz are alternative possibilities which use other + * HW peripheral instances. You can use them the same way as any other "normal" + * pin (i.e. analogWrite(PA7_ALT1, 128);). + * + * - Commented lines are alternative possibilities which are not used per default. + * If you change them, you will have to know what you do + * ===== + */ + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +WEAK const PinMap PinMap_ADC[] = { + {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5 + {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6 + {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9 + {PA_4_ALT1, ADC4, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC4_IN9 + {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11 + {PA_6_ALT1, ADC4, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC4_IN11 + {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15 + {PB_0_ALT1, ADC4, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC4_IN18 + {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_IN16 + {PB_1_ALT1, ADC4, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC4_IN19 + {PB_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC1_IN17 + {NC, NP, 0} +}; +#endif + +//*** DAC *** + +#ifdef HAL_DAC_MODULE_ENABLED +WEAK const PinMap PinMap_DAC[] = { + {PA_4, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC1_OUT1 + {PA_5, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC1_OUT2 + {NC, NP, 0} +}; +#endif + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SDA[] = { + {PB_7, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF5_I2C4)}, + {PB_14, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SCL[] = { + {PB_6, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF5_I2C4)}, + {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PB_13, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {NC, NP, 0} +}; +#endif + +//*** No I3C *** + +//*** TIM *** + +#ifdef HAL_TIM_MODULE_ENABLED +WEAK const PinMap PinMap_TIM[] = { + {PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_0_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PA_1_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + {PA_1_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM15, 1, 1)}, // TIM15_CH1N + {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PA_2_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 + {PA_2_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM15, 1, 0)}, // TIM15_CH1 + {PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PA_3_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 + {PA_3_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM15, 2, 0)}, // TIM15_CH2 + {PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PA_6_ALT1, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM16, 1, 0)}, // TIM16_CH1 + {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_0_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PB_0_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_1_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PB_1_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + {PB_2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 1)}, // TIM8_CH4N + {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PB_13_ALT1, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM15, 1, 1)}, // TIM15_CH1N + {PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_14_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + {PB_14_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM15, 1, 0)}, // TIM15_CH1 + {PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_15_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + {PB_15_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM15, 2, 0)}, // TIM15_CH2 + {NC, NP, 0} +}; +#endif + +//*** UART *** + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_TX[] = { + {PA_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PA_2, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, + {PA_7, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RX[] = { + {PA_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PA_3, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, + {PA_5, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_10, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RTS[] = { + {PB_1, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, + {PB_1_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_3, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_CTS[] = { + {PA_6, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, + {PA_6_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_4, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_7, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_13, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, + {PB_13_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MOSI[] = { + {PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_5_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MISO[] = { + {PA_11, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_SCLK[] = { + {PA_1, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_3_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_SSEL[] = { + {PB_0, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {NC, NP, 0} +}; +#endif + +//*** FDCAN *** + +#ifdef HAL_FDCAN_MODULE_ENABLED +WEAK const PinMap PinMap_CAN_RD[] = { + {PA_11, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_8, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_FDCAN_MODULE_ENABLED +WEAK const PinMap PinMap_CAN_TD[] = { + {PA_12, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_9, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {NC, NP, 0} +}; +#endif + +//*** No ETHERNET *** + +//*** OCTOSPI *** + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA0[] = { + {PB_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPI1)}, // OCTOSPIM_P1_IO0 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA1[] = { + {PB_0, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPI1)}, // OCTOSPIM_P1_IO1 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA2[] = { + {PA_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPI1)}, // OCTOSPIM_P1_IO2 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA3[] = { + {PA_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPI1)}, // OCTOSPIM_P1_IO3 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_SCLK[] = { + {PA_3, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPI1)}, // OCTOSPIM_P1_CLK + {PB_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPI1)}, // OCTOSPIM_P1_CLK + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_SSEL[] = { + {PA_0, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPI2)}, // OCTOSPIM_P2_NCS + {PA_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPI1)}, // OCTOSPIM_P1_NCS + {PA_4, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_OCTOSPI1)}, // OCTOSPIM_P1_NCS + {PA_12, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPI2)}, // OCTOSPIM_P2_NCS + {NC, NP, 0} +}; +#endif + +//*** USB *** + +#if defined(HAL_PCD_MODULE_ENABLED) || defined(HAL_HCD_MODULE_ENABLED) +WEAK const PinMap PinMap_USB_OTG_FS[] = { + {PA_8, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_USB)}, // USB_OTG_FS_SOF + {PA_9, USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS + {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_USB)}, // USB_OTG_FS_ID + {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_USB)}, // USB_OTG_FS_DM + {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_USB)}, // USB_OTG_FS_DP + {PA_13, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_USB)}, // USB_OTG_FS_NOE + {PA_14, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_USB)}, // USB_OTG_FS_SOF + {NC, NP, 0} +}; +#endif + +//*** No SD *** + +#endif /* ARDUINO_DEVKIT_IOT_CONTINUUM */ diff --git a/variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/README_IOTCONTINUUM_DEVKIT.md b/variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/README_IOTCONTINUUM_DEVKIT.md new file mode 100644 index 0000000000..8025fcb3dc --- /dev/null +++ b/variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/README_IOTCONTINUUM_DEVKIT.md @@ -0,0 +1,47 @@ +## Pinout + + +### Outer PINs + +| I/O Pins | Arduino | STM32U585 | +| --- | --- | --- | +| 13 | IO13 | GPIO6 Expander | +| 12 | D12 | PB13 | +| 11 | D11 | PA11 | +| 10 | D10 | PA8 | +| 9 | D9 | PB15 | +| 6 | D6 | PB14 | +| 5 | D5 | PB10 | +| 4 | IO4 | GPIO1 Expander | +| SCL | D17 | PB6 | +| SDA | D18 | PB7 | +| RX/D1 | D1 | PA3 | +| TX/D0 | D0 | PA2 | +| A0 | A0/D2 | PA0 | +| A1 | A1/D3 | PA1 | +| A2 | A2/D4 | PA6 | +| A3 | A3/D7 | PB0 | +| A4 | A4/D8 | PB1 | +| A5 | A5/D13 | PB2 | +| SCK | D14 | PB3 | +| MISO | D15 | PB4 | +| MOSI | D16 | PB5 | + +### Inner PINs + +| I/O Pins | Arduino | STM32U585 | Comment | +| --- | --- | --- | --- | +| BAT_LEVEL | BAT_LEVEL | PA4 | Battery level | +| USB_UART_RX | PIN_SERIAL_RX | PA5 | RX to USB | +| USB_UART_TX | PIN_SERIAL_TX | PA7 | TX to USB | +| MODULE_TX | PIN_SERIAL3_TX | PA9 | TX to HL7812 | +| MODULE_RX | PIN_SERIAL3_RX | PA10 | RX to HL7812 | +| BUTTON | USER_BTN | PA12 | Push button status | +| SWDIO | NC | PA13 | J-TAG Programming | +| SWCLK | NC | PA14 | J-TAG Programming | +| WAKE_UP | WAKE_UP_HL7812 | PA15 | Module wake up on sleep | +| VGPIO | VGPIO | PC13 | Module state (active/on sleep) | +| SEL_MODE_UART | SWITCH_TO_HL7812 | PB8 | UART mode activation (STM32 or HL7812) | +| RESET MODULE | RESET_HL7812 | PB12 | Module Reset | +| INT2_ACCEL | INT_ACCEL | PB9 | LSM6DSOX interrupt state | +| LED RGB | RED_LED, GREEN_LED, BLUE_LED | NC | Led R=GPIO3, G=GPIO4, B=GPIO5 Expander | diff --git a/variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/variant_DEVKIT_IOT_CONTINUUM.cpp b/variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/variant_DEVKIT_IOT_CONTINUUM.cpp new file mode 100644 index 0000000000..252e5db632 --- /dev/null +++ b/variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/variant_DEVKIT_IOT_CONTINUUM.cpp @@ -0,0 +1,126 @@ +/* + ******************************************************************************* + * Copyright (c) 2023, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +#if defined(ARDUINO_DEVKIT_IOT_CONTINUUM) +#include "pins_arduino.h" + +// Digital PinName array +const PinName digitalPin[] = { + PA_2, // D0/TX + PA_3, // D1/RX + PA_0, // D2/A0 + PA_1, // D3/A1 + PA_6, // D4/A2 + PB_10, // D5 + PB_14, // D6 + PB_0, // D7/A3 + PB_1, // D8/A4 + PB_15, // D9 + PA_8, // D10 + PA_11, // D11 + PB_13, // D12 + PB_2, // D13/A5 + PB_3, // D14/SCK + PB_4, // D15/MISO + PB_5, // D16/MOSI + PB_6, // D17/SCL + PB_7, // D18/SDA + PA_4, // D19/A6 + PA_5, // D20 + PA_7, // D21 + PA_9, // D22 + PA_10, // D23 + PA_12, // D24 + PA_13, // D25 + PA_14, // D26 + PA_15, // D27 + PB_8, // D28 + PB_9, // D29 + PB_12, // D30 + PC_13, // D31 + PC_14, // D32 + PC_15, // D33 + PH_0, // D34 + PH_1, // D35 + PH_3 // D36 +}; + +// Analog (Ax) pin number array +const uint32_t analogInputPin[] = { + 2, // A0, PA0 + 3, // A1, PA1 + 4, // A2, PA6 + 7, // A3, PB0 + 8, // A4, PB1 + 13, // A5, PB2 + 19 // A6, PA4 +}; + +/** System Clock Configuration +*/ +WEAK void SystemClock_Config(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct = {}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {}; + RCC_PeriphCLKInitTypeDef PeriphClkInit = {}; + + /** Configure the main internal regulator output voltage + */ + if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) { + Error_Handler(); + } + /** Configure LSE Drive Capability + */ + HAL_PWR_EnableBkUpAccess(); + __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW); + /** Initializes the CPU, AHB and APB busses clocks + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; + RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + RCC_OscInitStruct.PLL.PLLMBOOST = RCC_PLLMBOOST_DIV1; + RCC_OscInitStruct.PLL.PLLM = 1; + RCC_OscInitStruct.PLL.PLLN = 10; + RCC_OscInitStruct.PLL.PLLP = 2; + RCC_OscInitStruct.PLL.PLLQ = 2; + RCC_OscInitStruct.PLL.PLLR = 1; + RCC_OscInitStruct.PLL.PLLRGE = RCC_PLLVCIRANGE_1; + RCC_OscInitStruct.PLL.PLLFRACN = 0; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { + Error_Handler(); + } + + /** Initializes the CPU, AHB and APB buses clocks + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK + | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 + | RCC_CLOCKTYPE_PCLK3; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; + RCC_ClkInitStruct.APB3CLKDivider = RCC_HCLK_DIV1; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) { + Error_Handler(); + } + + PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_LPUART1; + PeriphClkInit.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_HSI; + if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { + Error_Handler(); + } +} + +#endif /* ARDUINO_DEVKIT_IOT_CONTINUUM */ diff --git a/variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/variant_DEVKIT_IOT_CONTINUUM.h b/variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/variant_DEVKIT_IOT_CONTINUUM.h new file mode 100644 index 0000000000..b6782b2dd0 --- /dev/null +++ b/variants/STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)/variant_DEVKIT_IOT_CONTINUUM.h @@ -0,0 +1,256 @@ +/* + ******************************************************************************* + * Copyright (c) 2023, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +#pragma once +/*---------------------------------------------------------------------------- + * STM32 pins number + *----------------------------------------------------------------------------*/ +#define PA2 0 +#define PA3 1 +#define PA0 PIN_A0 +#define PA1 PIN_A1 +#define PA6 PIN_A2 +#define PB10 5 +#define PB14 6 +#define PB0 PIN_A3 +#define PB1 PIN_A4 +#define PB15 9 +#define PA8 10 +#define PA11 11 +#define PB13 12 +#define PB2 PIN_A5 +#define PB3 14 +#define PB4 15 +#define PB5 16 +#define PB6 17 +#define PB7 18 +#define PA4 PIN_A6 +#define PA5 20 +#define PA7 21 +#define PA9 22 +#define PA10 23 +#define PA12 24 +#define PA13 25 +#define PA14 26 +#define PA15 27 +#define PB8 28 +#define PB9 29 +#define PB12 30 +#define PC13 31 +#define PC14 32 +#define PC15 33 +#define PH0 34 +#define PH1 35 +#define PH3 36 + +// Alternate pins number +#define PA0_ALT1 (PA0 | ALT1) +#define PA1_ALT1 (PA1 | ALT1) +#define PA1_ALT2 (PA1 | ALT2) +#define PA2_ALT1 (PA2 | ALT1) +#define PA2_ALT2 (PA2 | ALT2) +#define PA3_ALT1 (PA3 | ALT1) +#define PA3_ALT2 (PA3 | ALT2) +#define PA4_ALT1 (PA4 | ALT1) +#define PA5_ALT1 (PA5 | ALT1) +#define PA6_ALT1 (PA6 | ALT1) +#define PA7_ALT1 (PA7 | ALT1) +#define PA7_ALT2 (PA7 | ALT2) +#define PA7_ALT3 (PA7 | ALT3) +#define PA15_ALT1 (PA15 | ALT1) +#define PB0_ALT1 (PB0 | ALT1) +#define PB0_ALT2 (PB0 | ALT2) +#define PB1_ALT1 (PB1 | ALT1) +#define PB1_ALT2 (PB1 | ALT2) +#define PB3_ALT1 (PB3 | ALT1) +#define PB4_ALT1 (PB4 | ALT1) +#define PB5_ALT1 (PB5 | ALT1) +#define PB6_ALT1 (PB6 | ALT1) +#define PB7_ALT1 (PB7 | ALT1) +#define PB8_ALT1 (PB8 | ALT1) +#define PB9_ALT1 (PB9 | ALT1) +#define PB10_ALT1 (PB10 | ALT1) +#define PB13_ALT1 (PB13 | ALT1) +#define PB14_ALT1 (PB14 | ALT1) +#define PB14_ALT2 (PB14 | ALT2) +#define PB15_ALT1 (PB15 | ALT1) +#define PB15_ALT2 (PB15 | ALT2) + +#define NUM_DIGITAL_PINS 37 +#define NUM_ANALOG_INPUTS 7 + +// User button +#ifndef USER_BTN + #define USER_BTN PA12 +#endif + +// Switch to HL7812 +#ifndef SWITCH_TO_HL7812 + #define SWITCH_TO_HL7812 PB8 +#endif + +// WAKE UP HL721 +#ifndef WAKE_UP_HL7812 + #define WAKE_UP_HL7812 PA15 +#endif + +// Battery level +#ifndef BAT_LEVEL + #define BAT_LEVEL PA4 +#endif + +// Accelerator interrupt +#ifndef INT_ACCEL + #define INT_ACCEL PB9 +#endif + +// reset HL7812 +#ifndef RESET_HL7812 + #define RESET_HL7812 PB12 +#endif + +// VGPIO_SHIFT +#ifndef VGPIO + #define VGPIO PC13 +#endif + +#ifndef PIN_SPI_MOSI + #define PIN_SPI_MOSI PB5 +#endif +#ifndef PIN_SPI_MISO + #define PIN_SPI_MISO PB4 +#endif +#ifndef PIN_SPI_SCK + #define PIN_SPI_SCK PB3 +#endif + +// GPIO Expander (warning: not a pin number) +#ifndef RED_LED + #define RED_LED 3 +#endif + +#ifndef GREEN_LED + #define GREEN_LED 4 +#endif + +#ifndef BLUE_LED + #define BLUE_LED 5 +#endif + +#ifndef IO4 + #define IO4 1 +#endif + +#ifndef IO13 + #define IO13 6 +#endif + +// I2C definitions +#ifndef PIN_WIRE_SDA + #define PIN_WIRE_SDA PB7 +#endif +#ifndef PIN_WIRE_SCL + #define PIN_WIRE_SCL PB6 +#endif + +// Timer Definitions +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin +#ifndef TIMER_TONE + #define TIMER_TONE TIM6 +#endif +#ifndef TIMER_SERVO + #define TIMER_SERVO TIM7 +#endif + +// UART Definitions +#ifndef SERIAL_UART_INSTANCE + #define SERIAL_UART_INSTANCE 3 +#endif + +// Default pin used for generic 'Serial' instance +// Mandatory for Firmata +#ifndef PIN_SERIAL_RX + #define PIN_SERIAL_RX PA5 +#endif +#ifndef PIN_SERIAL_TX + #define PIN_SERIAL_TX PA7 +#endif + +#ifndef PIN_SERIALLP1_RX + #define PIN_SERIALLP1_RX PA3 +#endif +#ifndef PIN_SERIALLP1_TX + #define PIN_SERIALLP1_TX PA2 +#endif + +#ifndef PIN_SERIAL3_RX + #define PIN_SERIAL3_RX PA10 +#endif +#ifndef PIN_SERIAL3_TX + #define PIN_SERIAL3_TX PA9 +#endif + +// Timer Definitions +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin +#ifndef TIMER_TONE + #define TIMER_TONE TIM6 +#endif +#ifndef TIMER_SERVO + #define TIMER_SERVO TIM7 +#endif + +// Extra HAL modules +// #if !defined(HAL_DAC_MODULE_DISABLED) +// #define HAL_DAC_MODULE_ENABLED +// #endif +// #if !defined(HAL_OSPI_MODULE_DISABLED) +// #define HAL_OSPI_MODULE_ENABLED +// #endif + +// Alternate SYS_WKUP definition +#define PWR_WAKEUP_PIN1_1 +#define PWR_WAKEUP_PIN2_1 +#define PWR_WAKEUP_PIN3_1 +#define PWR_WAKEUP_PIN4_1 +#define PWR_WAKEUP_PIN4_2 +#define PWR_WAKEUP_PIN5_1 +#define PWR_WAKEUP_PIN6_1 +#define PWR_WAKEUP_PIN7_1 +#define PWR_WAKEUP_PIN8_1 + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + // These serial port names are intended to allow libraries and architecture-neutral + // sketches to automatically default to the correct port name for a particular type + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, + // the first hardware serial port whose RX/TX pins are not dedicated to another use. + // + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor + // + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial + // + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library + // + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. + // + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX + // pins are NOT connected to anything by default. + #ifndef SERIAL_PORT_MONITOR + #define SERIAL_PORT_MONITOR Serial + #endif + #ifndef SERIAL_PORT_HARDWARE + #define SERIAL_PORT_HARDWARE Serial + #endif +#endif