1 #ifndef INCLUDED_BADGE2013_MOCKUP_DISPLAY_H
2 #define INCLUDED_BADGE2013_MOCKUP_DISPLAY_H
13 BADGE_DISPLAY_WIDTH
= 96,
14 BADGE_DISPLAY_HEIGHT
= 68,
16 BADGE_DISPLAY_STRIPE_HEIGHT
= 8,
17 BADGE_DISPLAY_STRIPE_COUNT
= (BADGE_DISPLAY_HEIGHT
- 1) / BADGE_DISPLAY_STRIPE_HEIGHT
+ 1
20 typedef uint8_t badge_display_stripe
[BADGE_DISPLAY_WIDTH
];
22 badge_display_stripe data
[BADGE_DISPLAY_STRIPE_COUNT
];
25 void badge_display_init(void);
26 void badge_framebuffer_flush(badge_framebuffer
const *fb
);
28 static inline void badge_framebuffer_clear(badge_framebuffer
*fb
) {
29 memset(fb
, 0, sizeof(*fb
));
32 static inline uint8_t badge_framebuffer_pixel(badge_framebuffer
*fb
,
35 return fb
->data
[y
/ BADGE_DISPLAY_STRIPE_HEIGHT
][x
] >> (y
% BADGE_DISPLAY_STRIPE_HEIGHT
) & 1;
38 static inline void badge_framebuffer_pixel_on(badge_framebuffer
*fb
,
41 fb
->data
[y
/ BADGE_DISPLAY_STRIPE_HEIGHT
][x
] |= 1 << (y
% BADGE_DISPLAY_STRIPE_HEIGHT
);
44 static inline void badge_framebuffer_pixel_off(badge_framebuffer
*fb
,
47 fb
->data
[y
/ BADGE_DISPLAY_STRIPE_HEIGHT
][x
] &= ~(1 << (y
% BADGE_DISPLAY_STRIPE_HEIGHT
));
50 static inline void badge_framebuffer_pixel_flip(badge_framebuffer
*fb
,
53 fb
->data
[y
/ BADGE_DISPLAY_STRIPE_HEIGHT
][x
] ^= 1 << (y
% BADGE_DISPLAY_STRIPE_HEIGHT
);
56 static inline void badge_framebuffer_pixel_set(badge_framebuffer
*fb
,
61 badge_framebuffer_pixel_on (fb
, x
, y
);
63 badge_framebuffer_pixel_off(fb
, x
, y
);