-
Notifications
You must be signed in to change notification settings - Fork 81
Add Adafruit qtpy ch32v203 board #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # v3.21 implemented semantic changes regarding $<TARGET_OBJECTS:...> | ||
| # See https://cmake.org/cmake/help/v3.21/command/target_link_libraries.html#linking-object-libraries-via-target-objects | ||
| cmake_minimum_required(VERSION 3.21) | ||
|
|
||
| add_library(variant INTERFACE) | ||
| add_library(variant_usage INTERFACE) | ||
|
|
||
| target_include_directories(variant_usage INTERFACE | ||
| . | ||
| ) | ||
|
|
||
|
|
||
| target_link_libraries(variant_usage INTERFACE | ||
| base_config | ||
| ) | ||
|
|
||
| target_link_libraries(variant INTERFACE variant_usage) | ||
|
|
||
|
|
||
|
|
||
| add_library(variant_bin STATIC EXCLUDE_FROM_ALL | ||
| PeripheralPins.c | ||
| variant_CH32V203G6_ADAFRUIT_QTPY.cpp | ||
| ) | ||
| target_link_libraries(variant_bin PUBLIC variant_usage) | ||
|
|
||
| target_link_libraries(variant INTERFACE | ||
| variant_bin | ||
| ) | ||
|
|
215 changes: 215 additions & 0 deletions
215
variants/CH32V20x/CH32V203G6_ADAFRUIT_QTPY/PeripheralPins.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,215 @@ | ||
| /** | ||
| ******************************************************************************* | ||
| * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. | ||
| * All rights reserved. | ||
| * | ||
| * This software component is licensed by WCH 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 | ||
| * | ||
| ******************************************************************************* | ||
| */ | ||
|
|
||
| #include "Arduino.h" | ||
| #include "PeripheralPins.h" | ||
|
|
||
| /* ===== | ||
| * Notes: | ||
| * - The pins mentioned Px_y_ALTz are alternative possibilities which use other | ||
| * HW peripheral instances. You can use them the same way as any other "normal" | ||
| * pin (i.e. analogWrite(PA7_ALT1, 128);). | ||
| * | ||
| * - Commented lines are alternative possibilities which are not used per default. | ||
| * If you change them, you will have to know what you do | ||
| * ===== | ||
| */ | ||
|
|
||
| //*** ADC *** | ||
| #ifdef ADC_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_ADC[] = { | ||
| {PA_0, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 0)}, // ADC1_IN0 | ||
| {PA_0_ALT1, ADC2, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 0)}, // ADC2_IN0 | ||
| {PA_1, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 1)}, // ADC1_IN1 | ||
| {PA_1_ALT1, ADC2, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 1)}, // ADC2_IN1 | ||
| {PA_2, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 2)}, // ADC1_IN2 | ||
| {PA_2_ALT1, ADC2, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 2)}, // ADC2_IN2 | ||
| {PA_3, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 3)}, // ADC1_IN3 | ||
| {PA_3_ALT1, ADC2, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 3)}, // ADC2_IN3 | ||
| {PA_4, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 4)}, // ADC1_IN4 | ||
| {PA_4_ALT1, ADC2, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 4)}, // ADC2_IN4 | ||
| {PA_5, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 5)}, // ADC1_IN5 | ||
| {PA_5_ALT1, ADC2, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 5)}, // ADC2_IN5 | ||
| {PA_6, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 6)}, // ADC1_IN6 | ||
| {PA_6_ALT1, ADC2, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 6)}, // ADC2_IN6 | ||
| {PA_7, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 7)}, // ADC1_IN7 | ||
| {PA_7_ALT1, ADC2, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 7)}, // ADC2_IN7 | ||
| {PB_0, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 8)}, // ADC1_IN8 | ||
| {PB_0_ALT1, ADC2, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 8)}, // ADC2_IN8 | ||
| {PB_1, ADC1, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 9)}, // ADC1_IN9 | ||
| {PB_1_ALT1, ADC2, CH_PIN_DATA_EXT(CH_MODE_INPUT, CH_CNF_INPUT_ANALOG, 0, AFIO_NONE, 9)}, // ADC2_IN9 | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| //*** No DAC *** | ||
|
|
||
|
|
||
|
|
||
| //*** I2C *** | ||
| #ifdef I2C_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_I2C_SDA[] = { | ||
| {PB_7, I2C1, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFOD, NOPULL, AFIO_NONE)}, | ||
| {PB_9, I2C1, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFOD, NOPULL, AFIO_Remap_I2C1_ENABLE)}, | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| #ifdef I2C_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_I2C_SCL[] = { | ||
| {PB_6, I2C1, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFOD, NOPULL, AFIO_NONE)}, | ||
| {PB_8, I2C1, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFOD, NOPULL, AFIO_Remap_I2C1_ENABLE)}, | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| //*** TIM *** | ||
| #ifdef TIM_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_TIM[] = { | ||
| {PA_0, TIM2, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM2_DISABLE, 1)}, // TIM2_CH1 | ||
| {PA_1, TIM2, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM2_DISABLE, 2)}, // TIM2_CH2 | ||
| {PA_2, TIM2, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM2_DISABLE, 3)}, // TIM2_CH3 | ||
| {PA_3, TIM2, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM2_DISABLE, 4)}, // TIM2_CH4 | ||
|
|
||
| {PA_6, TIM3, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM3_DISABLE, 1)}, // TIM3_CH1 | ||
| {PA_7, TIM3, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM3_DISABLE, 2)}, // TIM3_CH2 | ||
| {PB_0, TIM3, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM3_DISABLE, 3)}, // TIM3_CH3 | ||
| {PB_1, TIM3, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM3_DISABLE, 4)}, // TIM3_CH4 | ||
|
|
||
| {PB_6, TIM4, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM4_DISABLE, 1)}, // TIM4_CH1 | ||
| {PB_7, TIM4, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM4_DISABLE, 2)}, // TIM4_CH2 | ||
| {PB_8, TIM4, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM4_DISABLE, 3)}, // TIM4_CH3 | ||
| {PB_9, TIM4, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM4_DISABLE, 4)}, // TIM4_CH4 | ||
|
|
||
| {PA_8, TIM1, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM1_DISABLE, 1)}, // TIM1_CH1 | ||
| {PA_9, TIM1, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM1_DISABLE, 2)}, // TIM1_CH2 | ||
| {PA_10, TIM1, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM1_DISABLE, 3)}, // TIM1_CH3 | ||
| {PA_11, TIM1, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM1_DISABLE, 4)}, // TIM1_CH4 | ||
|
|
||
| {PB_13, TIM1, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM1_DISABLE, 1)}, // TIM1_CH1N | ||
| {PB_14, TIM1, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM1_DISABLE, 2)}, // TIM1_CH2N | ||
| {PA_15, TIM1, CH_PIN_DATA_EXT(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, NOPULL, AFIO_Remap_TIM1_DISABLE, 3)}, // TIM1_CH3N | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| //*** UART *** | ||
| #ifdef UART_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_UART_TX[] = { | ||
| {PA_9, USART1, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_NONE)}, | ||
| {PB_6, USART1, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_Remap_USART1_ENABLE)}, | ||
| {PA_2, USART2, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_NONE)}, | ||
| {PB_10,USART3, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_NONE)}, | ||
| {PC_10,USART3, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_FullRemap_USART3_ENABLE)}, | ||
| {PB_0, UART4, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_NONE)}, | ||
| {PA_5, UART4, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_FullRemap_USART4_ENABLE)}, | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| #ifdef UART_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_UART_RX[] = { | ||
| {PA_10, USART1, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_PUPD, PULLUP, AFIO_NONE)}, | ||
| {PB_7, USART1, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_PUPD, PULLUP, AFIO_Remap_USART1_ENABLE)}, | ||
| {PA_3, USART2, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_PUPD, PULLUP, AFIO_NONE)}, | ||
| {PB_11, USART3, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_PUPD, PULLUP, AFIO_NONE)}, | ||
| {PC_11, USART3, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_PUPD, PULLUP, AFIO_FullRemap_USART3_ENABLE)}, | ||
| {PB_1, UART4, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_PUPD, PULLUP, AFIO_NONE)}, | ||
| {PB_5, UART4, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_PUPD, PULLUP, AFIO_FullRemap_USART4_ENABLE)}, | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| #ifdef UART_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_UART_RTS[] = { | ||
| {PA_12, USART1, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_NONE)}, | ||
| {PA_1, USART2, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_NONE)}, | ||
| {PB_14, USART3, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_NONE)}, | ||
| {PB_4, UART4, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_NONE)}, | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| #ifdef UART_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_UART_CTS[] = { | ||
| {PA_11, USART1, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_PUPD, PULLUP, AFIO_NONE)}, | ||
| {PA_0, USART2, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_PUPD, PULLUP, AFIO_NONE)}, | ||
| {PB_13, USART3, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_PUPD, PULLUP, AFIO_NONE)}, | ||
| {PB_3, UART4, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_PUPD, PULLUP, AFIO_NONE)}, | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
|
|
||
| //*** SPI *** | ||
| #ifdef SPI_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_SPI_MOSI[] = { | ||
| {PA_7, SPI1, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_NONE)}, | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| #ifdef SPI_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_SPI_MISO[] = { | ||
| {PA_6, SPI1, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_FLOAT, 0, AFIO_NONE)}, | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| #ifdef SPI_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_SPI_SCLK[] = { | ||
| {PA_5, SPI1, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_NONE)}, | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| #ifdef SPI_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_SPI_SSEL[] = { | ||
| {PA_4, SPI1, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_NONE)}, | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| //*** CAN *** | ||
| #ifdef CAN_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_CAN_RD[] = { | ||
| {PA_11, CAN1, CH_PIN_DATA(CH_MODE_INPUT, GPIO_NOPULL, AFIO_NONE)}, | ||
| {PB_8, CAN1, CH_PIN_DATA(CH_MODE_INPUT, GPIO_NOPULL, AFIO_CAN1_2)}, | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| #ifdef CAN_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_CAN_TD[] = { | ||
| {PA_12, CAN1, CH_PIN_DATA(CH_MODE_AF_PP, GPIO_NOPULL, AFIO_NONE)}, | ||
| {PB_9, CAN1, CH_PIN_DATA(CH_MODE_AF_PP, GPIO_NOPULL, AFIO_CAN1_2)}, | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| //*** No ETHERNET *** | ||
|
|
||
|
|
||
|
|
||
| //*** USB *** | ||
| #ifdef USB_MODULE_ENABLED | ||
| WEAK const PinMap PinMap_USB[] = { | ||
| {PA_11, USB, CH_PIN_DATA(CH_MODE_INPUT, GPIO_NOPULL, AFIO_NONE)}, // USB_DM | ||
| {PA_12, USB, CH_PIN_DATA(CH_MODE_INPUT, GPIO_NOPULL, AFIO_NONE)}, // USB_DP | ||
| {NC, NP, 0} | ||
| }; | ||
| #endif | ||
|
|
||
| //*** No SD *** | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* Alternate pin name */ | ||
| PA_0_ALT1 = PA_0 | ALT1, | ||
| PA_1_ALT1 = PA_1 | ALT1, | ||
| PA_2_ALT1 = PA_2 | ALT1, | ||
| PA_3_ALT1 = PA_3 | ALT1, | ||
| PA_4_ALT1 = PA_4 | ALT1, | ||
| PA_5_ALT1 = PA_5 | ALT1, | ||
| PA_6_ALT1 = PA_6 | ALT1, | ||
| PA_7_ALT1 = PA_7 | ALT1, | ||
| PA_8_ALT1 = PA_8 | ALT1, | ||
| PA_9_ALT1 = PA_9 | ALT1, | ||
| PA_10_ALT1 = PA_10 | ALT1, | ||
| PA_11_ALT1 = PA_11 | ALT1, | ||
| PA_15_ALT1 = PA_15 | ALT1, | ||
| PB_0_ALT1 = PB_0 | ALT1, | ||
| PB_0_ALT2 = PB_0 | ALT2, | ||
| PB_1_ALT1 = PB_1 | ALT1, | ||
| PB_1_ALT2 = PB_1 | ALT2, | ||
| PB_3_ALT1 = PB_3 | ALT1, | ||
| PB_10_ALT1 = PB_10 | ALT1, | ||
| PB_11_ALT1 = PB_11 | ALT1, | ||
|
|
||
| /* SYS_WKUP */ | ||
| #ifdef PWR_WAKEUP_PIN1 | ||
| SYS_WKUP1 = PA_0, | ||
| #endif | ||
| #ifdef PWR_WAKEUP_PIN2 | ||
| SYS_WKUP2 = NC, | ||
| #endif | ||
| #ifdef PWR_WAKEUP_PIN3 | ||
| SYS_WKUP3 = NC, | ||
| #endif | ||
| #ifdef PWR_WAKEUP_PIN4 | ||
| SYS_WKUP4 = NC, | ||
| #endif | ||
| #ifdef PWR_WAKEUP_PIN5 | ||
| SYS_WKUP5 = NC, | ||
| #endif | ||
| #ifdef PWR_WAKEUP_PIN6 | ||
| SYS_WKUP6 = NC, | ||
| #endif | ||
| #ifdef PWR_WAKEUP_PIN7 | ||
| SYS_WKUP7 = NC, | ||
| #endif | ||
| #ifdef PWR_WAKEUP_PIN8 | ||
| SYS_WKUP8 = NC, | ||
| #endif | ||
|
|
||
| /* USB */ | ||
| #ifdef USBCON | ||
| USB_DM = PA_11, | ||
| USB_DP = PA_12, | ||
| #endif |
56 changes: 56 additions & 0 deletions
56
variants/CH32V20x/CH32V203G6_ADAFRUIT_QTPY/variant_CH32V203G6_ADAFRUIT_QTPY.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /** | ||
| ******************************************************************************* | ||
| * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. | ||
| * All rights reserved. | ||
| * | ||
| * This software component is licensed by WCH 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 | ||
| * | ||
| ******************************************************************************* | ||
| */ | ||
|
|
||
| #include "pins_arduino.h" | ||
| #include "hw_config.h" | ||
|
|
||
| // Digital PinName array | ||
| const PinName digitalPin[] = { | ||
| PB_1, // D0/A0 | ||
| PB_0, // D1/A1 | ||
| PA_1, // D2/A2 | ||
| PA_0, // D3/A3 | ||
| PA_2, // D4/TX | ||
| PA_3, // D5/RX | ||
| PA_4, // D6/Neopixel | ||
| PA_5, // D7/SCK | ||
| PA_6, // D8/MISO | ||
| PA_7, // D9/MOSI | ||
| PB_6, // D10/SCL | ||
| PB_7, // D11/SDA | ||
| PB_8, // D12/BOOT0 Button | ||
| }; | ||
|
|
||
| // Analog (Ax) pin number array | ||
| const uint32_t analogInputPin[] = { | ||
| 0, // A0, PB1 | ||
| 1, // A1, PB0 | ||
| 2, // A2, PA1 | ||
| 3, // A3, PA0 | ||
| }; | ||
|
|
||
| extern "C" { | ||
|
|
||
| void pre_init(void) { | ||
| // Enable Flash enhance read mode for full 224KB | ||
| FLASH->KEYR = 0x45670123; // FLASH_Unlock_Fast(); | ||
| FLASH->KEYR = 0xCDEF89AB; | ||
|
|
||
| FLASH->CTLR |= (1 << 24); // Enhanced Read Mode | ||
|
|
||
| FLASH->CTLR |= (1 << 15); // FLASH_Lock_Fast(); | ||
|
|
||
| hw_config_init(); | ||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enable enhanced read mode