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