forked from stm32duino/Arduino_Core_STM32
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvariant_generic.h
More file actions
145 lines (130 loc) · 4.34 KB
/
variant_generic.h
File metadata and controls
145 lines (130 loc) · 4.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
*******************************************************************************
* Copyright (c) 2020-{{year}}, STMicroelectronics
* All rights reserved.
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
*******************************************************************************
*/
#pragma once
/*----------------------------------------------------------------------------
* STM32 pins number
*----------------------------------------------------------------------------*/
{% for pin_number in pins_number_list %}
#define {{"%-23s %s"|format(pin_number.name, pin_number.val)}}
{% endfor %}
{% if alt_pins_list %}
// Alternate pins number
{% for alt in alt_pins_list %}
#define {{"%-23s (%s | %s)"|format(alt.name, alt.base.ljust(waltpin-5), alt.num)}}
{% endfor %}
{% endif %}
#define NUM_DIGITAL_PINS {{num_digital_pins}}
{% if num_dualpad_pins %}
#define NUM_DUALPAD_PINS {{num_dualpad_pins}}
{% endif %}
{% if num_remap_pins %}
#define NUM_REMAP_PINS {{num_remap_pins}}
{% endif %}
#define NUM_ANALOG_INPUTS {{num_analog_inputs}}
// On-board LED pin number
#ifndef LED_BUILTIN
#define LED_BUILTIN PNUM_NOT_DEFINED
#endif
// On-board user button
#ifndef USER_BTN
#define USER_BTN PNUM_NOT_DEFINED
#endif
// SPI definitions
#ifndef PIN_SPI_SS
#define PIN_SPI_SS {{spi_pins.ss}}
#endif
#ifndef PIN_SPI_SS1
#define PIN_SPI_SS1 {{spi_pins.ss1}}
#endif
#ifndef PIN_SPI_SS2
#define PIN_SPI_SS2 {{spi_pins.ss2}}
#endif
#ifndef PIN_SPI_SS3
#define PIN_SPI_SS3 {{spi_pins.ss3}}
#endif
#ifndef PIN_SPI_MOSI
#define PIN_SPI_MOSI {{spi_pins.mosi}}
#endif
#ifndef PIN_SPI_MISO
#define PIN_SPI_MISO {{spi_pins.miso}}
#endif
#ifndef PIN_SPI_SCK
#define PIN_SPI_SCK {{spi_pins.sck}}
#endif
// I2C definitions
#ifndef PIN_WIRE_SDA
#define PIN_WIRE_SDA {{i2c_pins.sda}}
#endif
#ifndef PIN_WIRE_SCL
#define PIN_WIRE_SCL {{i2c_pins.scl}}
#endif
// Timer Definitions
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
#ifndef TIMER_TONE
#define TIMER_TONE {{timer.tone}}
#endif
#ifndef TIMER_SERVO
#define TIMER_SERVO {{timer.servo}}
#endif
// UART Definitions
#ifndef SERIAL_UART_INSTANCE
#define SERIAL_UART_INSTANCE {{serial.instance}}
#endif
// Default pin used for generic 'Serial' instance
// Mandatory for Firmata
#ifndef PIN_SERIAL_RX
#define PIN_SERIAL_RX {{serial.rx}}
#endif
#ifndef PIN_SERIAL_TX
#define PIN_SERIAL_TX {{serial.tx}}
#endif
{% if hal_modules_list %}
// Extra HAL modules
{% for hal_module in hal_modules_list %}
#if !defined(HAL_{{hal_module}}_MODULE_DISABLED)
#define HAL_{{hal_module}}_MODULE_ENABLED
#endif
{% endfor %}
{% endif %}
{% if alt_syswkup_list %}
// Alternate SYS_WKUP definition
{% for def in alt_syswkup_list %}
#define PWR_WAKEUP_PIN{{def}}
{% endfor %}
{% endif %}
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#ifdef __cplusplus
// These serial port names are intended to allow libraries and architecture-neutral
// sketches to automatically default to the correct port name for a particular type
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
//
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
//
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
//
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
//
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
//
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
// pins are NOT connected to anything by default.
#ifndef SERIAL_PORT_MONITOR
#define SERIAL_PORT_MONITOR Serial
#endif
#ifndef SERIAL_PORT_HARDWARE
#define SERIAL_PORT_HARDWARE Serial
#endif
#endif