synchronize scheduler, now it works

This commit is contained in:
2024-03-08 13:12:55 +01:00
parent 8da88e96c2
commit a4adf6ac27
5 changed files with 20 additions and 34 deletions

14
time.c
View File

@ -1,30 +1,16 @@
#include <msp430g2553.h>
#include <stdint.h>
#include "time.h"
#include "PontCoopScheduler.h"
volatile uint32_t timestamp;
void __attribute__ ((interrupt (TIMER0_A0_VECTOR))) ta0_isr() {
timestamp++;
schUpdate();
}
void timeInit() {
timestamp = 0;
TACCR0 = 32;
TACCTL0 = CCIE;
TACTL = MC_1 | ID_0 | TASSEL_1 | TACLR;
}
uint32_t getMillis() {
return timestamp;
}
void ms_active_delay(uint16_t delay) {
uint32_t start = timestamp;
while (start + delay > timestamp);
}