diff --git a/README.md b/README.md index cfcbec4872..4ffff91d5f 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d | :green_heart: | STM32F407VG | [STM32F407G-DISC1](http://www.st.com/en/evaluation-tools/stm32f4discovery.html) | *0.1.0* | | | :yellow_heart: | STM32F411VE | [STM32F411E-DISCO](https://www.st.com/en/evaluation-tools/32f411ediscovery.html) | **2.12.0** | | | :green_heart: | STM32F413ZH | [32F413HDISCOVERY](https://www.st.com/en/evaluation-tools/32f413hdiscovery.html) | *1.9.0* | | +| :yellow_heart: | STM32F429I | [STM32F429I-DISC1](https://www.st.com/en/evaluation-tools/32f429idiscovery.html) | **2.12.0** | | | :green_heart: | STM32F746NG | [STM32F746G-DISCOVERY](http://www.st.com/en/evaluation-tools/32f746gdiscovery.html) | *0.1.0* | | | :green_heart: | STM32G031J6 | [STM32G0316-DISCO](https://www.st.com/en/evaluation-tools/stm32g0316-disco.html) | *1.9.0* | | | :green_heart: | STM32G431CB | [B-G431B-ESC1](https://www.st.com/en/evaluation-tools/b-g431b-esc1.html) | *2.0.0* | | diff --git a/boards.txt b/boards.txt index 3d40c56814..f1ee51d609 100644 --- a/boards.txt +++ b/boards.txt @@ -1505,6 +1505,22 @@ Disco.menu.pnum.DISCO_F413ZH.build.peripheral_pins=-DCUSTOM_PERIPHERAL_PINS Disco.menu.pnum.DISCO_F413ZH.openocd.target=stm32f4x Disco.menu.pnum.DISCO_F413ZH.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32F4xx/STM32F413.svd +# DISCO_F429ZI board +Disco.menu.pnum.DISCO_F429ZI= STM32F429ZI-DISCO +Disco.menu.pnum.DISCO_F429ZI.node=DIS_F429ZI +Disco.menu.pnum.DISCO_F429ZI.upload.maximum_size=2097152 +Disco.menu.pnum.DISCO_F429ZI.upload.maximum_data_size=196608 +Disco.menu.pnum.DISCO_F429ZI.build.mcu=cortex-m4 +Disco.menu.pnum.DISCO_F429ZI.build.fpu=-mfpu=fpv4-sp-d16 +Disco.menu.pnum.DISCO_F429ZI.build.float-abi=-mfloat-abi=hard +Disco.menu.pnum.DISCO_F429ZI.build.board=DISCO_F429ZI +Disco.menu.pnum.DISCO_F429ZI.build.series=STM32F4xx +Disco.menu.pnum.DISCO_F429ZI.build.product_line=STM32F429xx +Disco.menu.pnum.DISCO_F429ZI.build.variant=STM32F4xx/F427Z(G-I)T_F429ZET_F429Z(G-I)(T-Y)_F437Z(G-I)T_F439Z(G-I)(T-Y) +Disco.menu.pnum.DISCO_F429ZI.build.variant_h=variant_DISCO_F429ZI.h +Disco.menu.pnum.DISCO_F429ZI.openocd.target=stm32f4x +Disco.menu.pnum.DISCO_F429ZI.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32F4xx/STM32F429.svd + # DISCO_F746NG board Disco.menu.pnum.DISCO_F746NG=STM32F746G-DISCOVERY Disco.menu.pnum.DISCO_F746NG.node=DIS_F746NG diff --git a/cmake/boards_db.cmake b/cmake/boards_db.cmake index da2276e944..2837f663ce 100644 --- a/cmake/boards_db.cmake +++ b/cmake/boards_db.cmake @@ -5704,6 +5704,88 @@ target_compile_options(DISCO_F413ZH_xusb_HSFS INTERFACE "SHELL:-DUSE_USB_HS -DUSE_USB_HS_IN_FS" ) +# DISCO_F429ZI +# ----------------------------------------------------------------------------- + +set(DISCO_F429ZI_VARIANT_PATH "${CMAKE_CURRENT_LIST_DIR}/../variants/STM32F4xx/F427Z(G-I)T_F429ZET_F429Z(G-I)(T-Y)_F437Z(G-I)T_F439Z(G-I)(T-Y)") +set(DISCO_F429ZI_MAXSIZE 2097152) +set(DISCO_F429ZI_MAXDATASIZE 196608) +set(DISCO_F429ZI_MCU cortex-m4) +set(DISCO_F429ZI_FPCONF "fpv4-sp-d16-hard") +add_library(DISCO_F429ZI INTERFACE) +target_compile_options(DISCO_F429ZI INTERFACE + "SHELL:-DSTM32F429xx" + "SHELL:" + "SHELL:" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${DISCO_F429ZI_MCU} +) +target_compile_definitions(DISCO_F429ZI INTERFACE + "STM32F4xx" + "ARDUINO_DISCO_F429ZI" + "BOARD_NAME=\"DISCO_F429ZI\"" + "BOARD_ID=DISCO_F429ZI" + "VARIANT_H=\"variant_DISCO_F429ZI.h\"" +) +target_include_directories(DISCO_F429ZI INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../system/STM32F4xx + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32F4xx_HAL_Driver/Inc + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32F4xx_HAL_Driver/Src + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32F4xx/Include/ + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/ + ${DISCO_F429ZI_VARIANT_PATH} +) + +target_link_options(DISCO_F429ZI INTERFACE + "LINKER:--default-script=${DISCO_F429ZI_VARIANT_PATH}/ldscript.ld" + "LINKER:--defsym=LD_FLASH_OFFSET=0x0" + "LINKER:--defsym=LD_MAX_SIZE=2097152" + "LINKER:--defsym=LD_MAX_DATA_SIZE=196608" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${DISCO_F429ZI_MCU} +) + +add_library(DISCO_F429ZI_serial_disabled INTERFACE) +target_compile_options(DISCO_F429ZI_serial_disabled INTERFACE + "SHELL:" +) +add_library(DISCO_F429ZI_serial_generic INTERFACE) +target_compile_options(DISCO_F429ZI_serial_generic INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED" +) +add_library(DISCO_F429ZI_serial_none INTERFACE) +target_compile_options(DISCO_F429ZI_serial_none INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE" +) +add_library(DISCO_F429ZI_usb_CDC INTERFACE) +target_compile_options(DISCO_F429ZI_usb_CDC INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0x0483 -DUSBD_PID=0x5740 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB" +) +add_library(DISCO_F429ZI_usb_CDCgen INTERFACE) +target_compile_options(DISCO_F429ZI_usb_CDCgen INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0x0483 -DUSBD_PID=0x5740 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC" +) +add_library(DISCO_F429ZI_usb_HID INTERFACE) +target_compile_options(DISCO_F429ZI_usb_HID INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0x0483 -DUSBD_PID=0x5740 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_HID_COMPOSITE" +) +add_library(DISCO_F429ZI_usb_none INTERFACE) +target_compile_options(DISCO_F429ZI_usb_none INTERFACE + "SHELL:" +) +add_library(DISCO_F429ZI_xusb_FS INTERFACE) +target_compile_options(DISCO_F429ZI_xusb_FS INTERFACE + "SHELL:" +) +add_library(DISCO_F429ZI_xusb_HS INTERFACE) +target_compile_options(DISCO_F429ZI_xusb_HS INTERFACE + "SHELL:-DUSE_USB_HS" +) +add_library(DISCO_F429ZI_xusb_HSFS INTERFACE) +target_compile_options(DISCO_F429ZI_xusb_HSFS INTERFACE + "SHELL:-DUSE_USB_HS -DUSE_USB_HS_IN_FS" +) + # DISCO_F746NG # ----------------------------------------------------------------------------- diff --git a/variants/STM32F3xx/F303R(6-8)T_F334R(6-8)T/variant_NUCLEO_F334R8.cpp b/variants/STM32F3xx/F303R(6-8)T_F334R(6-8)T/variant_NUCLEO_F334R8.cpp index e25a0757ad..b2de9c5f07 100644 --- a/variants/STM32F3xx/F303R(6-8)T_F334R(6-8)T/variant_NUCLEO_F334R8.cpp +++ b/variants/STM32F3xx/F303R(6-8)T_F334R(6-8)T/variant_NUCLEO_F334R8.cpp @@ -112,9 +112,9 @@ extern "C" { */ WEAK void SystemClock_Config(void) { - RCC_OscInitTypeDef RCC_OscInitStruct = {0}; - RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; + RCC_OscInitTypeDef RCC_OscInitStruct = {}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {}; + RCC_PeriphCLKInitTypeDef PeriphClkInit = {}; /** Initializes the RCC Oscillators according to the specified parameters * in the RCC_OscInitTypeDef structure. @@ -153,4 +153,4 @@ WEAK void SystemClock_Config(void) } #endif -#endif /* ARDUINO_NUCLEO_F303RE */ +#endif /* ARDUINO_NUCLEO_F303RE */ \ No newline at end of file diff --git a/variants/STM32F4xx/F427Z(G-I)T_F429ZET_F429Z(G-I)(T-Y)_F437Z(G-I)T_F439Z(G-I)(T-Y)/CMakeLists.txt b/variants/STM32F4xx/F427Z(G-I)T_F429ZET_F429Z(G-I)(T-Y)_F437Z(G-I)T_F439Z(G-I)(T-Y)/CMakeLists.txt index 3c0d9e8d62..db82032488 100644 --- a/variants/STM32F4xx/F427Z(G-I)T_F429ZET_F429Z(G-I)(T-Y)_F437Z(G-I)T_F439Z(G-I)(T-Y)/CMakeLists.txt +++ b/variants/STM32F4xx/F427Z(G-I)T_F429ZET_F429Z(G-I)(T-Y)_F437Z(G-I)T_F439Z(G-I)(T-Y)/CMakeLists.txt @@ -22,6 +22,7 @@ add_library(variant_bin STATIC EXCLUDE_FROM_ALL generic_clock.c PeripheralPins.c PeripheralPins_NUCLEO_F4x9ZI.c + variant_DISCO_F429ZI.cpp variant_generic.cpp variant_NUCLEO_F4x9ZI.cpp ) diff --git a/variants/STM32F4xx/F427Z(G-I)T_F429ZET_F429Z(G-I)(T-Y)_F437Z(G-I)T_F439Z(G-I)(T-Y)/variant_DISCO_F429ZI.cpp b/variants/STM32F4xx/F427Z(G-I)T_F429ZET_F429Z(G-I)(T-Y)_F437Z(G-I)T_F439Z(G-I)(T-Y)/variant_DISCO_F429ZI.cpp new file mode 100644 index 0000000000..25555ca858 --- /dev/null +++ b/variants/STM32F4xx/F427Z(G-I)T_F429ZET_F429Z(G-I)(T-Y)_F437Z(G-I)T_F439Z(G-I)(T-Y)/variant_DISCO_F429ZI.cpp @@ -0,0 +1,216 @@ +/* + ******************************************************************************* + * Copyright (c) 2025, 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_DISCO_F429ZI) +#include "pins_arduino.h" + +// Digital PinName array +const PinName digitalPin[] = { + PF_4, // 0 + PF_2, // 1 + PF_0, // 2 + PC_14, // 3 + PE_6, // 4 + PE_4, // 5 + PE_2, // 6 + PE_0, // 7 + PB_8, // 8 + NC, // 9 - BOOT0 + PB_6, // 10 + PB_4, // 11 + PG_15, // 12 + PG_13, // 13 + PG_11, // 14 + PG_9, // 15 + PD_7, // 16 + PD_5, // 17 + PD_3, // 18 + PD_1, // 19 + PC_12, // 20 + PC_10, // 21 + PA_14, // 22 + PA_12, // 23 + PA_10, // 24 + PA_8, // 25 + PC_8, // 26 + PC_6, // 27 + PG_7, // 28 + PG_5, // 29 + PF_5, // 30 + PF_3, // 31 + PF_1, // 32 + PC_15, // 33 + PC_13, // 34 + PE_5, // 35 + PE_3, // 36 + PE_1, // 37 + PB_9, // 38 + PB_7, // 39 + PB_5, // 40 + PB_3, // 41 + PG_14, // 42 + PG_12, // 43 + PG_10, // 44 + PD_6, // 45 + PD_4, // 46 + PD_2, // 47 + PD_0, // 48 + PC_11, // 49 + PA_15, // 50 + PA_13, // 51 + PA_11, // 52 + PA_9, // 53 + PC_9, // 54 + PC_7, // 55 + PG_8, // 56 + PG_6, // 57 + PG_4, // 58 + PF_6, // 59 + PF_8, // 60 + PF_10, // 61 + PH_1, // 62 + PC_1, // 63 + PC_3, // 64 + PA_1, // 65 + PA_3, // 66 + PA_5, // 67 + PA_7, // 68 + PC_5, // 69 + PB_1, // 70 + PF_12, // 71 + PF_14, // 72 + PG_0, // 73 + PE_7, // 74 + PE_9, // 75 + PE_11, // 76 + PE_13, // 77 + PE_15, // 78 + PB_11, // 79 + PB_13, // 80 + PB_15, // 81 // Not connected SB26 OFF + PD_9, // 82 + PD_11, // 83 + PD_13, // 84 + PD_15, // 85 + PG_3, // 86 + PF_7, // 87 + PF_9, // 88 + PH_0, // 89 + PC_0, // 90 + PC_2, // 91 + PA_0, // 92 + PA_2, // 93 + PA_4, // 94 + PA_6, // 95 + PC_4, // 96 + PB_0, // 97 + NC, // 98 - BOOT1 + PF_11, // 99 + PF_13, // 100 + PF_15, // 101 + PG_1, // 102 + PE_8, // 103 + PE_10, // 104 + PE_12, // 105 + PE_14, // 106 + PB_10, // 107 + PB_12, // 108 + PB_14, // 109 // Not connected SB27 OFF + PD_8, // 110 + PD_10, // 111 + PD_12, // 112 + PD_14, // 113 + PG_2 // 114 +}; +// Analog (Ax) pin number array +const uint32_t analogInputPin[] = { + 0, // A0, + 30, // A1, + 31, // A2, + 59, // A3, + 60, // A4, + 61, // A5, + 63, // A6, + 64, // A7, + 65, // A8, + 66, // A9, + 67, // A10, + 68, // A11, + 69, // A12, + 70, // A13, + 87, // A14, + 88, // A15, + 90, // A16, + 91, // A17, + 92, // A18, + 93, // A19, + 94, // A20, + 95, // A21, + 96, // A22, + 97 // A23, +}; + +// ---------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief None + * @param None + * @retval None + */ +WEAK void SystemClock_Config(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct = {}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {}; + + /** Configure the main internal regulator output voltage + */ + __HAL_RCC_PWR_CLK_ENABLE(); + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3); + + /** Initializes the RCC Oscillators according to the specified parameters + * in the RCC_OscInitTypeDef structure. + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 4; + RCC_OscInitStruct.PLL.PLLN = 72; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; + RCC_OscInitStruct.PLL.PLLQ = 3; + 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_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { + Error_Handler(); + } +} + +#ifdef __cplusplus +} +#endif + +#endif /* ARDUINO_DISCO_F429ZI */ diff --git a/variants/STM32F4xx/F427Z(G-I)T_F429ZET_F429Z(G-I)(T-Y)_F437Z(G-I)T_F439Z(G-I)(T-Y)/variant_DISCO_F429ZI.h b/variants/STM32F4xx/F427Z(G-I)T_F429ZET_F429Z(G-I)(T-Y)_F437Z(G-I)T_F439Z(G-I)(T-Y)/variant_DISCO_F429ZI.h new file mode 100644 index 0000000000..f8428ff135 --- /dev/null +++ b/variants/STM32F4xx/F427Z(G-I)T_F429ZET_F429Z(G-I)(T-Y)_F437Z(G-I)T_F439Z(G-I)(T-Y)/variant_DISCO_F429ZI.h @@ -0,0 +1,291 @@ +/* + ******************************************************************************* + * Copyright (c) 2025, 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 + *----------------------------------------------------------------------------*/ +// P1 - LEFT +#define PF4 PIN_A0 +#define PF2 1 +#define PF0 2 +#define PC14 3 +#define PE6 4 +#define PE4 5 +#define PE2 6 +#define PE0 7 +#define PB8 8 +// BOOT0 9 +#define PB6 10 +#define PB4 11 +#define PG15 12 +#define PG13 13 +#define PG11 14 +#define PG9 15 +#define PD7 16 +#define PD5 17 +#define PD3 18 +#define PD1 19 +#define PC12 20 +#define PC10 21 +#define PA14 22 +#define PA12 23 +#define PA10 24 +#define PA8 25 +#define PC8 26 +#define PC6 27 +#define PG7 28 +#define PG5 29 +// P1 - RIGHT +#define PF5 PIN_A1 +#define PF3 PIN_A2 +#define PF1 32 +#define PC15 33 +#define PC13 34 +#define PE5 35 +#define PE3 36 +#define PE1 37 +#define PB9 38 +#define PB7 39 +#define PB5 40 +#define PB3 41 +#define PG14 42 +#define PG12 43 +#define PG10 44 +#define PD6 45 +#define PD4 46 +#define PD2 47 +#define PD0 48 +#define PC11 49 +#define PA15 50 +#define PA13 51 +#define PA11 52 +#define PA9 53 +#define PC9 54 +#define PC7 55 +#define PG8 56 +#define PG6 57 +#define PG4 58 +// P1 - LEFT +#define PF6 PIN_A3 +#define PF8 PIN_A4 +#define PF10 PIN_A5 +#define PH1 62 +#define PC1 PIN_A6 +#define PC3 PIN_A7 +#define PA1 PIN_A8 +#define PA3 PIN_A9 +#define PA5 PIN_A10 +#define PA7 PIN_A11 +#define PC5 PIN_A12 +#define PB1 PIN_A13 +#define PF12 71 +#define PF14 72 +#define PG0 73 +#define PE7 74 +#define PE9 75 +#define PE11 76 +#define PE13 77 +#define PE15 78 +#define PB11 79 +#define PB13 80 +#define PB15 81 // Not connected SB26 OFF +#define PD9 82 +#define PD11 83 +#define PD13 84 +#define PD15 85 +#define PG3 86 +// P2 - RIGHT +#define PF7 PIN_A14 +#define PF9 PIN_A15 +#define PH0 89 +#define PC0 PIN_A16 +#define PC2 PIN_A17 +#define PA0 PIN_A18 +#define PA2 PIN_A19 +#define PA4 PIN_A20 +#define PA6 PIN_A21 +#define PC4 PIN_A22 +#define PB0 PIN_A23 +// PB2/BOOT1 98 +#define PF11 99 +#define PF13 100 +#define PF15 101 +#define PG1 102 +#define PE8 103 +#define PE10 104 +#define PE12 105 +#define PE14 106 +#define PB10 107 +#define PB12 108 +#define PB14 109 // Not connected SB27 OFF +#define PD8 110 +#define PD10 111 +#define PD12 112 +#define PD14 113 +#define PG2 114 + +// Alternate pins number +#define PA0_ALT1 (PA0 | ALT1) +#define PA0_ALT2 (PA0 | ALT2) +#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 PB8_ALT1 (PB8 | ALT1) +#define PB9_ALT1 (PB9 | ALT1) +#define PB14_ALT1 (PB14 | ALT1) +#define PB14_ALT2 (PB14 | ALT2) +#define PB15_ALT1 (PB15 | ALT1) +#define PB15_ALT2 (PB15 | ALT2) +#define PC0_ALT1 (PC0 | ALT1) +#define PC0_ALT2 (PC0 | ALT2) +#define PC1_ALT1 (PC1 | ALT1) +#define PC1_ALT2 (PC1 | ALT2) +#define PC2_ALT1 (PC2 | ALT1) +#define PC2_ALT2 (PC2 | ALT2) +#define PC3_ALT1 (PC3 | ALT1) +#define PC3_ALT2 (PC3 | ALT2) +#define PC4_ALT1 (PC4 | ALT1) +#define PC5_ALT1 (PC5 | ALT1) +#define PC6_ALT1 (PC6 | ALT1) +#define PC7_ALT1 (PC7 | ALT1) +#define PC8_ALT1 (PC8 | ALT1) +#define PC9_ALT1 (PC9 | ALT1) +#define PC10_ALT1 (PC10 | ALT1) +#define PC11_ALT1 (PC11 | ALT1) + +#define NUM_DIGITAL_PINS 115 +#define NUM_ANALOG_INPUTS 24 + +// On-board LED pin number +#define LED_GREEN PG13 +#define LED_RED PG14 +#ifndef LED_BUILTIN + #define LED_BUILTIN LED_GREEN +#endif + +// On-board user button +#ifndef USER_BTN + #define USER_BTN PA0 +#endif + + +// SPI definitions +#ifndef PIN_SPI_SS + #define PIN_SPI_SS PF6 +#endif +#ifndef PIN_SPI_SS1 + #define PIN_SPI_SS1 PF6 +#endif +#ifndef PIN_SPI_SS2 + #define PIN_SPI_SS2 PF6 +#endif +#ifndef PIN_SPI_SS3 + #define PIN_SPI_SS3 PF6 +#endif +#ifndef PIN_SPI_MOSI + #define PIN_SPI_MOSI PF9 //PF11 +#endif +#ifndef PIN_SPI_MISO + #define PIN_SPI_MISO PF8 +#endif +#ifndef PIN_SPI_SCK + #define PIN_SPI_SCK PF7 +#endif + +// I2C definitions +#ifndef PIN_WIRE_SDA + #define PIN_WIRE_SDA PC9 +#endif +#ifndef PIN_WIRE_SCL + #define PIN_WIRE_SCL PA8 +#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 1 +#endif + +// Default pin used for generic 'Serial' instance +// Mandatory for Firmata +#ifndef PIN_SERIAL_RX + #define PIN_SERIAL_RX PA10 +#endif +#ifndef PIN_SERIAL_TX + #define PIN_SERIAL_TX PA9 +#endif + +// Extra HAL modules +#if !defined(HAL_DAC_MODULE_DISABLED) + #define HAL_DAC_MODULE_ENABLED +#endif +#if !defined(HAL_ETH_MODULE_DISABLED) + #define HAL_ETH_MODULE_ENABLED +#endif +#if !defined(HAL_SD_MODULE_DISABLED) + #define HAL_SD_MODULE_ENABLED +#endif + +/*---------------------------------------------------------------------------- + * 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 /* ARDUINO_DISCO_F429ZI */