#define VOIDFP(__x__) (__x__)
#endif
-#define LEM1802_POWER_ON_CYCLES 100000 /* this should vary by, let us say, 10% */
+#define LEM1802_POWER_ON_CYCLES 100000 /* 'about one second' */
#define PIX_X 160 /* pixels in display */
#define PIX_Y 128 /* pixels in display */
unsigned char r;
unsigned char g;
unsigned char b;
- unsigned char a;
+ unsigned char a; /* unused */
};
struct lem1802_ {
#if WANT_DELAY_START
gettimeofday(&tv, NULL);
+ /* consider the 'about' in 'about one second' to be +/- 10% */
r += LEM1802_POWER_ON_CYCLES - (LEM1802_POWER_ON_CYCLES / 10);
r += tv.tv_usec % (LEM1802_POWER_ON_CYCLES / 5);
#endif
void pixbuf_border_paint_(struct pixel_ *pixbuf, struct pixel_ *border) {
size_t x, y, i;
- TRACE("%s>> painted border", __func__);
+ TRACE("%s>> painting border", __func__);
/* top */
for (y = 0; y < PIX_BORDER; y++) {
(void)pixbuf;
+ TRACE("%s>> s:%p", __func__, s);
+
/* derp */
if (s)
rfbMarkRectAsModified(s, 0, 0, x, y);
display->cycle_state_ = 0;
#if DEBUG
- vm->trace_cb_("%s>>", __func__);
+ vm->msg_cb_(MSG_DEBUG, "%s>>", __func__);
#endif /* DEBUG */
}
hw->data = calloc(1, sizeof(struct lem1802_));
if (hw->data == NULL) {
- hw->vm->warn_cb_("%s():%s", "calloc", strerror(errno));
+ hw->vm->msg_cb_(MSG_ERROR, "%s():%s", "calloc", strerror(errno));
return -1;
}
((struct lem1802_ *)(hw->data))->pixbuf = calloc(PIX_X * PIX_Y, sizeof *((struct lem1802_ *)(hw->data))->pixbuf);
if (((struct lem1802_ *)(hw->data))->pixbuf == NULL) {
- hw->vm->warn_cb_("%s():%s", "calloc", strerror(errno));
+ hw->vm->msg_cb_(MSG_ERROR, "%s():%s", "calloc", strerror(errno));
free(hw->data);
hw->data = NULL;
return -1;
}
}
- hw->vm->warn_cb_("unknown renderer '%s'", renderer);
+ hw->vm->msg_cb_(MSG_ERROR, "unknown renderer '%s'", renderer);
return -ENOENT;
}
}
-static struct dcpu16_hw hw_ = {
+struct dcpu16_hw_module dcpu16_hw_module_lem1802 = {
.name_ = "LEM1802 - Low Energy Monitor",
+
.id_l = 0xf615,
.id_h = 0x7349,
.ver = 0x1802,
.hwi = lem1802_hwi_,
.cycle = lem1802_cycle_,
.reset = lem1802_reset_,
- .data = (struct lem1802_ *)NULL
-};
-struct dcpu16_hw_module dcpu16_hw_module_lem1802 = {
- .template = &hw_,
.data_init = lem1802_data_init_,
.data_free = lem1802_data_free_,
.ctl = lem1802_data_ctl_,