|
| 1 | +/* |
| 2 | + ******************************************************************************* |
| 3 | + * Copyright (c) 2019, STMicroelectronics |
| 4 | + * All rights reserved. |
| 5 | + * |
| 6 | + * Redistribution and use in source and binary forms, with or without |
| 7 | + * modification, are permitted provided that the following conditions are met: |
| 8 | + * |
| 9 | + * 1. Redistributions of source code must retain the above copyright notice, |
| 10 | + * this list of conditions and the following disclaimer. |
| 11 | + * 2. Redistributions in binary form must reproduce the above copyright notice, |
| 12 | + * this list of conditions and the following disclaimer in the documentation |
| 13 | + * and/or other materials provided with the distribution. |
| 14 | + * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| 15 | + * may be used to endorse or promote products derived from this software |
| 16 | + * without specific prior written permission. |
| 17 | + * |
| 18 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 21 | + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 22 | + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 23 | + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 24 | + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 25 | + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 26 | + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 | + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | + ******************************************************************************* |
| 29 | + */ |
| 30 | + |
| 31 | +#pragma once |
| 32 | + |
| 33 | +/*---------------------------------------------------------------------------- |
| 34 | + * Pins |
| 35 | + *----------------------------------------------------------------------------*/ |
| 36 | + |
| 37 | +#define PA10 0 // UART1_RX |
| 38 | +#define PA9 1 // UART1_TX |
| 39 | +#define PA12 2 |
| 40 | +#define PC6 3 |
| 41 | +#define PB15 4 |
| 42 | +#define PB14 5 |
| 43 | +#define PA8 6 |
| 44 | +#define PB13 7 |
| 45 | +#define PC7 8 |
| 46 | +#define PB3 9 |
| 47 | +#define PB0 10 // SPI_CS |
| 48 | +#define PA7 11 // SPI_MOSI |
| 49 | +#define PA6 12 // SPI_MISO |
| 50 | +#define PA5 13 // SPI_CLK |
| 51 | +#define PB9 14 // SDA |
| 52 | +#define PB8 15 // SCL |
| 53 | + |
| 54 | +//SERIAL PINS |
| 55 | +#define PA3 16 |
| 56 | +#define PA2 17 |
| 57 | +#define PA0 18 |
| 58 | +#define PA1 19 |
| 59 | + |
| 60 | +//TOP PIN CONN |
| 61 | +#define PA11 20 |
| 62 | +#define PA15 21 |
| 63 | +#define PD0 22 |
| 64 | +#define PD1 23 |
| 65 | +#define PD2 24 |
| 66 | +#define PD3 25 |
| 67 | +#define PD4 26 |
| 68 | +#define PB4 27 |
| 69 | +#define PB5 28 |
| 70 | +#define PB6 29 |
| 71 | +#define PB7 30 |
| 72 | + |
| 73 | +#define PA14 31 //SCK-BOOT0 |
| 74 | +#define PA13 32 //SWDIO |
| 75 | + |
| 76 | +#define PF0 33 //LED3 |
| 77 | +#define PF1 34 //LED2 |
| 78 | +#define PC13 35 //LED1 |
| 79 | + |
| 80 | +#define PA4 36 // A0 |
| 81 | +#define PB12 37 // A1 |
| 82 | +#define PB11 38 // A2 |
| 83 | +#define PB10 39 // A3 |
| 84 | +#define PB2 40 // A4 |
| 85 | +#define PB1 41 // A5 |
| 86 | + |
| 87 | +// This must be a literal |
| 88 | +#define NUM_DIGITAL_PINS 42 |
| 89 | +// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS |
| 90 | +#define NUM_ANALOG_INPUTS 10 |
| 91 | + |
| 92 | + |
| 93 | +// On-board LED pin number |
| 94 | +#ifndef LED_BUILTIN |
| 95 | + #define LED_BUILTIN PC13 |
| 96 | +#endif |
| 97 | +#define LED1 LED_BUILTIN |
| 98 | +#define LED2 PF0 |
| 99 | +#define LED3 PF1 |
| 100 | + |
| 101 | + |
| 102 | +// SPI Definitions |
| 103 | +#define PIN_SPI_SS PB0 |
| 104 | +#define PIN_SPI_MOSI PA7 |
| 105 | +#define PIN_SPI_MISO PA6 |
| 106 | +#define PIN_SPI_SCK PA5 |
| 107 | + |
| 108 | +// I2C Definitions |
| 109 | +#define PIN_WIRE_SDA PB9 |
| 110 | +#define PIN_WIRE_SCL PB8 |
| 111 | + |
| 112 | +// Timer Definitions |
| 113 | +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin |
| 114 | +#ifndef TIMER_TONE |
| 115 | + #define TIMER_TONE TIM6 |
| 116 | +#endif |
| 117 | +#ifndef TIMER_SERVO |
| 118 | + #define TIMER_SERVO TIM7 |
| 119 | +#endif |
| 120 | + |
| 121 | +#define PIN_DAC1 PA4 |
| 122 | +#define PIN_DAC2 PA5 |
| 123 | + |
| 124 | +// UART Definitions |
| 125 | +#ifndef SERIAL_UART_INSTANCE |
| 126 | + #define SERIAL_UART_INSTANCE 101 //Connected to ST-Link |
| 127 | +#endif |
| 128 | + |
| 129 | +// Default pin used for 'Serial' instance (ex: ST-Link) |
| 130 | +// Mandatory for Firmata |
| 131 | +#ifndef PIN_SERIAL_RX |
| 132 | + #define PIN_SERIAL_RX PA3 |
| 133 | +#endif |
| 134 | +#ifndef PIN_SERIAL_TX |
| 135 | + #define PIN_SERIAL_TX PA2 |
| 136 | +#endif |
| 137 | + |
| 138 | +// Extra HAL modules |
| 139 | +#if !defined(HAL_DAC_MODULE_DISABLED) |
| 140 | + #define HAL_DAC_MODULE_ENABLED |
| 141 | +#endif |
| 142 | + |
| 143 | + |
| 144 | +/*---------------------------------------------------------------------------- |
| 145 | + * Arduino objects - C++ only |
| 146 | + *----------------------------------------------------------------------------*/ |
| 147 | + |
| 148 | +#ifdef __cplusplus |
| 149 | +// These serial port names are intended to allow libraries and architecture-neutral |
| 150 | +// sketches to automatically default to the correct port name for a particular type |
| 151 | +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, |
| 152 | +// the first hardware serial port whose RX/TX pins are not dedicated to another use. |
| 153 | +// |
| 154 | +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor |
| 155 | +// |
| 156 | +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial |
| 157 | +// |
| 158 | +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library |
| 159 | +// |
| 160 | +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. |
| 161 | +// |
| 162 | +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX |
| 163 | +// pins are NOT connected to anything by default. |
| 164 | +#define SERIAL_PORT_MONITOR Serial |
| 165 | +#define SERIAL_PORT_HARDWARE Serial2 |
| 166 | +#endif |
| 167 | + |
0 commit comments