blob: 901fd255c74cee9947bbe7dc69d97e31b3a0674c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#include <stdio.h>
#include <Arduino.h>
int serial_write(uint8_t val)
{
Serial.write(&val, 1);
}
int serial_put_string(const char *str)
{
while (*str) {
serial_write(*str++);
}
return 0;
}
int serial_puts(const char *str)
{
serial_put_string(str);
serial_write('\n');
return 0;
}
int serial_printf(const char *fmt, ...)
{
va_list ap;
static char buf[256];
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
serial_put_string(buf);
va_end(ap);
return 0;
}
#if 0
int serial_print_dec(uint8_t opcode, int32_t integer)
{
Serial.write(&opcode, 1);
Serial.println(integer, DEC);
return 0;
}
int serial_print_hex(uint8_t opcode, int32_t integer)
{
Serial.write(&opcode, 1);
Serial.println(integer, HEX);
return 0;
}
#endif
|