Reduce initial example code to bare minimum
This commit is contained in:
parent
48ef6cc258
commit
973e3bbd28
1 changed files with 13 additions and 29 deletions
32
blink.c
32
blink.c
|
@ -1,35 +1,19 @@
|
||||||
#include "ch32fun.h"
|
#include "ch32fun.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
// use defines to make more meaningful names for our GPIO pins
|
#define LED_PIN PD6
|
||||||
#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( PIN_1, GPIO_Speed_10MHz | GPIO_CNF_OUT_PP );
|
funPinMode(LED_PIN, 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);
|
||||||
funDigitalWrite( PIN_1, FUN_HIGH );
|
Delay_Ms(250);
|
||||||
funDigitalWrite( PIN_K, FUN_HIGH );
|
funDigitalWrite(LED_PIN, FUN_LOW);
|
||||||
funDigitalWrite( PIN_BOB, FUN_HIGH );
|
Delay_Ms(250);
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue