|
| 1 | +/* |
| 2 | + ******************************************************************************* |
| 3 | + * Copyright (c) 2023, 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 | +// CN1 |
| 19 | +#define PA13 0 // SWDIO |
| 20 | +#define PA14 1 // SWCLK |
| 21 | +#define PB3 2 // SWO |
| 22 | +#define PB2 3 // SPI1 NSS |
| 23 | +#define PA5 PIN_A0 // SPI1 SCK |
| 24 | +#define PA6 PIN_A1 // SPI1 MISO |
| 25 | +#define PA7 PIN_A2 // SPI1 MOSI |
| 26 | +// CN2 |
| 27 | +#define PB8 7 // I2C1 SCL |
| 28 | +#define PB9 8 // I2C1 SDA |
| 29 | +#define PA0 PIN_A3 // WKUP |
| 30 | +#define PA2 PIN_A4 // LPUART1 TX |
| 31 | +#define PA3 PIN_A5 // LPUART1 RX |
| 32 | +#define PB6 12 |
| 33 | +#define PA9 PIN_A6 // SB2 close/SB6 open (default) |
| 34 | +#define PA8 PIN_A7 |
| 35 | +#define PA1 PIN_A8 |
| 36 | +// Same position than PA9 on CN2 |
| 37 | +#define PB7 16 // SB2 open/SB6 close |
| 38 | +// Specific |
| 39 | +#define PC14 17 // OSC32-IN |
| 40 | +#define PC15 18 // OSC32-OUT |
| 41 | +#define PH3 19 // BOOT0 |
| 42 | +#define PA4 20 // LED1 BLUE |
| 43 | +#define PB0 21 // LED2 GREEN |
| 44 | +#define PB1 22 // LED3 RED |
| 45 | +#define PA10 23 // USER_BTN |
| 46 | +#define PA11 24 // USB_DM |
| 47 | +#define PA12 25 // USB_DP |
| 48 | + |
| 49 | +// Not connected |
| 50 | +// PA15 |
| 51 | +// PB4 |
| 52 | +// PB5 |
| 53 | +// PE4 |
| 54 | + |
| 55 | +// Alternate pins number |
| 56 | +#define PA7_ALT1 (PA7 | ALT1) |
| 57 | +#define PB8_ALT1 (PB8 | ALT1) |
| 58 | +#define PB9_ALT1 (PB9 | ALT1) |
| 59 | + |
| 60 | +#define NUM_DIGITAL_PINS 26 |
| 61 | +#define NUM_ANALOG_INPUTS 9 |
| 62 | + |
| 63 | +// On-board LED pin number |
| 64 | +#define LED1 PA4 |
| 65 | +#define LED2 PB0 |
| 66 | +#define LED3 PB1 |
| 67 | +#ifndef LED_BUILTIN |
| 68 | + #define LED_BUILTIN LED1 |
| 69 | +#endif |
| 70 | +#define LED_BLUE LED1 |
| 71 | +#define LED_GREEN LED2 |
| 72 | +#define LED_RED LED3 |
| 73 | + |
| 74 | +// On-board user button |
| 75 | +// Note: use '_BTN' for SW1 as it is a register name of M24SR64-Y |
| 76 | +#define SW1_BTN PA10 |
| 77 | +#ifndef USER_BTN |
| 78 | + #define USER_BTN SW1_BTN |
| 79 | +#endif |
| 80 | + |
| 81 | +// SPI definitions |
| 82 | +#ifndef PIN_SPI_SS |
| 83 | + #define PIN_SPI_SS PB2 |
| 84 | +#endif |
| 85 | +#ifndef PIN_SPI_SS1 |
| 86 | + #define PIN_SPI_SS1 PB6 |
| 87 | +#endif |
| 88 | +#ifndef PIN_SPI_SS2 |
| 89 | + #define PIN_SPI_SS2 PA8 |
| 90 | +#endif |
| 91 | +#ifndef PIN_SPI_SS3 |
| 92 | + #define PIN_SPI_SS3 PNUM_NOT_DEFINED |
| 93 | +#endif |
| 94 | +#ifndef PIN_SPI_MOSI |
| 95 | + #define PIN_SPI_MOSI PA7 |
| 96 | +#endif |
| 97 | +#ifndef PIN_SPI_MISO |
| 98 | + #define PIN_SPI_MISO PA6 |
| 99 | +#endif |
| 100 | +#ifndef PIN_SPI_SCK |
| 101 | + #define PIN_SPI_SCK PA5 |
| 102 | +#endif |
| 103 | + |
| 104 | +// I2C definitions |
| 105 | +#ifndef PIN_WIRE_SDA |
| 106 | + #define PIN_WIRE_SDA PB9 |
| 107 | +#endif |
| 108 | +#ifndef PIN_WIRE_SCL |
| 109 | + #define PIN_WIRE_SCL PB8 |
| 110 | +#endif |
| 111 | + |
| 112 | +// Timer Definitions |
| 113 | +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin |
| 114 | +#ifndef TIMER_TONE |
| 115 | + #define TIMER_TONE TIM16 |
| 116 | +#endif |
| 117 | +#ifndef TIMER_SERVO |
| 118 | + #define TIMER_SERVO TIM17 |
| 119 | +#endif |
| 120 | + |
| 121 | +// UART Definitions |
| 122 | +#ifndef SERIAL_UART_INSTANCE |
| 123 | + #define SERIAL_UART_INSTANCE 101 |
| 124 | +#endif |
| 125 | + |
| 126 | +// Default pin used for generic 'Serial' instance |
| 127 | +// Mandatory for Firmata |
| 128 | +#ifndef PIN_SERIAL_RX |
| 129 | + #define PIN_SERIAL_RX PA3 |
| 130 | +#endif |
| 131 | +#ifndef PIN_SERIAL_TX |
| 132 | + #define PIN_SERIAL_TX PA2 |
| 133 | +#endif |
| 134 | + |
| 135 | +// Extra HAL modules |
| 136 | +#if !defined(HAL_QSPI_MODULE_DISABLED) |
| 137 | + #define HAL_QSPI_MODULE_ENABLED |
| 138 | +#endif |
| 139 | + |
| 140 | +/*---------------------------------------------------------------------------- |
| 141 | + * Arduino objects - C++ only |
| 142 | + *----------------------------------------------------------------------------*/ |
| 143 | + |
| 144 | +#ifdef __cplusplus |
| 145 | + // These serial port names are intended to allow libraries and architecture-neutral |
| 146 | + // sketches to automatically default to the correct port name for a particular type |
| 147 | + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, |
| 148 | + // the first hardware serial port whose RX/TX pins are not dedicated to another use. |
| 149 | + // |
| 150 | + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor |
| 151 | + // |
| 152 | + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial |
| 153 | + // |
| 154 | + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library |
| 155 | + // |
| 156 | + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. |
| 157 | + // |
| 158 | + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX |
| 159 | + // pins are NOT connected to anything by default. |
| 160 | + #ifndef SERIAL_PORT_MONITOR |
| 161 | + #define SERIAL_PORT_MONITOR Serial |
| 162 | + #endif |
| 163 | + #ifndef SERIAL_PORT_HARDWARE |
| 164 | + #define SERIAL_PORT_HARDWARE Serial |
| 165 | + #endif |
| 166 | +#endif |
0 commit comments