mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-12-22 18:22:05 +02:00
fw/image.c (localize_line): export line format conversion function
This commit is contained in:
parent
6fac517d48
commit
69d9013a0d
23
fw/image.c
23
fw/image.c
@ -42,18 +42,23 @@ const struct line *image = images[0];
|
||||
((value) & 128 ? MASK(port, LED_##group##8) : 0))
|
||||
|
||||
|
||||
struct line localize_line(uint8_t p0, uint8_t p1)
|
||||
{
|
||||
struct line res;
|
||||
|
||||
res.cb = MAP(B, p0, A) | MAP(B, p1, B) |
|
||||
MAP(C, p0, A) | MAP(C, p1, B);
|
||||
res.d = MAP(D, p0, A) | MAP(D, p1, B);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static void add_payload(const uint8_t *payload)
|
||||
{
|
||||
uint8_t i, b, c, d;
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i != PAYLOAD && p != end; i += 2) {
|
||||
b = MAP(B, payload[i], A) | MAP(B, payload[i+1], B);
|
||||
c = MAP(C, payload[i], A) | MAP(C, payload[i+1], B);
|
||||
d = MAP(D, payload[i], A) | MAP(D, payload[i+1], B);
|
||||
p->d = d;
|
||||
p->cb = c | b;
|
||||
p++;
|
||||
}
|
||||
for (i = 0; i != PAYLOAD && p != end; i += 2)
|
||||
*p++ = localize_line(payload[i], payload[i+1]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,4 +25,7 @@ struct line {
|
||||
|
||||
extern const struct line *image;
|
||||
|
||||
|
||||
struct line localize_line(uint8_t p0, uint8_t p1);
|
||||
|
||||
#endif /* !IMAGE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user