|
| 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 PA3 PIN_A12 |
| 19 | +#define PA2 PIN_A13 |
| 20 | +#define PA10 2 |
| 21 | +#define PB3 3 |
| 22 | +#define PB5 4 |
| 23 | +#define PB4 5 |
| 24 | +#define PB10 6 |
| 25 | +#define PA8 7 |
| 26 | +#define PA9 8 |
| 27 | +#define PC7 9 |
| 28 | +#define PB6 10 // PWM is not supported by D10 as no timer on PB6 |
| 29 | +#define PA7 PIN_A6 |
| 30 | +#define PA6 PIN_A7 |
| 31 | +#define PA5 PIN_A14 |
| 32 | +#define PB9 14 |
| 33 | +#define PB8 15 |
| 34 | +// ST Morpho |
| 35 | +// CN7 Left Side |
| 36 | +#define PC10 16 |
| 37 | +#define PC12 17 |
| 38 | +#define PA13 18 // SWD |
| 39 | +#define PA14 19 // SWD |
| 40 | +#define PA15 20 |
| 41 | +#define PB7 21 |
| 42 | +#define PC13 22 |
| 43 | +#define PC14 23 |
| 44 | +#define PC15 24 |
| 45 | +#define PH0 25 |
| 46 | +#define PH1 26 |
| 47 | +#define PC2 PIN_A8 |
| 48 | +#define PC3 PIN_A9 |
| 49 | +// CN7 Right Side |
| 50 | +#define PC11 29 |
| 51 | +#define PD2 30 |
| 52 | +// CN10 Left Side |
| 53 | +#define PC9 31 |
| 54 | +// CN10 Right side |
| 55 | +#define PC8 32 |
| 56 | +#define PC6 33 |
| 57 | +#define PC5 PIN_A10 |
| 58 | +#define PA12 35 |
| 59 | +#define PA11 36 |
| 60 | +#define PB12 37 |
| 61 | +#define PB11 38 |
| 62 | +#define PB2 39 |
| 63 | +#define PB1 PIN_A15 |
| 64 | +#define PB15 41 |
| 65 | +#define PB14 42 |
| 66 | +#define PB13 43 |
| 67 | +#define PC4 PIN_A11 |
| 68 | +#define PA0 PIN_A0 |
| 69 | +#define PA1 PIN_A1 |
| 70 | +#define PA4 PIN_A2 |
| 71 | +#define PB0 PIN_A3 |
| 72 | +#define PC1 PIN_A4 // SB56 ON SB51 ON on the board! |
| 73 | +#define PC0 PIN_A5 |
| 74 | + |
| 75 | +// Alternate pins number |
| 76 | +#define PA2_ALT1 (PA2 | ALT1) |
| 77 | +#define PA3_ALT1 (PA3 | ALT1) |
| 78 | +#define PA14_ALT1 (PA14 | ALT1) |
| 79 | + |
| 80 | +#define NUM_DIGITAL_PINS 51 |
| 81 | +#define NUM_ANALOG_INPUTS 16 |
| 82 | + |
| 83 | +// On-board LED pin number |
| 84 | +#ifndef LED_BUILTIN |
| 85 | + #define LED_BUILTIN PA5 |
| 86 | +#endif |
| 87 | +#define LED_GREEN LED_BUILTIN |
| 88 | + |
| 89 | +// On-board user button |
| 90 | +#ifndef USER_BTN |
| 91 | + #define USER_BTN PC13 |
| 92 | +#endif |
| 93 | + |
| 94 | +// Timer Definitions |
| 95 | +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin |
| 96 | +#ifndef TIMER_TONE |
| 97 | + #define TIMER_TONE TIM21 |
| 98 | +#endif |
| 99 | +#ifndef TIMER_SERVO |
| 100 | + #define TIMER_SERVO TIM22 |
| 101 | +#endif |
| 102 | + |
| 103 | +// UART Definitions |
| 104 | +#ifndef SERIAL_UART_INSTANCE |
| 105 | + #define SERIAL_UART_INSTANCE 101 |
| 106 | +#endif |
| 107 | + |
| 108 | +// Default pin used for generic 'Serial' instance |
| 109 | +// Mandatory for Firmata |
| 110 | +#ifndef PIN_SERIAL_RX |
| 111 | + #define PIN_SERIAL_RX PA3 |
| 112 | +#endif |
| 113 | +#ifndef PIN_SERIAL_TX |
| 114 | + #define PIN_SERIAL_TX PA2 |
| 115 | +#endif |
| 116 | + |
| 117 | +/*---------------------------------------------------------------------------- |
| 118 | + * Arduino objects - C++ only |
| 119 | + *----------------------------------------------------------------------------*/ |
| 120 | + |
| 121 | +#ifdef __cplusplus |
| 122 | + // These serial port names are intended to allow libraries and architecture-neutral |
| 123 | + // sketches to automatically default to the correct port name for a particular type |
| 124 | + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, |
| 125 | + // the first hardware serial port whose RX/TX pins are not dedicated to another use. |
| 126 | + // |
| 127 | + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor |
| 128 | + // |
| 129 | + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial |
| 130 | + // |
| 131 | + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library |
| 132 | + // |
| 133 | + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. |
| 134 | + // |
| 135 | + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX |
| 136 | + // pins are NOT connected to anything by default. |
| 137 | + #ifndef SERIAL_PORT_MONITOR |
| 138 | + #define SERIAL_PORT_MONITOR Serial |
| 139 | + #endif |
| 140 | + #ifndef SERIAL_PORT_HARDWARE |
| 141 | + #define SERIAL_PORT_HARDWARE Serial |
| 142 | + #endif |
| 143 | +#endif |
0 commit comments