+static void
+ao_temp (void)
+{
+ struct ao_data packet;
+ int temp;
+
+ ao_data_get(&packet);
+
+ /*
+ * r = (110 - 25) / (ts_cal_hot - ts_cal_cold)
+ * 25 + (110 - 25) * (temp - ts_cal_cold) / (ts_cal_hot - ts_cal_cold)
+ */
+ temp = 25 + (110 - 25) * (packet.adc.temp - stm_temp_cal.ts_cal_cold) / (stm_temp_cal.ts_cal_hot - stm_temp_cal.ts_cal_cold);
+ printf ("temp: %d\n", temp);
+}
+
+#if 0
+static void
+ao_event(void)
+{
+ struct ao_event event;
+
+ for (;;) {
+ flush();
+ ao_event_get(&event);
+ printf ("type %1d unit %1d tick %5u value %ld\n",
+ event.type, event.unit, event.tick, event.value);
+ if (event.value == 100)
+ break;
+ }
+
+}
+#endif
+
+static uint8_t ao_blinking = 0;
+
+static void
+ao_blink(void)
+{
+ for (;;) {
+ while (!ao_blinking)
+ ao_sleep(&ao_blinking);
+ while (ao_blinking) {
+ ao_led_toggle(AO_LED_BLUE|AO_LED_GREEN);
+ ao_delay(AO_MS_TO_TICKS(500));
+ }
+ }
+}
+
+static struct ao_task ao_blink_task;
+
+static void
+ao_blink_toggle(void)
+{
+ ao_blinking = !ao_blinking;
+ ao_wakeup(&ao_blinking);
+}
+
+