|
| 1 | +/* |
| 2 | + ******************************************************************************* |
| 3 | + * Copyright (c) 2025, 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 | +// Arduino UNO V3 |
| 19 | +// CN8 |
| 20 | +#definePB5 PIN_A3 // Q4 Not connected by default (SB31 OFF) |
| 21 | +#definePB4 1 // A5 / Not connected by default (SB29 OFF) |
| 22 | +#definePB14 2 // Not connected by default (SB36 OFF) |
| 23 | +#definePB3 PIN_A0 // Not connected by default (SB24 OFF) |
| 24 | +#definePA11 4 // Not connected by default (SB44 OFF) |
| 25 | +#definePB7 5 // Not connected by default (SB42 OFF) |
| 26 | +#definePB6 6 // Not connected by default (SB40 OFF) |
| 27 | +#definePA8 7 // Not connected by default (SB39 OFF) |
| 28 | +// CN6 |
| 29 | +#definePB15 8 |
| 30 | +#definePA0 9 // Not connected by default (SB12 OFF) |
| 31 | +#definePA9 10 // SB47 ON |
| 32 | +// 11 is PA11 (4) // SB43 ON |
| 33 | +// 12 is PA8 (7) // SB41 ON |
| 34 | +// 13 is PB3 (3) // SB14 ON |
| 35 | +// 14 is PB7 (5) // SB34 ON |
| 36 | +// 15 is PB6 (6) // SB32 ON |
| 37 | +// CN7 |
| 38 | +// Analog pins A0 to A5 silkscreened |
| 39 | +// None connected by default moreover some of assigned pins are not supported |
| 40 | +// as the N channel of the ADC is not supportedby the core |
| 41 | +#definePB2 16 // A1 / Not connected by default (SB13 OFF) |
| 42 | +#definePB1 PIN_A2 // Not connected by default (SB10 OFF) |
| 43 | +#definePB0 18 // A3 / Not connected by default (SB8 OFF) |
| 44 | +// ST Morpho |
| 45 | +// CN3 Left Side |
| 46 | +#definePA10 19 |
| 47 | +#definePA2 20 |
| 48 | +#definePA3 PIN_A1 |
| 49 | +#definePB12 22 |
| 50 | +#definePB13 23 |
| 51 | +#definePA1 24 |
| 52 | + |
| 53 | +// Alternate pins number |
| 54 | +#definePA2_ALT1 (PA2 | ALT1) |
| 55 | +#definePA3_ALT1 (PA3 | ALT1) |
| 56 | +#definePA9_ALT1 (PA9 | ALT1) |
| 57 | +#definePB3_ALT1 (PB3 | ALT1) |
| 58 | +#definePB4_ALT1 (PB4 | ALT1) |
| 59 | +#definePB6_ALT1 (PB6 | ALT1) |
| 60 | + |
| 61 | +#defineNUM_DIGITAL_PINS 25 |
| 62 | +#defineNUM_ANALOG_INPUTS 4 |
| 63 | + |
| 64 | +// On-board LED pin number |
| 65 | +#defineLED_BLUE PB1 |
| 66 | +#defineLED_LD1 LED_BLUE |
| 67 | +#defineLED_GREEN PB4 |
| 68 | +#defineLED_LD2 LED_GREEN |
| 69 | +#defineLED_RED PB2 |
| 70 | +#defineLED_LD3 LED_RED |
| 71 | +#ifndefLED_BUILTIN |
| 72 | +#defineLED_BUILTIN LED_BLUE |
| 73 | +#endif |
| 74 | + |
| 75 | +// On-board user button |
| 76 | +#defineUSER_B1 PA0 |
| 77 | +#defineUSER_B2 PB5 |
| 78 | +#defineUSER_B3 PB14 |
| 79 | +#ifndefUSER_BTN |
| 80 | +#defineUSER_BTN USER_B1 |
| 81 | +#endif |
| 82 | + |
| 83 | +// Timer Definitions |
| 84 | +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin |
| 85 | +#ifndefTIMER_TONE |
| 86 | +#defineTIMER_TONE TIM16 |
| 87 | +#endif |
| 88 | +#ifndefTIMER_SERVO |
| 89 | +#defineTIMER_SERVO TIM17 |
| 90 | +#endif |
| 91 | + |
| 92 | +// UART Definitions |
| 93 | +#ifndefSERIAL_UART_INSTANCE |
| 94 | +#defineSERIAL_UART_INSTANCE 1 |
| 95 | +#endif |
| 96 | + |
| 97 | +// Default pin used for generic 'Serial' instance |
| 98 | +// Mandatory for Firmata |
| 99 | +#ifndefPIN_SERIAL_RX |
| 100 | +#definePIN_SERIAL_RX PB0 |
| 101 | +#endif |
| 102 | +#ifndefPIN_SERIAL_TX |
| 103 | +#definePIN_SERIAL_TX PA1 |
| 104 | +#endif |
| 105 | + |
| 106 | +/*---------------------------------------------------------------------------- |
| 107 | + * Arduino objects - C++ only |
| 108 | + *----------------------------------------------------------------------------*/ |
| 109 | + |
| 110 | +#ifdef__cplusplus |
| 111 | +// These serial port names are intended to allow libraries and architecture-neutral |
| 112 | +// sketches to automatically default to the correct port name for a particular type |
| 113 | +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, |
| 114 | +// the first hardware serial port whose RX/TX pins are not dedicated to another use. |
| 115 | +// |
| 116 | +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor |
| 117 | +// |
| 118 | +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial |
| 119 | +// |
| 120 | +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library |
| 121 | +// |
| 122 | +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. |
| 123 | +// |
| 124 | +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX |
| 125 | +// pins are NOT connected to anything by default. |
| 126 | +#ifndefSERIAL_PORT_MONITOR |
| 127 | +#defineSERIAL_PORT_MONITOR Serial |
| 128 | +#endif |
| 129 | +#ifndefSERIAL_PORT_HARDWARE |
| 130 | +#defineSERIAL_PORT_HARDWARE Serial |
| 131 | +#endif |
| 132 | +#endif |