|
| 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 | +#define PB3 0 |
| 19 | +#define PA15 1 |
| 20 | +#define PA2 2 |
| 21 | +#define PA3 3 |
| 22 | +#define PA11 PIN_A1 |
| 23 | +#define PA12 PIN_A2 |
| 24 | +#define PA13 PIN_A3 |
| 25 | +#define PA14 PIN_A4 |
| 26 | +#define PA0 8 |
| 27 | +#define PA1 9 |
| 28 | +#define PA4 10 |
| 29 | +#define PA5 11 |
| 30 | +#define PA6 12 |
| 31 | +#define PA7 13 |
| 32 | +#define PA8 14 |
| 33 | +#define PA9 15 |
| 34 | +#define PA10 16 |
| 35 | +#define PB0 17 |
| 36 | +#define PB2 PIN_A0 |
| 37 | +#define PB4 19 |
| 38 | +#define PB5 20 |
| 39 | +#define PB6 21 |
| 40 | +#define PB7 22 |
| 41 | +#define PB8 23 |
| 42 | +#define PB12 24 |
| 43 | +#define PC13 25 |
| 44 | +#define PH3 26 |
| 45 | +#define PC14 27 // OSC32-IN |
| 46 | +#define PC15 28 // OSC32-OUT |
| 47 | + |
| 48 | +// Alternate pins number |
| 49 | +#define PA1_ALT1 (PA1 | ALT1) |
| 50 | +#define PA2_ALT1 (PA2 | ALT1) |
| 51 | +#define PA3_ALT1 (PA3 | ALT1) |
| 52 | +#define PA7_ALT1 (PA7 | ALT1) |
| 53 | +#define PB8_ALT1 (PB8 | ALT1) |
| 54 | + |
| 55 | +#define NUM_DIGITAL_PINS 29 |
| 56 | +#define NUM_ANALOG_INPUTS 5 |
| 57 | + |
| 58 | +// On-board LED pin number |
| 59 | +#define LED_RED PB5 |
| 60 | +#ifndef LED_BUILTIN |
| 61 | + #define LED_BUILTIN LED_RED |
| 62 | +#endif |
| 63 | +#define LED_GREEN PB6 |
| 64 | +#define LED_BLUE PB7 |
| 65 | + |
| 66 | + |
| 67 | +// On-board user button |
| 68 | +#define B1_BTN PB3 |
| 69 | +#ifndef USER_BTN |
| 70 | + #define USER_BTN B1_BTN |
| 71 | +#endif |
| 72 | + |
| 73 | +// SPI definitions |
| 74 | +#ifndef PIN_SPI_SS |
| 75 | + #define PIN_SPI_SS PA4 |
| 76 | +#endif |
| 77 | +#ifndef PIN_SPI_SS1 |
| 78 | + #define PIN_SPI_SS1 PA15 |
| 79 | +#endif |
| 80 | +#ifndef PIN_SPI_SS2 |
| 81 | + #define PIN_SPI_SS2 PB2 |
| 82 | +#endif |
| 83 | +#ifndef PIN_SPI_SS3 |
| 84 | + #define PIN_SPI_SS3 PNUM_NOT_DEFINED |
| 85 | +#endif |
| 86 | +#ifndef PIN_SPI_MOSI |
| 87 | + #define PIN_SPI_MOSI PA7 |
| 88 | +#endif |
| 89 | +#ifndef PIN_SPI_MISO |
| 90 | + #define PIN_SPI_MISO PA6 |
| 91 | +#endif |
| 92 | +#ifndef PIN_SPI_SCK |
| 93 | + #define PIN_SPI_SCK PA5 |
| 94 | +#endif |
| 95 | + |
| 96 | +// I2C definitions |
| 97 | +#ifndef PIN_WIRE_SDA |
| 98 | + #define PIN_WIRE_SDA PA10 |
| 99 | +#endif |
| 100 | +#ifndef PIN_WIRE_SCL |
| 101 | + #define PIN_WIRE_SCL PA9 |
| 102 | +#endif |
| 103 | + |
| 104 | +// Timer Definitions |
| 105 | +#ifndef TIMER_TONE |
| 106 | + #define TIMER_TONE TIM16 |
| 107 | +#endif |
| 108 | +#ifndef TIMER_SERVO |
| 109 | + #define TIMER_SERVO TIM17 |
| 110 | +#endif |
| 111 | + |
| 112 | +// UART Definitions |
| 113 | +#ifndef SERIAL_UART_INSTANCE |
| 114 | + #define SERIAL_UART_INSTANCE 101 |
| 115 | +#endif |
| 116 | + |
| 117 | +// Default pin used for generic 'Serial' instance |
| 118 | +// Mandatory for Firmata |
| 119 | +#ifndef PIN_SERIAL_RX |
| 120 | + #define PIN_SERIAL_RX PA3 |
| 121 | +#endif |
| 122 | +#ifndef PIN_SERIAL_TX |
| 123 | + #define PIN_SERIAL_TX PA2 |
| 124 | +#endif |
| 125 | + |
| 126 | +// Extra HAL modules |
| 127 | +#if !defined(HAL_DAC_MODULE_DISABLED) |
| 128 | + #define HAL_DAC_MODULE_ENABLED |
| 129 | +#endif |
| 130 | + |
| 131 | +/*---------------------------------------------------------------------------- |
| 132 | + * Arduino objects - C++ only |
| 133 | + *----------------------------------------------------------------------------*/ |
| 134 | + |
| 135 | +#ifdef __cplusplus |
| 136 | + // These serial port names are intended to allow libraries and architecture-neutral |
| 137 | + // sketches to automatically default to the correct port name for a particular type |
| 138 | + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, |
| 139 | + // the first hardware serial port whose RX/TX pins are not dedicated to another use. |
| 140 | + // |
| 141 | + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor |
| 142 | + // |
| 143 | + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial |
| 144 | + // |
| 145 | + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library |
| 146 | + // |
| 147 | + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. |
| 148 | + // |
| 149 | + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX |
| 150 | + // pins are NOT connected to anything by default. |
| 151 | + #ifndef SERIAL_PORT_MONITOR |
| 152 | + #define SERIAL_PORT_MONITOR Serial |
| 153 | + #endif |
| 154 | + #ifndef SERIAL_PORT_HARDWARE |
| 155 | + #define SERIAL_PORT_HARDWARE Serial |
| 156 | + #endif |
| 157 | +#endif |
0 commit comments