main: periodically transmit code

This commit is contained in:
King Kévin 2022-10-12 17:37:16 +02:00
parent e813e6bf46
commit 02e5fbdbf5
1 changed files with 6 additions and 0 deletions

6
main.c
View File

@ -44,6 +44,8 @@ static volatile uint32_t time_count = 0;
// time after last shake to go to sleep, in seconds
#define REST_TIME (5 * 60U)
// period to send our color code, in seconds
#define SHARE_TIME (1U)
// time counts per us (1/(16E6/(3+1)) * 1000*1000 = 0.25 us)
#define NEC_TICKS_PER_US 4UL
@ -405,6 +407,10 @@ void main(void)
}
nec_flag = false; // clear flag
}
if (0 == time_count % (488UL * SHARE_TIME)) {
nec_transmit(0xfb047f80);
putc('t');
}
if (time_count > 488UL * REST_TIME) {
puts("rest\r\n");
time_count = 0; // reset counter