Add task confirmation, numeric debug status and communication handoff
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern void UART_SendBytes(const uint8_t *data, size_t len);
|
||||
|
||||
int ami_set_debug(unsigned id, unsigned state)
|
||||
{
|
||||
uint8_t buf[24];
|
||||
if (id > 15 || state > 2) return -1;
|
||||
int n = snprintf((char *)buf, sizeof buf,
|
||||
"d%u=%u", id, state);
|
||||
if (n < 0 || (size_t)n > sizeof buf - 4) return -1;
|
||||
buf[n++] = 0xFF;
|
||||
buf[n++] = 0xFF;
|
||||
buf[n++] = 0xFF;
|
||||
UART_SendBytes(buf, (size_t)n);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user