init stm8 sdcc template repo

This commit is contained in:
2025-12-17 09:52:20 +08:00
commit 1fb18e2461
9 changed files with 967 additions and 0 deletions

17
bsp/inc/delay.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef DELAY_H
#define DELAY_H
#ifndef F_CPU
#warning "F_CPU not defined, using 2MHz by default"
#define F_CPU 2000000UL
#endif
#include <stdint.h>
inline void delay_ms(uint32_t ms) {
for (uint32_t i = 0; i < ((F_CPU / 18 / 1000UL) * ms); i++) {
__asm__("nop");
}
}
#endif /* DELAY_H */