Rename blink.c to main.c

This commit is contained in:
Imbus 2025-02-10 18:54:17 +01:00
parent 973e3bbd28
commit e0d4a112c0
3 changed files with 42 additions and 20 deletions

39
main.c Normal file
View 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();
}