Rename blink.c to main.c
This commit is contained in:
parent
973e3bbd28
commit
e0d4a112c0
3 changed files with 42 additions and 20 deletions
39
main.c
Normal file
39
main.c
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include <ch32fun.h>
|
||||
#include <rsa.h>
|
||||
|
||||
#define LED_PIN PD6
|
||||
#define FREQ 2
|
||||
#define BLINK_DELAY 1000 / FREQ
|
||||
|
||||
void exit_blink() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
funDigitalWrite(LED_PIN, FUN_HIGH);
|
||||
Delay_Ms(50);
|
||||
funDigitalWrite(LED_PIN, FUN_LOW);
|
||||
Delay_Ms(50);
|
||||
}
|
||||
|
||||
while (1){};
|
||||
|
||||
funDigitalWrite(LED_PIN, FUN_HIGH);
|
||||
}
|
||||
|
||||
int main() {
|
||||
SystemInit();
|
||||
|
||||
// Enable GPIOs
|
||||
funGpioInitAll();
|
||||
|
||||
funPinMode(LED_PIN, GPIO_Speed_10MHz | GPIO_CNF_OUT_PP);
|
||||
|
||||
int i = 0;
|
||||
while (i < gcd(930, 10)) {
|
||||
i++;
|
||||
funDigitalWrite(LED_PIN, FUN_HIGH);
|
||||
Delay_Ms(BLINK_DELAY);
|
||||
funDigitalWrite(LED_PIN, FUN_LOW);
|
||||
Delay_Ms(BLINK_DELAY);
|
||||
}
|
||||
|
||||
exit_blink();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue