variant.h


1
/*
2
  Copyright (c) 2011 Arduino.  All right reserved.
3
4
  This library is free software; you can redistribute it and/or
5
  modify it under the terms of the GNU Lesser General Public
6
  License as published by the Free Software Foundation; either
7
  version 2.1 of the License, or (at your option) any later version.
8
9
  This library is distributed in the hope that it will be useful,
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
  See the GNU Lesser General Public License for more details.
13
14
  You should have received a copy of the GNU Lesser General Public
15
  License along with this library; if not, write to the Free Software
16
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
*/
18
19
#ifndef _VARIANT_ARDUINO_STM32_
20
#define _VARIANT_ARDUINO_STM32_
21
22
/*----------------------------------------------------------------------------
23
 *        Headers
24
 *----------------------------------------------------------------------------*/
25
#include "PeripheralPins.h"
26
27
#ifdef __cplusplus
28
extern "C"{
29
#endif // __cplusplus
30
31
/*----------------------------------------------------------------------------
32
 *        Pins
33
 *----------------------------------------------------------------------------*/
34
extern const PinName digitalPin[];
35
36
enum {
37
  PA3,  //D0
38
  PA2,  //D1
39
  PA10, //D2
40
  PB3,  //D3
41
  PB5,  //D4
42
  PB4,  //D5
43
  PB10, //D6
44
  PA8,  //D7
45
  PA9,  //D8
46
  PC7,  //D9
47
  PB6,  //D10
48
  PA7,  //D11
49
  PA6,  //D12
50
  PA5,  //D13
51
  PB9,  //D14
52
  PB8,  //D15
53
// ST Morpho
54
// CN7 Left Side
55
  PC10, //D16
56
  PC12, //D17
57
  NC_1, //D18 - BOOT0
58
  PA13, //D19 - SWD
59
  PA14, //D20 - SWD
60
  PA15, //D21
61
  PB7,  //D22
62
  PC13, //D23
63
  PC14, //D24
64
  PC15, //D25
65
  PH0,  //D26
66
  PH1,  //D27
67
  PC2,  //D28
68
  PC3,  //D29
69
// CN7 Right Side
70
  PC11, //D30
71
  PD2,  //D31
72
// CN10 Left Side
73
  PC9,  //D32
74
// CN10 Right side
75
  PC8,  //D33
76
  PC6,  //D34
77
  PC5,  //D35
78
  PA12, //D36
79
  PA11, //D37
80
  PB12, //D38
81
  PB11, //D39
82
  PB2,  //D40
83
  PB1,  //D41
84
  PB15, //D42
85
  PB14, //D43
86
  PB13, //D44
87
  PC4,  //D45
88
  PA0,  //D46/A0
89
  PA1,  //D47/A1
90
  PA4,  //D48/A2
91
  PB0,  //D49/A3
92
  PC1,  //D50/A4
93
  PC0,  //D51/A5
94
  // Duplicated pins in order to be aligned with PinMap_ADC
95
  PA7_2,//D52/A6  = D11
96
  PA6_2,//D53/A7  = D12
97
  PC2_2,//D54/A8  = D28
98
  PC3_2,//D55/A9  = D29
99
  PC5_2,//D56/A10 = D35
100
  PC4_2,//D57/A11 = D45
101
  PEND
102
};
103
104
// This must be a literal with the same value as PEND
105
#define NUM_DIGITAL_PINS        58
106
// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
107
#define NUM_ANALOG_INPUTS       12
108
#define NUM_ANALOG_FIRST        46
109
110
// On-board LED pin number
111
#define LED_BUILTIN             13
112
#define LED_GREEN               LED_BUILTIN
113
114
// On-board user button
115
#define USER_BTN                PC13
116
117
// Timer Definitions
118
// Do not use timer used by PWM pins when possible. See PinMap_PWM.
119
#define TIMER_TONE              TIM6
120
121
// Do not use basic timer: OC is required
122
#define TIMER_SERVO             TIM2  //TODO: advanced-control timers don't work
123
124
// UART Definitions
125
#define SERIAL_UART_INSTANCE    1 //Connected to ST-Link
126
// Default pin used for 'Serial' instance (ex: ST-Link)
127
// Mandatory for Firmata
128
#define PIN_SERIAL_RX           PA10
129
#define PIN_SERIAL_TX           PA9
130
131
#ifdef __cplusplus
132
} // extern "C"
133
#endif
134
/*----------------------------------------------------------------------------
135
 *        Arduino objects - C++ only
136
 *----------------------------------------------------------------------------*/
137
138
#ifdef __cplusplus
139
// These serial port names are intended to allow libraries and architecture-neutral
140
// sketches to automatically default to the correct port name for a particular type
141
// of use.  For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
142
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
143
//
144
// SERIAL_PORT_MONITOR        Port which normally prints to the Arduino Serial Monitor
145
//
146
// SERIAL_PORT_USBVIRTUAL     Port which is USB virtual serial
147
//
148
// SERIAL_PORT_LINUXBRIDGE    Port which connects to a Linux system via Bridge library
149
//
150
// SERIAL_PORT_HARDWARE       Hardware serial port, physical RX & TX pins.
151
//
152
// SERIAL_PORT_HARDWARE_OPEN  Hardware serial ports which are open for use.  Their RX & TX
153
//                            pins are NOT connected to anything by default.
154
#define SERIAL_PORT_MONITOR     Serial
155
#define SERIAL_PORT_HARDWARE    Serial
156
#endif
157
158
#endif /* _VARIANT_ARDUINO_STM32_ */