|
| 1 | +/* |
| 2 | + ******************************************************************************* |
| 3 | + * Copyright (c) 2020, 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 PA0 0 |
| 19 | +#define PA1 1 |
| 20 | +#define PA2 2 |
| 21 | +#define PA3 3 |
| 22 | +#define PA4 4 |
| 23 | +#define PA5 5 |
| 24 | +#define PA6 6 |
| 25 | +#define PA7 7 |
| 26 | +#define PA8 8 |
| 27 | +#define PA9 9 |
| 28 | +#define PA10 PIN_A3 |
| 29 | +#define PA11 PIN_A7 |
| 30 | +#define PA12 PIN_A8 |
| 31 | +#define PA13 PIN_A5 |
| 32 | +#define PA14 PIN_A6 |
| 33 | +#define PA15 PIN_A4 |
| 34 | +#define PB2 PIN_A2 |
| 35 | +#define PB3 PIN_A0 |
| 36 | +#define PB4 PIN_A1 |
| 37 | +#define PB5 19 |
| 38 | +#define PB6 20 |
| 39 | +#define PB7 21 |
| 40 | +#define PB8 22 |
| 41 | +#define PB12 23 |
| 42 | +#define PC13 24 |
| 43 | +#define PH3 25 |
| 44 | + |
| 45 | +// Not available |
| 46 | +// PB0 |
| 47 | +// PC14 |
| 48 | +// PC15 |
| 49 | + |
| 50 | +// Alternate pins number |
| 51 | +#define PA1_ALT1 (PA1 | ALT1) |
| 52 | +#define PA2_ALT1 (PA2 | ALT1) |
| 53 | +#define PA3_ALT1 (PA3 | ALT1) |
| 54 | +#define PA4_ALT1 (PA4 | ALT1) |
| 55 | +#define PA5_ALT1 (PA5 | ALT1) |
| 56 | +#define PA6_ALT1 (PA6 | ALT1) |
| 57 | +#define PA7_ALT1 (PA7 | ALT1) |
| 58 | +#define PB8_ALT1 (PB8 | ALT1) |
| 59 | + |
| 60 | +#define NUM_DIGITAL_PINS 26 |
| 61 | +#define NUM_ANALOG_INPUTS 9 |
| 62 | + |
| 63 | +// On-board LED pin number |
| 64 | +#ifndef LED_BUILTIN |
| 65 | + #define LED_BUILTIN PNUM_NOT_DEFINED |
| 66 | +#endif |
| 67 | + |
| 68 | +// On-board user button |
| 69 | +#ifndef USER_BTN |
| 70 | + #define USER_BTN PNUM_NOT_DEFINED |
| 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 PB2 |
| 79 | +#endif |
| 80 | +#ifndef PIN_SPI_SS2 |
| 81 | + #define PIN_SPI_SS2 PNUM_NOT_DEFINED |
| 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_MISOSPI1_SCK |
| 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 PA11 |
| 99 | +#endif |
| 100 | +#ifndef PIN_WIRE_SCL |
| 101 | + #define PIN_WIRE_SCL PA12 |
| 102 | +#endif |
| 103 | + |
| 104 | +// Timer Definitions |
| 105 | +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin |
| 106 | +#ifndef TIMER_TONE |
| 107 | + #define TIMER_TONE TIM16 |
| 108 | +#endif |
| 109 | +#ifndef TIMER_SERVO |
| 110 | + #define TIMER_SERVO TIM17 |
| 111 | +#endif |
| 112 | + |
| 113 | +// UART Definitions |
| 114 | +#ifndef SERIAL_UART_INSTANCE |
| 115 | + #define SERIAL_UART_INSTANCE 101 |
| 116 | +#endif |
| 117 | + |
| 118 | +// Default pin used for generic 'Serial' instance |
| 119 | +// Mandatory for Firmata |
| 120 | +#ifndef PIN_SERIAL_RX |
| 121 | + #define PIN_SERIAL_RX PA3 |
| 122 | +#endif |
| 123 | +#ifndef PIN_SERIAL_TX |
| 124 | + #define PIN_SERIAL_TX PA2 |
| 125 | +#endif |
| 126 | + |
| 127 | +// Alias |
| 128 | +#ifndef DEBUG_SUBGHZSPI_MOSI |
| 129 | + #define DEBUG_SUBGHZSPI_MOSI PA7_ALT1 |
| 130 | +#endif |
| 131 | +#ifndef DEBUG_SUBGHZSPI_MISO |
| 132 | + #define DEBUG_SUBGHZSPI_MISO PA6_ALT1 |
| 133 | +#endif |
| 134 | +#ifndef DEBUG_SUBGHZSPI_SCLK |
| 135 | + #define DEBUG_SUBGHZSPI_SCLK PA5_ALT1 |
| 136 | +#endif |
| 137 | +#ifndef DEBUG_SUBGHZSPI_SS |
| 138 | + #define DEBUG_SUBGHZSPI_SS PA4_ALT1 |
| 139 | +#endif |
| 140 | + |
| 141 | +// Extra HAL modules |
| 142 | +#if !defined(HAL_DAC_MODULE_DISABLED) |
| 143 | + #define HAL_DAC_MODULE_ENABLED |
| 144 | +#endif |
| 145 | + |
| 146 | +// LoRaWAN definitions |
| 147 | +#define LORAWAN_BOARD_HAS_TCXO 1U |
| 148 | +#define LORAWAN_BOARD_HAS_DCDC 1U |
| 149 | +#define LORAWAN_TX_CONFIG RBI_CONF_RFO_HP |
| 150 | + |
| 151 | +#define LORAWAN_RFSWITCH_PINS PB8, PC13 |
| 152 | +#define LORAWAN_RFSWITCH_PIN_COUNT 2 |
| 153 | +#define LORAWAN_RFSWITCH_OFF_VALUES LOW, LOW |
| 154 | +#define LORAWAN_RFSWITCH_RX_VALUES HIGH, LOW |
| 155 | +#define LORAWAN_RFSWITCH_RFO_LP_VALUES LOW, HIGH |
| 156 | +#define LORAWAN_RFSWITCH_RFO_HP_VALUES LOW, HIGH |
| 157 | + |
| 158 | +/*---------------------------------------------------------------------------- |
| 159 | + * Arduino objects - C++ only |
| 160 | + *----------------------------------------------------------------------------*/ |
| 161 | + |
| 162 | +#ifdef __cplusplus |
| 163 | + // These serial port names are intended to allow libraries and architecture-neutral |
| 164 | + // sketches to automatically default to the correct port name for a particular type |
| 165 | + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, |
| 166 | + // the first hardware serial port whose RX/TX pins are not dedicated to another use. |
| 167 | + // |
| 168 | + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor |
| 169 | + // |
| 170 | + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial |
| 171 | + // |
| 172 | + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library |
| 173 | + // |
| 174 | + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. |
| 175 | + // |
| 176 | + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX |
| 177 | + // pins are NOT connected to anything by default. |
| 178 | + #ifndef SERIAL_PORT_MONITOR |
| 179 | + #define SERIAL_PORT_MONITOR Serial |
| 180 | + #endif |
| 181 | + #ifndef SERIAL_PORT_HARDWARE |
| 182 | + #define SERIAL_PORT_HARDWARE Serial |
| 183 | + #endif |
| 184 | +#endif |
0 commit comments