Skip to content

Commit c945906

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 89ace4f commit c945906

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+
14+
15+
#include "pins_arduino.h"
16+
#include "hw_config.h"
17+
18+
19+
// Digital PinName array
20+
const PinName digitalPin[] = {
21+
PA_0, // D0/A0
22+
PA_1, // D1/A1
23+
PA_2, // D2/A2
24+
PA_3, // D3/A3
25+
PA_4, // D4/A4
26+
PA_5, // D5/A5
27+
PA_6, // D6/A6
28+
PA_7, // D7/A7
29+
PA_9, // D8
30+
PA_13, // D9
31+
PA_14, // D10
32+
PA_15, // D11
33+
PB_0, // D12/A8
34+
PB_1, // D13/A9
35+
PB_3, // D14
36+
PB_4, // D15
37+
PB_5, // D16
38+
PB_6, // D17
39+
PB_7, // D18
40+
PB_8, // D19/BOOT0
41+
PD_0, // D20/NEOPIXEL_PIN
42+
PD_1, // D21
43+
};
44+
// note: PA_11 and PA_12 are connected to USB connector
45+
// note: PA_8, PA_10 and PB_2 are not available on CH32V203G6U6
46+
47+
48+
// Analog (Ax) pin number array
49+
const uint32_t analogInputPin[] = {
50+
0, // A0, PA0
51+
1, // A1, PA1
52+
2, // A2, PA2
53+
3, // A3, PA3
54+
4, // A4, PA4
55+
5, // A5, PA5
56+
6, // A6, PA6
57+
7, // A7, PA7
58+
12, // A8, PB0
59+
13, // A9, PB1
60+
};
61+
62+
63+
extern "C" {
64+
65+
66+
void pre_init(void) {
67+
hw_config_init();
68+
69+
70+
// Enable PD0 and PD1 as GPIO
71+
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
72+
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);
73+
GPIO_PinRemapConfig(GPIO_Remap_PD01, ENABLE);
74+
75+
76+
// Enable PA13 and PA14 as GPIO
77+
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
78+
}
79+
80+
81+
}

0 commit comments

Comments
 (0)