|
| 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 | +#define PB5 PIN_A3 // Q4 Not connected by default (SB31 OFF) |
| 21 | +#define PB4 1 // A5 / Not connected by default (SB29 OFF) |
| 22 | +#define PB14 2 // Not connected by default (SB36 OFF) |
| 23 | +#define PB3 PIN_A0 // Not connected by default (SB24 OFF) |
| 24 | +#define PA11 4 // Not connected by default (SB44 OFF) |
| 25 | +#define PB7 5 // Not connected by default (SB42 OFF) |
| 26 | +#define PB6 6 // Not connected by default (SB40 OFF) |
| 27 | +#define PA8 7 // Not connected by default (SB39 OFF) |
| 28 | +// CN6 |
| 29 | +#define PB15 8 |
| 30 | +#define PA0 9 // Not connected by default (SB12 OFF) |
| 31 | +#define PA9 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 | +#define PB2 16 // A1 / Not connected by default (SB13 OFF) |
| 42 | +#define PB1 PIN_A2 // Not connected by default (SB10 OFF) |
| 43 | +#define PB0 18 // A3 / Not connected by default (SB8 OFF) |
| 44 | +// ST Morpho |
| 45 | +// CN3 Left Side |
| 46 | +#define PA10 19 |
| 47 | +#define PA2 20 |
| 48 | +#define PA3 PIN_A1 |
| 49 | +#define PB12 22 |
| 50 | +#define PB13 23 |
| 51 | +#define PA1 24 |
| 52 | + |
| 53 | +// Alternate pins number |
| 54 | +#define PA2_ALT1 (PA2 | ALT1) |
| 55 | +#define PA3_ALT1 (PA3 | ALT1) |
| 56 | +#define PA9_ALT1 (PA9 | ALT1) |
| 57 | +#define PB3_ALT1 (PB3 | ALT1) |
| 58 | +#define PB4_ALT1 (PB4 | ALT1) |
| 59 | +#define PB6_ALT1 (PB6 | ALT1) |
| 60 | + |
| 61 | +#define NUM_DIGITAL_PINS 25 |
| 62 | +#define NUM_ANALOG_INPUTS 4 |
| 63 | + |
| 64 | +// On-board LED pin number |
| 65 | +#define LED_BLUE PB1 |
| 66 | +#define LED_LD1 LED_BLUE |
| 67 | +#define LED_GREEN PB4 |
| 68 | +#define LED_LD2 LED_GREEN |
| 69 | +#define LED_RED PB2 |
| 70 | +#define LED_LD3 LED_RED |
| 71 | +#ifndef LED_BUILTIN |
| 72 | + #define LED_BUILTIN LED_BLUE |
| 73 | +#endif |
| 74 | + |
| 75 | +// On-board user button |
| 76 | +#define USER_B1 PA0 |
| 77 | +#define USER_B2 PB5 |
| 78 | +#define USER_B3 PB14 |
| 79 | +#ifndef USER_BTN |
| 80 | + #define USER_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 | +#ifndef TIMER_TONE |
| 86 | + #define TIMER_TONE TIM16 |
| 87 | +#endif |
| 88 | +#ifndef TIMER_SERVO |
| 89 | + #define TIMER_SERVO TIM17 |
| 90 | +#endif |
| 91 | + |
| 92 | +// UART Definitions |
| 93 | +#ifndef SERIAL_UART_INSTANCE |
| 94 | + #define SERIAL_UART_INSTANCE 1 |
| 95 | +#endif |
| 96 | + |
| 97 | +// Default pin used for generic 'Serial' instance |
| 98 | +// Mandatory for Firmata |
| 99 | +#ifndef PIN_SERIAL_RX |
| 100 | + #define PIN_SERIAL_RX PB0 |
| 101 | +#endif |
| 102 | +#ifndef PIN_SERIAL_TX |
| 103 | + #define PIN_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 | + #ifndef SERIAL_PORT_MONITOR |
| 127 | + #define SERIAL_PORT_MONITOR Serial |
| 128 | + #endif |
| 129 | + #ifndef SERIAL_PORT_HARDWARE |
| 130 | + #define SERIAL_PORT_HARDWARE Serial |
| 131 | + #endif |
| 132 | +#endif |
0 commit comments