iot-firmware/src/user_code.cpp

52 lines
692 B
C++
Raw Normal View History

2023-09-29 16:18:21 +00:00
#include <user_code.hpp>
2023-09-29 17:56:25 +00:00
void timer1_callback(){
for(int i=0;i<16;i++){
pwm_set_state(i,1);
}
}
ESPMega_Timer timer1(0,50,timer1_callback,15001);
2023-09-29 16:18:21 +00:00
2023-09-29 17:06:49 +00:00
/*
This Code will run right after ESPMega PRO's
Peripheral Initialization Routine
*/
2023-09-29 17:56:25 +00:00
2023-09-29 17:37:31 +00:00
void user_pre_init()
{
2023-09-29 17:56:25 +00:00
2023-09-29 16:18:21 +00:00
}
2023-09-29 17:06:49 +00:00
/*
This code will run after every component is initialized
*/
2023-09-29 17:37:31 +00:00
void user_init()
{
2023-09-29 17:56:25 +00:00
timer1.begin();
2023-09-29 16:18:21 +00:00
}
2023-09-29 17:06:49 +00:00
/*
This code will run once every event loop
*/
2023-09-29 17:37:31 +00:00
void user_loop()
{
2023-09-29 16:18:21 +00:00
}
2023-09-29 17:06:49 +00:00
/*
This code will run when an input pin changed state
*/
2023-09-29 17:37:31 +00:00
void virtual_interrupt_user_callback(int pin, int state)
{
2023-09-29 16:18:21 +00:00
}
2023-09-29 17:06:49 +00:00
/*
2023-09-29 17:37:31 +00:00
This code will run every 15 seconds
2023-09-29 17:06:49 +00:00
*/
2023-09-29 17:37:31 +00:00
void timer_tick_callback()
{
2023-09-29 17:56:25 +00:00
if(standalone){
timer1.loop();
2023-09-29 17:37:31 +00:00
}
2023-09-29 16:18:21 +00:00
}