Skip to content

Commit f2a2db4

Browse files
committed
add varitn GENERIC NODE TTN
Based in https://www.genericnode.com/
1 parent 8d7c806 commit f2a2db4

File tree

2 files changed

+212
-0
lines changed

2 files changed

+212
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2020-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+
#if defined(ARDUINO_GENERIC_NODE)
14+
#include "pins_arduino.h"
15+
16+
// Digital PinName array
17+
const PinName digitalPin[] = {
18+
PB_3, // D0/USR_BTN/SWO/RTS
19+
PA_15, // D1/BUZZER
20+
PA_2, // D2/TX
21+
PA_3, // D3/RX
22+
PA_11, // D4/SDA2/A1
23+
PA_12, // D5/SCL2/A2
24+
PA_13, // D6/A3/SWDIO
25+
PA_14, // D7/A4/SWCLK
26+
PA_0, // D8/FE_CTRL1
27+
PA_1, // D9/FE_CTRL2
28+
PA_4, // D10/CS1 FLASH
29+
PA_5, // D11/SCK1
30+
PA_6, // D12/MISO
31+
PA_7, // D13/MOSI
32+
PA_8, // D14/ACCEL_INT2
33+
PA_9, // D15/SCL1
34+
PA_10, // D16/SDA1
35+
PB_0, // D17/VDD_TCX0
36+
PB_2, // D18/VABAT_ADC/A0
37+
PB_4, // D19/VBAT_READ_EN
38+
PB_5, // D20/LED_RED
39+
PB_6, // D21/LED_GREEN
40+
PB_7, // D22/LED_BLUE
41+
PB_8, // D23/FE_CTRL3
42+
PB_12, // D24/LS2_FLASH_EN
43+
PC_13, // D25/LS1_SENSORS_EN
44+
PH_3 // D26/BOOT0
45+
};
46+
47+
// Analog (Ax) pin number array
48+
const uint32_t analogInputPin[] = {
49+
18, // A0, PB2
50+
4, // A1, PA11
51+
5, // A2, PA12
52+
6, // A3, PA13
53+
7, // A4, PA14
54+
};
55+
56+
#endif /* ARDUINO_GENERIC_* */
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2020-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 PB3 0
19+
#define PA15 1
20+
#define PA2 2
21+
#define PA3 3
22+
#define PA11 PIN_A1
23+
#define PA12 PIN_A2
24+
#define PA13 PIN_A3
25+
#define PA14 PIN_A4
26+
#define PA0 5
27+
#define PA1 6
28+
#define PA4 7
29+
#define PA5 8
30+
#define PA6 9
31+
#define PA7 10
32+
#define PA8 11
33+
#define PA9 12
34+
#define PA10 13
35+
#define PB0 14
36+
#define PB2 15
37+
#define PB4 16
38+
#define PB5 17
39+
#define PB6 PIN_A0
40+
#define PB7 19
41+
#define PB8 20
42+
#define PB12 21
43+
#define PC13 22
44+
#define PH3 23
45+
46+
// Alternate pins number
47+
#define PA1_ALT1 (PA1 | ALT1)
48+
#define PA2_ALT1 (PA2 | ALT1)
49+
#define PA3_ALT1 (PA3 | ALT1)
50+
#define PA7_ALT1 (PA7 | ALT1)
51+
#define PB8_ALT1 (PB8 | ALT1)
52+
53+
#define NUM_DIGITAL_PINS 23
54+
#define NUM_ANALOG_INPUTS 4
55+
56+
// On-board LED pin number
57+
#define LED_RED PB5
58+
#ifndef LED_BUILTIN
59+
#define LED_BUILTIN LED_RED
60+
#endif
61+
#define LED_GREEN PB6
62+
#define LED_BLUE PB7
63+
64+
65+
// On-board user button
66+
#define B1_BTN PB3
67+
#ifndef USER_BTN
68+
#define USER_BTN B1_BTN
69+
#endif
70+
71+
// SPI definitions
72+
#ifndef PIN_SPI_SS
73+
#define PIN_SPI_SS PA4
74+
#endif
75+
#ifndef PIN_SPI_SS1
76+
#define PIN_SPI_SS1 PA15
77+
#endif
78+
#ifndef PIN_SPI_SS2
79+
#define PIN_SPI_SS2 PB2
80+
#endif
81+
#ifndef PIN_SPI_SS3
82+
#define PIN_SPI_SS3 PNUM_NOT_DEFINED
83+
#endif
84+
#ifndef PIN_SPI_MOSI
85+
#define PIN_SPI_MOSI PA7
86+
#endif
87+
#ifndef PIN_SPI_MISO
88+
#define PIN_SPI_MISO PA6
89+
#endif
90+
#ifndef PIN_SPI_SCK
91+
#define PIN_SPI_SCK PA5
92+
#endif
93+
94+
// I2C definitions
95+
#ifndef PIN_WIRE_SDA
96+
#define PIN_WIRE_SDA PA10
97+
#endif
98+
#ifndef PIN_WIRE_SCL
99+
#define PIN_WIRE_SCL PA9
100+
#endif
101+
102+
// Timer Definitions
103+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
104+
#ifndef TIMER_TONE
105+
#define TIMER_TONE TIM16
106+
#endif
107+
#ifndef TIMER_SERVO
108+
#define TIMER_SERVO TIM17
109+
#endif
110+
111+
// UART Definitions
112+
#ifndef SERIAL_UART_INSTANCE
113+
#define SERIAL_UART_INSTANCE 101
114+
#endif
115+
116+
// Default pin used for generic 'Serial' instance
117+
// Mandatory for Firmata
118+
#ifndef PIN_SERIAL_RX
119+
#define PIN_SERIAL_RX PA3
120+
#endif
121+
#ifndef PIN_SERIAL_TX
122+
#define PIN_SERIAL_TX PA2
123+
#endif
124+
125+
// Extra HAL modules
126+
#if !defined(HAL_DAC_MODULE_DISABLED)
127+
#define HAL_DAC_MODULE_ENABLED
128+
#endif
129+
130+
/*----------------------------------------------------------------------------
131+
* Arduino objects - C++ only
132+
*----------------------------------------------------------------------------*/
133+
134+
#ifdef __cplusplus
135+
// These serial port names are intended to allow libraries and architecture-neutral
136+
// sketches to automatically default to the correct port name for a particular type
137+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
138+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
139+
//
140+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
141+
//
142+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
143+
//
144+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
145+
//
146+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
147+
//
148+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
149+
// pins are NOT connected to anything by default.
150+
#ifndef SERIAL_PORT_MONITOR
151+
#define SERIAL_PORT_MONITOR Serial
152+
#endif
153+
#ifndef SERIAL_PORT_HARDWARE
154+
#define SERIAL_PORT_HARDWARE Serial
155+
#endif
156+
#endif

0 commit comments

Comments
 (0)