- int com, seg, val;
- int n, bit;
- ao_cmd_decimal();
- com = ao_cmd_lex_i;
- ao_cmd_decimal();
- seg = ao_cmd_lex_u32;
- ao_cmd_decimal();
- val = ao_cmd_lex_i;
- printf ("com: %d seg: %d val: %d\n", com, seg, val);
- n = (seg >> 5) & 1;
+ ao_arch_block_interrupts();
+ ao_lcd_update_active = 1;
+ stm_lcd.sr = (1 << STM_LCD_SR_UDR);
+ while (ao_lcd_update_active)
+ ao_sleep(&ao_lcd_update_active);
+ ao_arch_release_interrupts();
+}
+
+void
+ao_lcd_clear(void)
+{
+ uint8_t i;
+
+ for (i = 0; i < sizeof (stm_lcd.ram) / 4; i++)
+ stm_lcd.ram[i] = 0;
+ ao_lcd_flush();
+}
+
+#ifdef AO_SEGMENT_MAP
+#if AO_LCD_PER_DIGIT
+static const struct ao_lcd_map {
+ uint8_t com, seg;
+} ao_lcd_map[AO_LCD_DIGITS * AO_LCD_SEGMENTS] = AO_SEGMENT_MAP;
+#else
+static const uint8_t ao_lcd_map[] = AO_SEGMENT_MAP;
+#endif
+#endif
+
+void
+ao_lcd_set(uint8_t digit, uint8_t segment, uint8_t value)
+{
+ uint8_t n;
+ uint8_t com, seg;
+
+#ifdef AO_SEGMENT_MAP
+#if AO_LCD_PER_DIGIT
+ n = digit * AO_LCD_SEGMENTS + segment;
+ com = ao_lcd_map[n].com;
+ seg = ao_lcd_map[n].seg;
+#else
+ com = digit;
+ seg = ao_lcd_map[segment];
+#endif
+#else
+ com = digit;
+ seg = segment;
+#endif