{
debug_puts("I2C init\n");
i2c_peripheral_disable(I2C1);
- i2c_set_speed(I2C1, i2c_speed_sm_100k, CPU_CLOCK_MHZ);
+ i2c_set_speed(I2C1, i2c_speed_sm_100k, rcc_apb1_frequency / 1000000);
i2c_peripheral_enable(I2C1);
debug_puts("I2C transfer\n");
- // byte disp[] = { 0x7f, 0x12, 0xb6, 0xd2 };
- byte disp[] = { 0xff, 0xff, 0xff, 0xff };
+ // byte disp[] = { 0xb6, 0xb6, 0xb6, 0xb6 };
+ // byte disp[] = { 0x7f, 0x12, 0xbc, 0xb6 };
+ // byte disp[] = { 0xff, 0xff, 0xff, 0xff };
+ byte disp[] = { 0x80, 0x80, 0x80, 0xff };
byte cmds[] = { 0x00, 0x47, 0, 0, 0, 0 };
cmds[2] = (disp[0] & 0xf0) | (disp[2] >> 4);
cmds[3] = (disp[1] & 0xf0) | (disp[3] >> 4);
debug_puts("I2C done\n");
}
+static void display_test(void)
+{
+ static byte mode;
+
+ byte cmds[] = { 0x00, mode ? 0x77 : 0x77 };
+ i2c_transfer7(I2C1, 0x70/2, (byte *) cmds, sizeof(cmds), NULL, 0);
+
+ mode = !mode;
+}
+
/*** USB ***/
static usbd_device *usbd_dev;
if (ms_ticks - last_blink >= 100) {
debug_led_toggle();
last_blink = ms_ticks;
+ display_test();
}
if (usb_event_pending) {