main: periodically transmit code
This commit is contained in:
parent
e813e6bf46
commit
02e5fbdbf5
6
main.c
6
main.c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue