#include "tone.hpp" #include "tones.hpp" #include "dac.hpp" #include "timing.hpp" #include "util.hpp" #include "scheduler.hpp" #include "indicator.hpp" static unsigned long int micros_at = 0; static bool led_state = true; inline unsigned long micros_diff() { unsigned long now = micros(); unsigned long diff = now - micros_at; micros_at = now; return diff; } void setup() { dac::init(); tones::init(); scheduler::init(); indicator::init(); } void loop() { if(scheduler::running && timing::at >= scheduler::timestamp) { scheduler::do_all(); indicator::update(); } timing::update(); float value = 0; uint32_t passed = timing::diff; for(int i = 0; i < tones::active; i++) { Tone& t = tones::all[i]; t.update(passed); value += t.get(); } dac::set(value); }