Skip to content

Commit

Permalink
Avoid bricking CH32V003J4M6
Browse files Browse the repository at this point in the history
  • Loading branch information
limingjie committed Aug 1, 2023
1 parent e28a05b commit 1100cdf
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions examples/debugprintfdemo/debugprintfdemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,20 @@ int main()
GPIOD->CFGLR &= ~(0xf<<(4*0));
GPIOD->CFGLR |= (GPIO_Speed_10MHz | GPIO_CNF_OUT_PP)<<(4*0);

// GPIO D4 Push-Pull
GPIOD->CFGLR &= ~(0xf<<(4*4));
GPIOD->CFGLR |= (GPIO_Speed_10MHz | GPIO_CNF_OUT_PP)<<(4*4);

// GPIO C0 Push-Pull
GPIOC->CFGLR &= ~(0xf<<(4*0));
GPIOC->CFGLR |= (GPIO_Speed_10MHz | GPIO_CNF_OUT_PP)<<(4*0);

while(1)
{
GPIOD->BSHR = 1 | (1<<4); // Turn on GPIOs
GPIOD->BSHR = 1; // Turn on GPIOs
GPIOC->BSHR = 1;
printf( "+%lu\n", count++ );
Delay_Ms(100);
int i;
for( i = 0; i < 10000; i++ )
poll_input();
GPIOD->BSHR = (1<<16) | (1<<(16+4)); // Turn off GPIODs
GPIOD->BSHR = (1<<16); // Turn off GPIODs
GPIOC->BSHR = (1<<16);
printf( "-%lu[%c]\n", count++, last );
Delay_Ms(100);
Expand Down

0 comments on commit 1100cdf

Please sign in to comment.