Compare commits
1 Commits
85e960e612
...
ba83d9cdea
Author | SHA1 | Date | |
---|---|---|---|
|
ba83d9cdea |
@ -42,10 +42,10 @@ int main(void)
|
||||
{
|
||||
cm4::InterruptGuardian::enable_interrupts();
|
||||
while(true) {
|
||||
for(auto it = leds.begin(); it != leds.end(); ++it) {
|
||||
nrf52::Gpio * led = *it;
|
||||
led->toggle();
|
||||
delay.ms(200);
|
||||
for(auto it = std::begin(leds); it != std::end(leds); ++it) {
|
||||
nrf52::Gpio * tmp = *it;
|
||||
tmp->toggle();
|
||||
delay.delay(200);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -9,7 +9,7 @@ Delay::Delay()
|
||||
{
|
||||
}
|
||||
|
||||
void Delay::ms(uint64_t time_ms)
|
||||
void Delay::delay(uint64_t time_ms)
|
||||
{
|
||||
this->pause = true;
|
||||
this->timer_set_period_ms(time_ms);
|
||||
|
@ -12,7 +12,7 @@ class Delay
|
||||
|
||||
public:
|
||||
Delay();
|
||||
void ms(uint64_t);
|
||||
void delay(uint64_t);
|
||||
|
||||
void notification();
|
||||
|
||||
|
@ -33,7 +33,6 @@ void VirtualTimerDistributor::register_timer(VirtualTimerInterface *timer)
|
||||
}
|
||||
for(auto it = this->virtual_timer_list.begin(); it != this->virtual_timer_list.end(); ++it) {
|
||||
if(*it == nullptr) {
|
||||
// FIXME: We might need an interrupt lock here?
|
||||
*it = timer;
|
||||
num_registered_timers++;
|
||||
break;
|
||||
@ -46,13 +45,8 @@ void VirtualTimerDistributor::register_timer(VirtualTimerInterface *timer)
|
||||
|
||||
void VirtualTimerDistributor::unregister_timer(VirtualTimerInterface *timer)
|
||||
{
|
||||
if(num_registered_timers == 0) {
|
||||
// FIXME: Error notification
|
||||
return;
|
||||
}
|
||||
for(auto it = this->virtual_timer_list.begin(); it != this->virtual_timer_list.end(); ++it) {
|
||||
if(*it == timer) {
|
||||
// FIXME: We might need an interrupt lock here?
|
||||
*it = nullptr;
|
||||
num_registered_timers--;
|
||||
break;
|
||||
@ -65,7 +59,6 @@ void VirtualTimerDistributor::unregister_timer(VirtualTimerInterface *timer)
|
||||
|
||||
void VirtualTimerDistributor::notify(uint64_t time_ms)
|
||||
{
|
||||
// FIXME: We're still in interrupt context of hw timer interrupt.
|
||||
for(auto it = this->virtual_timer_list.begin(); it != this->virtual_timer_list.end(); ++it) {
|
||||
if(*it != nullptr) {
|
||||
VirtualTimerInterface *vt = *it;
|
||||
|
Loading…
Reference in New Issue
Block a user