|
| 1 | +/* |
| 2 | + ******************************************************************************* |
| 3 | + * Copyright (c) 2021, 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 | +// CN9 |
| 20 | +#define PB7 0 |
| 21 | +#define PB6 1 |
| 22 | +#define PB12 2 |
| 23 | +#define PB3 PIN_A6 |
| 24 | +#define PB5 4 |
| 25 | +#define PB8 5 |
| 26 | +#define PB10 6 |
| 27 | +#define PC1 7 |
| 28 | +// CN5 |
| 29 | +#define PC2 8 |
| 30 | +#define PA9 9 |
| 31 | +#define PA4 10 |
| 32 | +#define PA7 11 |
| 33 | +#define PA6 12 |
| 34 | +#define PA5 13 |
| 35 | +#define PA11 PIN_A7 |
| 36 | +#define PA12 PIN_A8 |
| 37 | +// CN8 |
| 38 | +#define PB1 PIN_A0 |
| 39 | +#define PB2 PIN_A1 |
| 40 | +#define PA10 PIN_A2 |
| 41 | +#define PB4 PIN_A3 |
| 42 | +#define PB14 PIN_A4 |
| 43 | +#define PB13 PIN_A5 |
| 44 | +// ST Morpho |
| 45 | +// CN10 Left Side |
| 46 | +#define PA0 22 |
| 47 | +// CN10 Right Side |
| 48 | +#define PC3 23 // FE_CTRL3 |
| 49 | +#define PA1 24 |
| 50 | +#define PB11 25 |
| 51 | +#define PB15 26 |
| 52 | +#define PB9 27 |
| 53 | +#define PB0 28 // VDD_TCXO Supply voltage of TCXO |
| 54 | +#define PA8 29 |
| 55 | +#define PC0 30 |
| 56 | +#define PC6 31 |
| 57 | +#define PC5 32 // FE_CTRL2 |
| 58 | +#define PC4 33 // FE_CTRL1 |
| 59 | +// CN7 Left Side |
| 60 | +#define PC15 34 // OSC32_OUT - SB11 OFF not connected to ST Morpho |
| 61 | +#define PC14 35 // OSC32_IN - SB14 OFF not connected to ST Morpho |
| 62 | +#define PC13 36 |
| 63 | +#define PA15 PIN_A9 |
| 64 | +#define PA14 PIN_A10 |
| 65 | +#define PA13 PIN_A11 |
| 66 | +// Not on connectors |
| 67 | +#define PA2 40 // Could be on D1. See Solder bridge configuration. |
| 68 | +#define PA3 41 // Could be on D0. See Solder bridge configuration. |
| 69 | +#define PH3 42 // BOOT0 - JP3 - GND |
| 70 | + |
| 71 | +// Alternate pins number |
| 72 | +#define PA1_ALT1 (PA1 | ALT1) |
| 73 | +#define PA2_ALT1 (PA2 | ALT1) |
| 74 | +#define PA3_ALT1 (PA3 | ALT1) |
| 75 | +#define PA7_ALT1 (PA7 | ALT1) |
| 76 | +#define PB8_ALT1 (PB8 | ALT1) |
| 77 | +#define PB9_ALT1 (PB9 | ALT1) |
| 78 | + |
| 79 | +#define NUM_DIGITAL_PINS 43 |
| 80 | +#define NUM_ANALOG_INPUTS 12 |
| 81 | + |
| 82 | +// On-board LED pin number |
| 83 | +#define LED1 PB15 |
| 84 | +#define LED2 PB9 |
| 85 | +#define LED3 PB11 |
| 86 | +#ifndef LED_BUILTIN |
| 87 | + #define LED_BUILTIN LED1 |
| 88 | +#endif |
| 89 | +#define LED_BLUE LED1 |
| 90 | +#define LED_GREEN LED2 |
| 91 | +#define LED_RED LED3 |
| 92 | + |
| 93 | +// On-board user button |
| 94 | +#define B1_BTN PA0 // PC13 (!SB16 SB15) |
| 95 | +#define B2_BTN PA1 |
| 96 | +#define B3_BTN PC6 |
| 97 | +#ifndef USER_BTN |
| 98 | + #define USER_BTN B1_BTN |
| 99 | +#endif |
| 100 | + |
| 101 | +// Timer Definitions |
| 102 | +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin |
| 103 | +#ifndef TIMER_TONE |
| 104 | + #define TIMER_TONE TIM16 |
| 105 | +#endif |
| 106 | +#ifndef TIMER_SERVO |
| 107 | + #define TIMER_SERVO TIM17 |
| 108 | +#endif |
| 109 | + |
| 110 | +// UART Definitions |
| 111 | +#ifndef SERIAL_UART_INSTANCE |
| 112 | + #define SERIAL_UART_INSTANCE 101 |
| 113 | +#endif |
| 114 | + |
| 115 | +// Default pin used for generic 'Serial' instance |
| 116 | +// Mandatory for Firmata |
| 117 | +#ifndef PIN_SERIAL_RX |
| 118 | + #define PIN_SERIAL_RX PA3 |
| 119 | +#endif |
| 120 | +#ifndef PIN_SERIAL_TX |
| 121 | + #define PIN_SERIAL_TX PA2 |
| 122 | +#endif |
| 123 | + |
| 124 | +#ifndef UART_WAKEUP_EXTI_LINE |
| 125 | + // For LPUART1 |
| 126 | + #define UART_WAKEUP_EXTI_LINE LL_EXTI_LINE_28 |
| 127 | +#endif |
| 128 | + |
| 129 | +// Extra HAL modules |
| 130 | +#if !defined(HAL_DAC_MODULE_DISABLED) |
| 131 | + #define HAL_DAC_MODULE_ENABLED |
| 132 | +#endif |
| 133 | + |
| 134 | +/*---------------------------------------------------------------------------- |
| 135 | + * Arduino objects - C++ only |
| 136 | + *----------------------------------------------------------------------------*/ |
| 137 | + |
| 138 | +#ifdef __cplusplus |
| 139 | + // These serial port names are intended to allow libraries and architecture-neutral |
| 140 | + // sketches to automatically default to the correct port name for a particular type |
| 141 | + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, |
| 142 | + // the first hardware serial port whose RX/TX pins are not dedicated to another use. |
| 143 | + // |
| 144 | + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor |
| 145 | + // |
| 146 | + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial |
| 147 | + // |
| 148 | + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library |
| 149 | + // |
| 150 | + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. |
| 151 | + // |
| 152 | + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX |
| 153 | + // pins are NOT connected to anything by default. |
| 154 | + #ifndef SERIAL_PORT_MONITOR |
| 155 | + #define SERIAL_PORT_MONITOR Serial |
| 156 | + #endif |
| 157 | + #ifndef SERIAL_PORT_HARDWARE |
| 158 | + #define SERIAL_PORT_HARDWARE Serial |
| 159 | + #endif |
| 160 | +#endif |
0 commit comments