Born on Stahl's Birthday.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

48 lines
1.2 KiB

#include "main_adc.hh"
#include "utils.hh"
#include <functional>
namespace Heck {
namespace { // anonymous namespace for internal linkage
ld::DaisySeed seed{};
Observer<int> pot1{};
SWTimer scan_pots{};
void init()
{
seed.Init(Constants::CPU_BOOST480MHZ);
seed.StartLog(Constants::Developer::LOG_BLOCKS_BOOT);
{ // ADC config
ld::AdcChannelConfig adc_cfg[1];
adc_cfg[0].InitSingle(ld::DaisySeed::GetPin(Constants::Hardware::PIN_POT_1));
seed.adc.Init(adc_cfg, 1);
seed.adc.Start();
}
scan_pots.set_period(10);
scan_pots.set_callback([](u32) {
pot1.on_change_fuzzy(seed.adc.Get(0), 20, [](int val) {
seed.PrintLine("POT_1: %d", val);
});
});
}
void mainloop()
{
u32&& time_boot_ms{};
while (true) {
time_boot_ms = ld::System::GetNow();
scan_pots.is_it_already_time_again(time_boot_ms);
}
}
} // namespace
} // namespace Heck
int main()
{
Heck::init();
Heck::mainloop();
}