Compare commits

..

No commits in common. "973e3bbd28d6b954a507376c565d81499867671c" and "cda428717106b73a505632f3bdd3757f66038350" have entirely different histories.

4 changed files with 35 additions and 29 deletions

View file

@ -1,8 +0,0 @@
BasedOnStyle: LLVM
IndentWidth: 4 # Use 4 spaces for indentation
TabWidth: 4 # Tab width is also 4 spaces
UseTab: Never # Always use spaces instead of tabs
ColumnLimit: 80 # Wrap lines after 80 characters
AllowShortLoopsOnASingleLine: true
AlwaysBreakTemplateDeclarations: true
BreakConstructorInitializers: BeforeComma

2
.gitignore vendored
View file

@ -6,5 +6,3 @@ ch32fun.h
ch32fun.ld ch32fun.ld
ch32v003hw.h ch32v003hw.h
ch32v003.ld ch32v003.ld
.cache
compile_commands.json

View file

@ -52,14 +52,14 @@ ch32%:
@echo "Fetching $@" @echo "Fetching $@"
@curl $(CURL_FLAGS) $(BASE)/$@ @curl $(CURL_FLAGS) $(BASE)/$@
%.bin : %.elf $(TARGET).bin : $(TARGET).elf
$(OBJCOPY) -O binary $< $@ @$(OBJCOPY) -O binary $< $(TARGET).bin
%.lst : %.elf $(TARGET).lst : $(TARGET).elf
$(OBJDUMP) -S $^ > $@ @$(OBJDUMP) -S $^ > $(TARGET).lst
%.hex : %.elf $(TARGET).hex : $(TARGET).elf
$(OBJCOPY) -O ihex $< $@ @$(OBJCOPY) -O ihex $< $(TARGET).hex
flash: $(TARGET).bin flash: $(TARGET).bin
minichlink -w $(TARGET).bin flash -b minichlink -w $(TARGET).bin flash -b

32
blink.c
View file

@ -1,19 +1,35 @@
#include "ch32fun.h" #include "ch32fun.h"
#include <stdio.h>
#define LED_PIN PD6 // use defines to make more meaningful names for our GPIO pins
#define PIN_1 PD0
#define PIN_K PD4
#define PIN_BOB PD6
#define PIN_KEVIN PC0
int main() { int main()
{
SystemInit(); SystemInit();
// Enable GPIOs // Enable GPIOs
funGpioInitAll(); funGpioInitAll();
funPinMode(LED_PIN, GPIO_Speed_10MHz | GPIO_CNF_OUT_PP); funPinMode( PIN_1, GPIO_Speed_10MHz | GPIO_CNF_OUT_PP );
funPinMode( PIN_K, GPIO_Speed_10MHz | GPIO_CNF_OUT_PP );
funPinMode( PIN_BOB, GPIO_Speed_10MHz | GPIO_CNF_OUT_PP );
funPinMode( PIN_KEVIN, GPIO_Speed_10MHz | GPIO_CNF_OUT_PP );
while (1) { while(1)
funDigitalWrite(LED_PIN, FUN_HIGH); {
Delay_Ms(250); funDigitalWrite( PIN_1, FUN_HIGH );
funDigitalWrite(LED_PIN, FUN_LOW); funDigitalWrite( PIN_K, FUN_HIGH );
Delay_Ms(250); funDigitalWrite( PIN_BOB, FUN_HIGH );
funDigitalWrite( PIN_KEVIN, FUN_HIGH );
Delay_Ms( 250 );
funDigitalWrite( PIN_1, FUN_LOW );
funDigitalWrite( PIN_K, FUN_LOW );
funDigitalWrite( PIN_BOB, FUN_LOW );
funDigitalWrite( PIN_KEVIN, FUN_LOW );
Delay_Ms( 250 );
} }
} }