Skip to content

Commit af8630b

Browse files
authored
Added LANA TNY board #164
The LANA TNY is a development board by Phyx based on the CH32V203G6U6. It is sold through the official Adafruit store: here It is comparable to the already added Adafruit QT Py CH32V203 (in pull request #136) but has some extra GPIO pins exposed and some slightly different pin arrangement. openwch/arduino_core_ch32#164
1 parent c945906 commit af8630b

File tree

1 file changed

+194
-0
lines changed

1 file changed

+194
-0
lines changed
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
4+
* All rights reserved.
5+
*
6+
* This software component is licensed by WCH 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+
/* ENABLE Peripherals */
17+
#define ADC_MODULE_ENABLED
18+
#define UART_MODULE_ENABLED
19+
#define SPI_MODULE_ENABLED
20+
#define I2C_MODULE_ENABLED
21+
#define TIM_MODULE_ENABLED
22+
23+
24+
/* CH32V203G6 Pins */
25+
#define PA0 0
26+
#define PA1 1
27+
#define PA2 2
28+
#define PA3 3
29+
#define PA4 4
30+
#define PA5 5
31+
#define PA6 6
32+
#define PA7 7
33+
#define PA8 PNUM_NOT_DEFINED
34+
#define PA9 8
35+
#define PA10 PNUM_NOT_DEFINED
36+
#define PA11 PNUM_NOT_DEFINED
37+
#define PA12 PNUM_NOT_DEFINED
38+
#define PA13 9
39+
#define PA14 10
40+
#define PA15 11
41+
#define PB0 12
42+
#define PB1 13
43+
#define PB2 PNUM_NOT_DEFINED
44+
#define PB3 14
45+
#define PB4 15
46+
#define PB5 16
47+
#define PB6 17
48+
#define PB7 18
49+
#define PB8 19
50+
#define PD0 20
51+
#define PD1 21
52+
53+
54+
// Alternate pins number
55+
#define PA0_ALT1 (PA0 | ALT1)
56+
#define PA1_ALT1 (PA1 | ALT1)
57+
#define PA2_ALT1 (PA2 | ALT1)
58+
#define PA3_ALT1 (PA3 | ALT1)
59+
#define PA4_ALT1 (PA4 | ALT1)
60+
#define PA5_ALT1 (PA5 | ALT1)
61+
#define PA6_ALT1 (PA6 | ALT1)
62+
#define PA7_ALT1 (PA7 | ALT1)
63+
#define PA8_ALT1 (PA8 | ALT1)
64+
#define PA9_ALT1 (PA9 | ALT1)
65+
#define PA10_ALT1 (PA10 | ALT1)
66+
#define PA11_ALT1 (PA11 | ALT1)
67+
#define PA15_ALT1 (PA15 | ALT1)
68+
#define PB0_ALT1 (PB0 | ALT1)
69+
#define PB0_ALT2 (PB0 | ALT2)
70+
#define PB1_ALT1 (PB1 | ALT1)
71+
#define PB1_ALT2 (PB1 | ALT2)
72+
#define PB3_ALT1 (PB3 | ALT1)
73+
#define PB10_ALT1 (PB10 | ALT1)
74+
#define PB11_ALT1 (PB11 | ALT1)
75+
76+
77+
#define NUM_DIGITAL_PINS 22
78+
#define NUM_ANALOG_INPUTS 10
79+
// #define ADC_CTLR_ADCAL
80+
#define ADC_RESOLUTION 12
81+
82+
83+
84+
85+
// On-board LED pin number
86+
#ifndef LED_BUILTIN
87+
#define LED_BUILTIN PNUM_NOT_DEFINED
88+
#endif
89+
90+
91+
// On-board NEOPIXEL pin number
92+
#ifndef PIN_NEOPIXEL
93+
#define PIN_NEOPIXEL PD0
94+
#endif
95+
96+
97+
// On-board user button
98+
#ifndef USER_BTN
99+
#define USER_BTN PB8
100+
#endif
101+
102+
103+
// SPI definitions
104+
#ifndef PIN_SPI_SS
105+
#define PIN_SPI_SS PNUM_NOT_DEFINED
106+
#endif
107+
#ifndef PIN_SPI_SS1
108+
#define PIN_SPI_SS1 PNUM_NOT_DEFINED
109+
#endif
110+
#ifndef PIN_SPI_SS2
111+
#define PIN_SPI_SS2 PNUM_NOT_DEFINED
112+
#endif
113+
#ifndef PIN_SPI_SS3
114+
#define PIN_SPI_SS3 PNUM_NOT_DEFINED
115+
#endif
116+
117+
118+
#ifndef PIN_SPI_MOSI
119+
#define PIN_SPI_MOSI PA7
120+
#endif
121+
#ifndef PIN_SPI_MISO
122+
#define PIN_SPI_MISO PA6
123+
#endif
124+
#ifndef PIN_SPI_SCK
125+
#define PIN_SPI_SCK PA5
126+
#endif
127+
128+
129+
// I2C definitions
130+
#ifndef PIN_WIRE_SDA
131+
#define PIN_WIRE_SDA PB7
132+
#endif
133+
#ifndef PIN_WIRE_SCL
134+
#define PIN_WIRE_SCL PB6
135+
#endif
136+
137+
138+
// Timer Definitions
139+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
140+
#ifndef TIMER_TONE
141+
#define TIMER_TONE TIM3
142+
#endif
143+
#ifndef TIMER_SERVO
144+
#define TIMER_SERVO TIM2
145+
#endif
146+
147+
148+
149+
150+
// UART Definitions
151+
#ifndef SERIAL_UART_INSTANCE
152+
#define SERIAL_UART_INSTANCE 2
153+
#endif
154+
// Default pin used for generic 'Serial' instance
155+
// Mandatory for Firmata
156+
#ifndef PIN_SERIAL_RX
157+
#define PIN_SERIAL_RX PA3
158+
#endif
159+
#ifndef PIN_SERIAL_TX
160+
#define PIN_SERIAL_TX PA2
161+
#endif
162+
163+
164+
/*----------------------------------------------------------------------------
165+
* Arduino objects - C++ only
166+
*----------------------------------------------------------------------------*/
167+
168+
169+
#ifdef __cplusplus
170+
// These serial port names are intended to allow libraries and architecture-neutral
171+
// sketches to automatically default to the correct port name for a particular type
172+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
173+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
174+
//
175+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
176+
//
177+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
178+
//
179+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
180+
//
181+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
182+
//
183+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
184+
// pins are NOT connected to anything by default.
185+
#ifndef SERIAL_PORT_MONITOR
186+
#define SERIAL_PORT_MONITOR Serial
187+
#endif
188+
#ifndef SERIAL_PORT_HARDWARE
189+
#define SERIAL_PORT_HARDWARE Serial
190+
#endif
191+
#endif
192+
193+
194+

0 commit comments

Comments
 (0)