openwch / arduino_core_ch32

Core library for CH32duino
269 stars 52 forks source link

CH32V103R8T6 has 51 I/O pins but arduino file variant_CH32V103R8T6.h says only 22 #154

Open MostafaKhan1971 opened 1 month ago

MostafaKhan1971 commented 1 month ago

Hi, When I tried to use pin PC7 in a sketch for CH32V103R8T6, the compiler showed this error "Compilation error: 'PC7' was not declared in this scope". When I opened the pin definition file variant_CH32V103R8T6.h I was surprised to see that only 22 IOs are defined instead of the 51 IOs that CH32V103R8T6 has. I searched through the previous repositories and saw it is the same everywhere. I also tried to add the pins manually but due to my lack of expertise I was unable to do so. I would love to get some suggestions on how to handle this.

Screenshot 2024-10-01 001455

`#define PA0 PIN_A0

define PA1 PIN_A1

define PA2 PIN_A2

define PA3 PIN_A3

define PA4 PIN_A4

define PA5 PIN_A5

define PA10 6

define PA9 7

define PA8 8

define PA7 9

define PA6 10

define PB5 11

define PB8 12

define PB9 13

define PB1 14

define PB0 15

define PB12 16

define PB15 17

define PB14 18

define PB13 19

define PB11 20

define PB10 21

// Alternate pins number

define PA0_ALT1 (PA0 | ALT1)

define PA1_ALT1 (PA1 | ALT1)

define PA2_ALT1 (PA2 | ALT1)

define PA3_ALT1 (PA3 | ALT1)

define PA4_ALT1 (PA4 | ALT1)

define PA5_ALT1 (PA5 | ALT1)

#define NUM_DIGITAL_PINS 22

define NUM_ANALOG_INPUTS 6

// #define ADC_CTLR_ADCAL

define ADC_RESOLUTION 12`

maxint-rd commented 1 month ago

Looking at the changed files of PR #20 for reference, it seems that the digital pins are specified not only in variant_CH32V103R8T6.h but also in variant_CH32V103R8T6.cpp. Perhaps you can compare those two files to the ones in PR #20 to see how you can make your changes?

Unfortunately I don't have any CH32V103 chip to join you in your experiments. Good luck!