|
| 1 | +/* |
| 2 | + ******************************************************************************* |
| 3 | + * Copyright (c) 2024, STMicroelectronics |
| 4 | + * All rights reserved. |
| 5 | + * |
| 6 | + * This software component is licensed by ST under BSD 3-Clause license, |
| 7 | + * the "License"; You may not use this file except in compliance with the |
| 8 | + * License. You may obtain a copy of the License at: |
| 9 | + * opensource.org/licenses/BSD-3-Clause |
| 10 | + * |
| 11 | + ******************************************************************************* |
| 12 | + */ |
| 13 | +#pragma once |
| 14 | + |
| 15 | +/*---------------------------------------------------------------------------- |
| 16 | + * STM32 pins number |
| 17 | + *----------------------------------------------------------------------------*/ |
| 18 | +#define PA0 PIN_A0 |
| 19 | +#define PA1 PIN_A1 |
| 20 | +#define PA2 PIN_A2 |
| 21 | +#define PA3 PIN_A3 |
| 22 | +#define PA4 PIN_A4 |
| 23 | +#define PA5 PIN_A5 |
| 24 | +#define PA6 PIN_A6 |
| 25 | +#define PA7 PIN_A7 |
| 26 | +#define PA8 PIN_A8 |
| 27 | +#define PA9 PIN_A9 |
| 28 | +#define PA10 10 |
| 29 | +#define PA11 11 |
| 30 | +#define PA12 12 |
| 31 | +#define PA13 13 |
| 32 | +#define PA14 14 |
| 33 | +#define PA15 15 |
| 34 | +#define PB0 PIN_A10 |
| 35 | +#define PB1 PIN_A11 |
| 36 | +#define PB2 PIN_A12 |
| 37 | +#define PB3 19 |
| 38 | +#define PB4 20 |
| 39 | +#define PB5 21 |
| 40 | +#define PB6 22 |
| 41 | +#define PB7 23 |
| 42 | +#define PB8 24 |
| 43 | +#define PB9 25 |
| 44 | +#define PB10 26 |
| 45 | +#define PB11 PIN_A13 |
| 46 | +#define PB12 PIN_A14 |
| 47 | +#define PB13 PIN_A15 |
| 48 | +#define PB14 PIN_A16 |
| 49 | +#define PB15 PIN_A17 |
| 50 | +#define PC4 PIN_A18 |
| 51 | +#define PC6 33 // LED |
| 52 | +#define PC10 34 |
| 53 | +#define PC11 35 |
| 54 | +#define PC13 36 // BTN |
| 55 | +#define PC14 37 |
| 56 | +#define PC15 38 |
| 57 | +#define PF0 PIN_A19 |
| 58 | +#define PF1 PIN_A20 |
| 59 | +#define PG10 41 |
| 60 | + |
| 61 | +// Alternate pins number |
| 62 | +#define PA0_ALT1 (PA0 | ALT1) |
| 63 | +#define PA1_ALT1 (PA1 | ALT1) |
| 64 | +#define PA1_ALT2 (PA1 | ALT2) |
| 65 | +#define PA2_ALT1 (PA2 | ALT1) |
| 66 | +#define PA2_ALT2 (PA2 | ALT2) |
| 67 | +#define PA3_ALT1 (PA3 | ALT1) |
| 68 | +#define PA3_ALT2 (PA3 | ALT2) |
| 69 | +#define PA4_ALT1 (PA4 | ALT1) |
| 70 | +#define PA6_ALT1 (PA6 | ALT1) |
| 71 | +#define PA7_ALT1 (PA7 | ALT1) |
| 72 | +#define PA7_ALT2 (PA7 | ALT2) |
| 73 | +#define PA7_ALT3 (PA7 | ALT3) |
| 74 | +#define PA9_ALT1 (PA9 | ALT1) |
| 75 | +#define PA10_ALT1 (PA10 | ALT1) |
| 76 | +#define PA11_ALT1 (PA11 | ALT1) |
| 77 | +#define PA11_ALT2 (PA11 | ALT2) |
| 78 | +#define PA12_ALT1 (PA12 | ALT1) |
| 79 | +#define PA12_ALT2 (PA12 | ALT2) |
| 80 | +#define PA13_ALT1 (PA13 | ALT1) |
| 81 | +#define PA15_ALT1 (PA15 | ALT1) |
| 82 | +#define PB0_ALT1 (PB0 | ALT1) |
| 83 | +#define PB0_ALT2 (PB0 | ALT2) |
| 84 | +#define PB1_ALT1 (PB1 | ALT1) |
| 85 | +#define PB1_ALT2 (PB1 | ALT2) |
| 86 | +#define PB2_ALT1 (PB2 | ALT1) |
| 87 | +#define PB3_ALT1 (PB3 | ALT1) |
| 88 | +#define PB4_ALT1 (PB4 | ALT1) |
| 89 | +#define PB4_ALT2 (PB4 | ALT2) |
| 90 | +#define PB5_ALT1 (PB5 | ALT1) |
| 91 | +#define PB5_ALT2 (PB5 | ALT2) |
| 92 | +#define PB6_ALT1 (PB6 | ALT1) |
| 93 | +#define PB6_ALT2 (PB6 | ALT2) |
| 94 | +#define PB7_ALT1 (PB7 | ALT1) |
| 95 | +#define PB7_ALT2 (PB7 | ALT2) |
| 96 | +#define PB8_ALT1 (PB8 | ALT1) |
| 97 | +#define PB8_ALT2 (PB8 | ALT2) |
| 98 | +#define PB9_ALT1 (PB9 | ALT1) |
| 99 | +#define PB9_ALT2 (PB9 | ALT2) |
| 100 | +#define PB9_ALT3 (PB9 | ALT3) |
| 101 | +#define PB11_ALT1 (PB11 | ALT1) |
| 102 | +#define PB12_ALT1 (PB12 | ALT1) |
| 103 | +#define PB13_ALT1 (PB13 | ALT1) |
| 104 | +#define PB14_ALT1 (PB14 | ALT1) |
| 105 | +#define PB15_ALT1 (PB15 | ALT1) |
| 106 | +#define PB15_ALT2 (PB15 | ALT2) |
| 107 | +#define PC6_ALT1 (PC6 | ALT1) |
| 108 | +#define PC10_ALT1 (PC10 | ALT1) |
| 109 | +#define PC11_ALT1 (PC11 | ALT1) |
| 110 | +#define PC13_ALT1 (PC13 | ALT1) |
| 111 | + |
| 112 | +#define NUM_DIGITAL_PINS 42 |
| 113 | +#define NUM_ANALOG_INPUTS 21 |
| 114 | + |
| 115 | +// On-board LED pin number |
| 116 | +#ifndef LED_BUILTIN |
| 117 | + #define LED_BUILTIN PC6 |
| 118 | +#endif |
| 119 | + |
| 120 | +// On-board user button |
| 121 | +#ifndef USER_BTN |
| 122 | + #define USER_BTN PC13 |
| 123 | +#endif |
| 124 | + |
| 125 | +// SPI definitions |
| 126 | +#ifndef PIN_SPI_SS |
| 127 | + #define PIN_SPI_SS PA4 |
| 128 | +#endif |
| 129 | +#ifndef PIN_SPI_SS1 |
| 130 | + #define PIN_SPI_SS1 PA15 |
| 131 | +#endif |
| 132 | +#ifndef PIN_SPI_SS2 |
| 133 | + #define PIN_SPI_SS2 PNUM_NOT_DEFINED |
| 134 | +#endif |
| 135 | +#ifndef PIN_SPI_SS3 |
| 136 | + #define PIN_SPI_SS3 PNUM_NOT_DEFINED |
| 137 | +#endif |
| 138 | +#ifndef PIN_SPI_MOSI |
| 139 | + #define PIN_SPI_MOSI PA7 |
| 140 | +#endif |
| 141 | +#ifndef PIN_SPI_MISO |
| 142 | + #define PIN_SPI_MISO PA6 |
| 143 | +#endif |
| 144 | +#ifndef PIN_SPI_SCK |
| 145 | + #define PIN_SPI_SCK PA5 |
| 146 | +#endif |
| 147 | + |
| 148 | +// I2C definitions |
| 149 | +#ifndef PIN_WIRE_SDA |
| 150 | + #define PIN_WIRE_SDA PA8 |
| 151 | +#endif |
| 152 | +#ifndef PIN_WIRE_SCL |
| 153 | + #define PIN_WIRE_SCL PA9 |
| 154 | +#endif |
| 155 | + |
| 156 | +// Timer Definitions |
| 157 | +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin |
| 158 | +#ifndef TIMER_TONE |
| 159 | + #define TIMER_TONE TIM6 |
| 160 | +#endif |
| 161 | +#ifndef TIMER_SERVO |
| 162 | + #define TIMER_SERVO TIM7 |
| 163 | +#endif |
| 164 | + |
| 165 | +// UART Definitions |
| 166 | +#ifndef SERIAL_UART_INSTANCE |
| 167 | + #define SERIAL_UART_INSTANCE 2 |
| 168 | +#endif |
| 169 | + |
| 170 | +// Default pin used for generic 'Serial' instance |
| 171 | +// Mandatory for Firmata |
| 172 | +#ifndef PIN_SERIAL_RX |
| 173 | + #define PIN_SERIAL_RX PA3 |
| 174 | +#endif |
| 175 | +#ifndef PIN_SERIAL_TX |
| 176 | + #define PIN_SERIAL_TX PA2 |
| 177 | +#endif |
| 178 | + |
| 179 | +// Extra HAL modules |
| 180 | +#if !defined(HAL_DAC_MODULE_DISABLED) |
| 181 | + #define HAL_DAC_MODULE_ENABLED |
| 182 | +#endif |
| 183 | +#if !defined(HAL_QSPI_MODULE_DISABLED) |
| 184 | + #define HAL_QSPI_MODULE_ENABLED |
| 185 | +#endif |
| 186 | + |
| 187 | +/*---------------------------------------------------------------------------- |
| 188 | + * Arduino objects - C++ only |
| 189 | + *----------------------------------------------------------------------------*/ |
| 190 | + |
| 191 | +#ifdef __cplusplus |
| 192 | + // These serial port names are intended to allow libraries and architecture-neutral |
| 193 | + // sketches to automatically default to the correct port name for a particular type |
| 194 | + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, |
| 195 | + // the first hardware serial port whose RX/TX pins are not dedicated to another use. |
| 196 | + // |
| 197 | + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor |
| 198 | + // |
| 199 | + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial |
| 200 | + // |
| 201 | + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library |
| 202 | + // |
| 203 | + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. |
| 204 | + // |
| 205 | + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX |
| 206 | + // pins are NOT connected to anything by default. |
| 207 | + #ifndef SERIAL_PORT_MONITOR |
| 208 | + #define SERIAL_PORT_MONITOR Serial2 |
| 209 | + #endif |
| 210 | + #ifndef SERIAL_PORT_HARDWARE |
| 211 | + #define SERIAL_PORT_HARDWARE Serial2 |
| 212 | + #endif |
| 213 | +#endif |
0 commit comments