Fix delay_us and delay_ns not showing up
This commit is contained in:
parent
9cfd3a8d5a
commit
da60fc9080
@ -9,16 +9,6 @@ void delay_ticks(uint16_t ticks) {
|
|||||||
timer_stop();
|
timer_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1 us * 9.2 MHz / 12 is 69/90
|
|
||||||
// Warning: this will round to the nearest tick
|
|
||||||
#define delay_us(X) \
|
|
||||||
delay_ticks((uint16_t)((((uint32_t)(X)) * 69UL + 89UL) / 90UL));
|
|
||||||
|
|
||||||
// 1 ns * 9.2 MHz / 12 is 69/90000
|
|
||||||
// Warning: this will round to the nearest tick
|
|
||||||
#define delay_ns(X) \
|
|
||||||
delay_ticks((uint16_t)((((uint32_t)(X)) * 69UL + 89999UL) / 90000UL));
|
|
||||||
|
|
||||||
// This loops through delays of one ms in order to avoid overflow
|
// This loops through delays of one ms in order to avoid overflow
|
||||||
void delay_ms(int ms) {
|
void delay_ms(int ms) {
|
||||||
for (int i = 0; i < ms; i++) {
|
for (int i = 0; i < ms; i++) {
|
||||||
|
@ -4,6 +4,17 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
void delay_ticks(uint16_t ticks);
|
void delay_ticks(uint16_t ticks);
|
||||||
|
|
||||||
|
// 1 us * 9.2 MHz / 12 is 69/90
|
||||||
|
// Warning: this will round to the nearest tick
|
||||||
|
#define delay_us(X) \
|
||||||
|
delay_ticks((uint16_t)((((uint32_t)(X)) * 69UL + 89UL) / 90UL));
|
||||||
|
|
||||||
|
// 1 ns * 9.2 MHz / 12 is 69/90000
|
||||||
|
// Warning: this will round to the nearest tick
|
||||||
|
#define delay_ns(X) \
|
||||||
|
delay_ticks((uint16_t)((((uint32_t)(X)) * 69UL + 89999UL) / 90000UL));
|
||||||
|
|
||||||
void delay_ms(int ms);
|
void delay_ms(int ms);
|
||||||
|
|
||||||
#endif // _ARCH_DELAY_H
|
#endif // _ARCH_DELAY_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user