|
| 1 | +/* |
| 2 | + ******************************************************************************* |
| 3 | + * Copyright (c) 2017, 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 | +#include "variant.h" |
| 32 | + |
| 33 | +#ifdef __cplusplus |
| 34 | +extern "C" { |
| 35 | +#endif |
| 36 | + |
| 37 | +// Pin number |
| 38 | +// This array allows to wrap Arduino pin number(Dx or x) |
| 39 | +// to STM32 PinName (PYx) |
| 40 | +const PinName digitalPin[] = { |
| 41 | +//PYx, //Dx |
| 42 | + P, //D0 |
| 43 | + P, //D1 |
| 44 | + P, //D2 |
| 45 | + P, //D3 |
| 46 | + P, //D4 |
| 47 | + P, //D5 |
| 48 | + P, //D6 |
| 49 | + P, //D7 |
| 50 | + P, //D8 |
| 51 | + P, //D9 |
| 52 | + P, //D10 |
| 53 | + P, //D11 |
| 54 | + P, //D12 |
| 55 | + P, //D13 |
| 56 | + P, //D14 |
| 57 | + P, //D15 |
| 58 | + P, //D16 |
| 59 | + P, //D17 |
| 60 | + P, //D18 |
| 61 | + P, //D19 |
| 62 | + P, //D20 |
| 63 | + P, //D21 |
| 64 | + P, //D22 |
| 65 | + P, //D23 |
| 66 | + P, //D24 |
| 67 | + P, //D25 |
| 68 | + P, //D26 |
| 69 | + P, //D27 |
| 70 | + P, //D28 |
| 71 | + P, //D29 |
| 72 | + P, //D30 |
| 73 | + P, //D31 |
| 74 | + P, //D32 |
| 75 | + P, //D33 |
| 76 | + P, //D34 |
| 77 | + P, //D35 |
| 78 | + P, //D36 |
| 79 | + P, //D37 |
| 80 | + P, //D38 |
| 81 | + P, //D39 |
| 82 | + P, //D40 |
| 83 | + P, //D41 |
| 84 | + P, //D42 |
| 85 | + P, //D43 |
| 86 | + P, //D44 |
| 87 | + P, //D45 |
| 88 | + P, //D46 |
| 89 | + P, //D47 |
| 90 | + P, //D48 |
| 91 | + P, //D49 |
| 92 | + P, //D50 |
| 93 | + P, //D51 |
| 94 | + P, //D52 |
| 95 | + P, //D53 |
| 96 | + P, //D54 |
| 97 | + P, //D55 |
| 98 | + P, //D56 |
| 99 | + P, //D57 |
| 100 | + P, //D58 |
| 101 | + P, //D59 |
| 102 | + P, //D60 |
| 103 | + P, //D61 |
| 104 | + P, //D62 |
| 105 | + P, //D63 |
| 106 | + P, //D64 |
| 107 | + P, //D65 |
| 108 | + P, //D66 |
| 109 | + P, //D67 |
| 110 | + P, //D68 |
| 111 | + P, //D69 |
| 112 | + P, //D70 |
| 113 | + P, //D71 |
| 114 | + P, //D72 |
| 115 | + P, //D73 |
| 116 | + P, //D74 |
| 117 | + P, //D75 |
| 118 | + P, //D76 |
| 119 | + P, //D77 |
| 120 | + P, //D78/A0 |
| 121 | + P, //D79/A1 |
| 122 | + P, //D80/A2 |
| 123 | + P, //D81/A3 |
| 124 | + P, //D82/A4 |
| 125 | + P, //D83/A5 |
| 126 | + P, //D84/A6 |
| 127 | + P, //D85/A7 |
| 128 | + P, //D86/A8 |
| 129 | + P, //D87/A9 |
| 130 | + // Duplicated pins in order to be aligned with PinMap_ADC |
| 131 | + P, //D88/A10 = D |
| 132 | + P, //D89/A11 = D |
| 133 | + P, //D90/A12 = D |
| 134 | + P, //D91/A13 = D |
| 135 | + P, //D92/A14 = D |
| 136 | + P, //D93/A15 = D |
| 137 | + P, //D94/A16 = D |
| 138 | + P //D95/A17 = D |
| 139 | +}; |
| 140 | + |
| 141 | +#ifdef __cplusplus |
| 142 | +} |
| 143 | +#endif |
| 144 | + |
| 145 | +/* |
| 146 | + * UART objects |
| 147 | + */ |
| 148 | +// Replace PYx_Rx and PYx_Tx by UART_RX and UART_TX pin names |
| 149 | +HardwareSerial Serial(PYx_Rx, PYx_Tx); // Connected to ST-Link |
| 150 | + |
| 151 | +void serialEvent() __attribute__((weak)); |
| 152 | +void serialEvent() { } |
| 153 | + |
| 154 | +// Define as many Serial instance as desired |
| 155 | +// Replace 'SerialX' by the desired name |
| 156 | +//#ifdef ENABLE_SERIALX |
| 157 | +//HardwareSerial SerialX(PYx_Rx, PYx_Tx); |
| 158 | +// |
| 159 | +//void serialEventx() __attribute__((weak)); |
| 160 | +//void serialEventx() { } |
| 161 | +//#endif |
| 162 | + |
| 163 | +void serialEventRun(void) |
| 164 | +{ |
| 165 | + if (Serial.available()) serialEvent(); |
| 166 | +//#ifdef ENABLE_SERIALX |
| 167 | +// if (SerialX.available()) serialEventX(); |
| 168 | +//#endif |
| 169 | +} |
| 170 | + |
| 171 | +// ---------------------------------------------------------------------------- |
| 172 | + |
| 173 | +#ifdef __cplusplus |
| 174 | +extern "C" { |
| 175 | +#endif |
| 176 | + |
| 177 | +/** |
| 178 | + * @brief System Clock Configuration |
| 179 | + * @param None |
| 180 | + * @retval None |
| 181 | + */ |
| 182 | +WEAK void SystemClock_Config(void) |
| 183 | +{ |
| 184 | +// Here copy the desired System Clock Configuration |
| 185 | +// It could be generated thanks STM32CubeMX after code generation for Toolchain/IDE: 'SW4STM32', |
| 186 | +// available in src/main.c |
| 187 | +// or |
| 188 | +// copied from a STM32CubeYY project examples |
| 189 | +// where 'YY' could be F0, F1, F2, F3, F4, F7, L0, L1, L4 |
| 190 | +} |
| 191 | + |
| 192 | +#ifdef __cplusplus |
| 193 | +} |
| 194 | +#endif |
0 commit comments