| 1 | /* |
| 2 | * Copyright © 2012 Keith Packard <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but |
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along |
| 15 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 16 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
| 17 | */ |
| 18 | |
| 19 | #include <ao.h>cxx . . $ `<file>/src/kernel/ao.h`/ |
| 20 | #include <ao_lco.h>cxx . . $ `<file>/src/drivers/ao_lco.h`/ |
| 21 | #include <ao_event.h>cxx . . $ `<file>/src/drivers/ao_event.h`/ |
| 22 | #include <ao_quadrature.h>cxx . . $ `<file>/src/drivers/ao_quadrature.h`/ |
| 23 | #include <ao_radio_cmac.h>cxx . . $ `<file>/src/kernel/ao_radio_cmac.h`/ |
| 24 | #include <ao_st7565.h>cxx . . $ `<file>/src/drivers/ao_st7565.h`/ |
| 25 | #include <ao_adc_single.h>cxx . . $ `<file>/src/kernel/ao_adc_single.h`/ |
| 26 | #include <ao_pwm.h>cxx . . $ `<file>/src/drivers/ao_pwm.h`/ |
| 27 | #include <limits.h> |
| 28 | |
| 29 | #define WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:29:9`! AO_ST7565_WIDTHcxx . . $ `src/telelco-v3.0/ao_pins.h:109:9`! |
| 30 | #define HEIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:30:9`! AO_ST7565_HEIGHTcxx . . $ `src/telelco-v3.0/ao_pins.h:110:9`! |
| 31 | #define STRIDEcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:31:9`! AO_BITMAP_STRIDEcxx . . $ `src/draw/ao_draw.h:31:9`!(WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:29:9`!) |
| 32 | |
| 33 | static uint32_tcxx . . $ uint32_t# imagecxx . . $ image.[STRIDEcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:31:9`! * HEIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:30:9`!]; |
| 34 | |
| 35 | static struct ao_bitmapcxx . . $ ao_bitmap# fbcxx . . $ fb. = { |
| 36 | .base = imagecxx . . $ image., |
| 37 | .stride = STRIDEcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:31:9`!, |
| 38 | .width = WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:29:9`!, |
| 39 | .height = HEIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:30:9`!, |
| 40 | .damage = AO_BOX_INITcxx . . $ `src/draw/ao_box.h:45:9`!, |
| 41 | }; |
| 42 | |
| 43 | static const struct ao_transformcxx . . $ ao_transform# logo_transformcxx . . $ logo_transform. = { |
| 44 | .x_scale = 40, .x_off = 8, |
| 45 | .y_scale = 40, .y_off = 0, |
| 46 | }; |
| 47 | |
| 48 | static const struct ao_transformcxx . . $ ao_transform# show_transformcxx . . $ show_transform. = { |
| 49 | .x_scale = 36, .x_off = 100, |
| 50 | .y_scale = 36, .y_off = 0, |
| 51 | }; |
| 52 | |
| 53 | #define BIG_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:53:9`! BitstreamVeraSans_Roman_58_font |
| 54 | #define VOLT_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:54:9`! BitstreamVeraSans_Roman_58_font |
| 55 | #define SMALL_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:55:9`! BitstreamVeraSans_Roman_12_font |
| 56 | #define TINY_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:56:9`! BitstreamVeraSans_Roman_10_font |
| 57 | #define LOGO_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:57:9`! BenguiatGothicStd_Bold_24_font |
| 58 | |
| 59 | #define LABEL_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:59:9`! (int16_t) (SMALL_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:55:9`!.ascent) |
| 60 | #define VALUE_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:60:9`! (int16_t) (LABEL_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:59:9`! + 5 + BIG_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:53:9`!.ascent) |
| 61 | |
| 62 | #define SEP_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:62:9`! 82 |
| 63 | #define SEP_WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:63:9`! 2 |
| 64 | |
| 65 | #define BOX_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:65:9`! (SEP_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:62:9`! / 2) |
| 66 | #define PAD_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:66:9`! ((WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:29:9`! + SEP_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:62:9`! + SEP_WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:63:9`!) / 2) |
| 67 | |
| 68 | #define VALUE_LABEL_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:68:9`! 64 |
| 69 | #define RSSI_LABEL_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:69:9`! 15 |
| 70 | |
| 71 | #define SCAN_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:71:9`! (WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:29:9`! - 100) / 2 |
| 72 | #define SCAN_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:72:9`! 50 |
| 73 | #define SCAN_HEIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:73:9`! 3 |
| 74 | #define SCANNING_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:74:9`! (WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:29:9`! / 2) |
| 75 | #define SCANNING_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:75:9`! (SCAN_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:72:9`! - 2) |
| 76 | #define FOUND_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:76:9`! 63 |
| 77 | #define FOUND_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:77:9`! 3 |
| 78 | #define FOUND_WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:78:9`! (WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:29:9`! - 6) |
| 79 | #define CONTRAST_LABEL_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:79:9`! 37 |
| 80 | #define CONTRAST_WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:80:9`! 100 |
| 81 | #define CONTRAST_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:81:9`! (WIDTH - CONTRAST_WIDTH) / 2 |
| 82 | #define CONTRAST_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:82:9`! 20 |
| 83 | #define CONTRAST_HEIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:83:9`! 20 |
| 84 | #define CONTRAST_VALUE_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:84:9`! 64 |
| 85 | #define CONTRAST_VALUE_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:85:9`! (CONTRAST_Y + CONTRAST_HEIGHT + SMALL_FONT.ascent + 3) |
| 86 | #define BACKLIGHT_LABEL_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:86:9`! 37 |
| 87 | #define BACKLIGHT_WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:87:9`! 100 |
| 88 | #define BACKLIGHT_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:88:9`! (WIDTH - BACKLIGHT_WIDTH) / 2 |
| 89 | #define BACKLIGHT_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:89:9`! 20 |
| 90 | #define BACKLIGHT_HEIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:90:9`! 20 |
| 91 | #define BACKLIGHT_VALUE_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:91:9`! 64 |
| 92 | #define BACKLIGHT_VALUE_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:92:9`! (BACKLIGHT_Y + BACKLIGHT_HEIGHT + SMALL_FONT.ascent + 3) |
| 93 | #define INFO_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:93:9`! TINY_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:56:9`! |
| 94 | #define INFO_START_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:94:9`! ((int16_t) (INFO_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:93:9`!.ascent + 2)) |
| 95 | #define INFO_STEP_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:95:9`! ((int16_t) (INFO_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:93:9`!.ascent + 2)) |
| 96 | |
| 97 | #define AO_LCO_DRAG_RACE_START_TIMEcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:97:9`! AO_SEC_TO_TICKS(5) |
| 98 | #define AO_LCO_DRAG_RACE_STOP_TIMEcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:98:9`! AO_SEC_TO_TICKS(2) |
| 99 | |
| 100 | /* UI values */ |
| 101 | static uint8_tcxx . . $ uint8_t# ao_lco_select_modecxx . . $ ao_lco_select_mode.; |
| 102 | static uint8_tcxx . . $ uint8_t# ao_lco_event_debugcxx . . $ ao_lco_event_debug.; |
| 103 | |
| 104 | #define PRINTEcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:104:9`!(...) do { if (!ao_lco_debug && !ao_lco_event_debug) break; printf ("\r%5lu %s: ", (unsigned long) ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } while(0) |
| 105 | #define AO_LCO_SELECT_BOXcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:105:9`! 0 |
| 106 | #define AO_LCO_SELECT_PADcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:106:9`! 1 |
| 107 | |
| 108 | static uint8_tcxx . . $ uint8_t# ao_lco_display_mutexcxx . . $ ao_lco_display_mutex.; |
| 109 | |
| 110 | static uint8_tcxx . . $ uint8_t# ao_sample_datacxx . . $ ao_sample_data.; |
| 111 | static struct ao_datacxx . . $ ao_data# ao_data_curcxx . . $ ao_data_cur.; |
| 112 | |
| 113 | static void |
| 114 | _ao_center_textcxx . . $ _ao_center_text(7f62b814a1e4ca26).(int16_tcxx . . $ int16_t# x, int16_tcxx . . $ int16_t# y, const struct ao_fontcxx . . $ ao_font# *font, const char *str) |
| 115 | { |
| 116 | int16_tcxx . . $ int16_t# width = ao_text_widthcxx . . $ ao_text_width(f6d49ddd198322aa).(font, str); |
| 117 | ao_textcxx . . $ ao_text(25ad7e79b48332a8).(&fbcxx . . $ fb., font, x - width/2, y, str, AO_BLACKcxx . . $ `src/draw/ao_draw.h:233:9`!, AO_COPYcxx . . $ `src/draw/ao_draw.h:218:9`!); |
| 118 | } |
| 119 | |
| 120 | static void |
| 121 | _ao_lco_show_padcxx . . $ _ao_lco_show_pad(4af4fd0e2b26c4ac).(int8_tcxx . . $ int8_t# pad) |
| 122 | { |
| 123 | char str[5]; |
| 124 | |
| 125 | _ao_center_textcxx . . $ _ao_center_text(7f62b814a1e4ca26).(PAD_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:66:9`!, LABEL_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:59:9`!, &SMALL_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:55:9`!, "Pad"); |
| 126 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(str, sizeof(str), "%d", pad); |
| 127 | _ao_center_textcxx . . $ _ao_center_text(7f62b814a1e4ca26).(PAD_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:66:9`!, VALUE_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:60:9`!, &BIG_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:53:9`!, str); |
| 128 | } |
| 129 | |
| 130 | static void |
| 131 | _ao_lco_show_boxcxx . . $ _ao_lco_show_box(68e3ae50fe6578a9).(int16_tcxx . . $ int16_t# box) |
| 132 | { |
| 133 | char str[7]; |
| 134 | |
| 135 | _ao_center_textcxx . . $ _ao_center_text(7f62b814a1e4ca26).(BOX_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:65:9`!, LABEL_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:59:9`!, &SMALL_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:55:9`!, "Bank"); |
| 136 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(str, sizeof(str), "%d", box); |
| 137 | _ao_center_textcxx . . $ _ao_center_text(7f62b814a1e4ca26).(BOX_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:65:9`!, VALUE_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:60:9`!, &BIG_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:53:9`!, str); |
| 138 | } |
| 139 | |
| 140 | static void |
| 141 | _ao_format_voltagecxx . . $ _ao_format_voltage(6dc920d124934113).(char *str, size_t size, uint16_tcxx . . $ uint16_t# decivolts) |
| 142 | { |
| 143 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(str, size, "%d.%d", decivolts / 10, decivolts % 10); |
| 144 | } |
| 145 | |
| 146 | #if AO_LCO_HAS_CONTRAST |
| 147 | static void |
| 148 | _ao_lco_show_contrast(void) |
| 149 | { |
| 150 | char buf[8]; |
| 151 | uint8_t brightness = ao_st7565_get_brightness(); |
| 152 | int16_t contrast = (int16_t) (brightness * CONTRAST_WIDTH / AO_LCO_MAX_CONTRAST); |
| 153 | |
| 154 | _ao_center_text(WIDTH/2, LABEL_Y, &SMALL_FONT, "Contrast"); |
| 155 | ao_rect(&fb, CONTRAST_X, CONTRAST_Y, contrast, CONTRAST_HEIGHT, AO_BLACK, AO_COPY); |
| 156 | snprintf(buf, sizeof(buf), "%d %%", brightness * 100 / AO_LCO_MAX_CONTRAST); |
| 157 | _ao_center_text(WIDTH/2, CONTRAST_VALUE_Y, &SMALL_FONT, buf); |
| 158 | } |
| 159 | #endif |
| 160 | |
| 161 | #if AO_LCO_HAS_BACKLIGHT_UI |
| 162 | static void |
| 163 | _ao_lco_show_backlight(void) |
| 164 | { |
| 165 | char buf[8]; |
| 166 | int32_t backlight = ao_lco_get_backlight(); |
| 167 | int16_t value = (int16_t) (backlight * BACKLIGHT_WIDTH / AO_LCO_MAX_BACKLIGHT); |
| 168 | |
| 169 | _ao_center_text(WIDTH/2, LABEL_Y, &SMALL_FONT, "Backlight"); |
| 170 | ao_rect(&fb, BACKLIGHT_X, BACKLIGHT_Y, value, BACKLIGHT_HEIGHT, AO_BLACK, AO_COPY); |
| 171 | snprintf(buf, sizeof(buf), "%ld %%", backlight * 100 / AO_LCO_MAX_BACKLIGHT); |
| 172 | _ao_center_text(WIDTH/2, BACKLIGHT_VALUE_Y, &SMALL_FONT, buf); |
| 173 | } |
| 174 | #endif |
| 175 | |
| 176 | static int16_tcxx . . $ int16_t# info_ycxx . . $ info_y.; |
| 177 | |
| 178 | static void |
| 179 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).(const char *format, ...) |
| 180 | { |
| 181 | va_listcxx . . $ va_list# a; |
| 182 | char buf[20]; |
| 183 | va_startcxx . . $ `/usr/lib/gcc/arm-none-eabi/15/include/stdarg.h:50:9`!(a, format); |
| 184 | vsnprintfcxx . . $ vsnprintf(a85eea89d1bd834f).(buf, sizeof(buf), format, a); |
| 185 | va_endcxx . . $ `/usr/lib/gcc/arm-none-eabi/15/include/stdarg.h:52:9`!(a); |
| 186 | ao_textcxx . . $ ao_text(25ad7e79b48332a8).(&fbcxx . . $ fb., &INFO_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:93:9`!, 0, info_ycxx . . $ info_y., buf, AO_BLACKcxx . . $ `src/draw/ao_draw.h:233:9`!, AO_COPYcxx . . $ `src/draw/ao_draw.h:218:9`!); |
| 187 | info_ycxx . . $ info_y. += INFO_STEP_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:95:9`!; |
| 188 | } |
| 189 | |
| 190 | static void |
| 191 | _ao_lco_show_lco_infocxx . . $ _ao_lco_show_lco_info(49f6e7a06ebc5aa8).(void) |
| 192 | { |
| 193 | char battery[7]; |
| 194 | int16_tcxx . . $ int16_t# decivolt; |
| 195 | |
| 196 | ao_logo_polycxx . . $ ao_logo_poly(5e06998836a182e0).(&fbcxx . . $ fb., &show_transformcxx . . $ show_transform., AO_BLACKcxx . . $ `src/draw/ao_draw.h:233:9`!, AO_COPYcxx . . $ `src/draw/ao_draw.h:218:9`!); |
| 197 | |
| 198 | decivolt = ao_battery_decivoltcxx . . $ ao_battery_decivolt(14a1761c3ef4450f).(ao_data_curcxx . . $ ao_data_cur..adccxx . . $ ao_data#adc..v_battcxx . . $ ao_adc#$anonymous_type_0#$anonymous_type_1#v_batt.); |
| 199 | _ao_format_voltagecxx . . $ _ao_format_voltage(6dc920d124934113).(battery, sizeof(battery), (uint16_tcxx . . $ uint16_t#) decivolt); |
| 200 | |
| 201 | info_ycxx . . $ info_y. = INFO_START_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:94:9`!; |
| 202 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("%s", ao_productcxx . . $ ao_product.); |
| 203 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("Serial: %d", ao_serial_numbercxx . . $ ao_serial_number.); |
| 204 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("Battery: %sV", battery); |
| 205 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("Version: %s", ao_versioncxx . . $ ao_version.); |
| 206 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("Callsign: %s", ao_configcxx . . $ ao_config..callsigncxx . . $ ao_config#callsign.); |
| 207 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("Frequency: %ld.%03d", |
| 208 | ao_configcxx . . $ ao_config..frequencycxx . . $ ao_config#frequency. / 1000, |
| 209 | (int) (ao_configcxx . . $ ao_config..frequencycxx . . $ ao_config#frequency. % 1000)); |
| 210 | } |
| 211 | |
| 212 | static uint8_tcxx . . $ uint8_t# |
| 213 | popcountcxx . . $ popcount(32407b39b2dfce37).(uint32_tcxx . . $ uint32_t# value) |
| 214 | { |
| 215 | uint8_tcxx . . $ uint8_t# count = 0; |
| 216 | while(value != 0) { |
| 217 | count += value & 1; |
| 218 | value >>= 1; |
| 219 | } |
| 220 | return count; |
| 221 | } |
| 222 | |
| 223 | static void |
| 224 | _ao_lco_show_pad_infocxx . . $ _ao_lco_show_pad_info(49f6e7a06ebc5aa8).(void) |
| 225 | { |
| 226 | char pad_battery[7]; |
| 227 | |
| 228 | ao_logo_polycxx . . $ ao_logo_poly(5e06998836a182e0).(&fbcxx . . $ fb., &show_transformcxx . . $ show_transform., AO_BLACKcxx . . $ `src/draw/ao_draw.h:233:9`!, AO_COPYcxx . . $ `src/draw/ao_draw.h:218:9`!); |
| 229 | info_ycxx . . $ info_y. = INFO_START_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:94:9`!; |
| 230 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("Bank: %d", ao_lco_boxcxx . . $ ao_lco_box.); |
| 231 | if (!(ao_lco_validcxx . . $ ao_lco_valid.[ao_lco_boxcxx . . $ ao_lco_box.] & AO_LCO_VALID_LASTcxx . . $ `src/drivers/ao_lco.h:148:9`!)) { |
| 232 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("Contact lost"); |
| 233 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("Last RSSI: %ddBm", ao_radio_cmac_last_rssicxx . . $ ao_radio_cmac_last_rssi.); |
| 234 | } else { |
| 235 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("Total pads: %d", popcountcxx . . $ popcount(32407b39b2dfce37).(ao_pad_querycxx . . $ ao_pad_query..channelscxx . . $ ao_pad_query#channels.)); |
| 236 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("RSSI: %ddBm", ao_radio_cmac_rssicxx . . $ ao_radio_cmac_rssi.); |
| 237 | _ao_format_voltagecxx . . $ _ao_format_voltage(6dc920d124934113).(pad_battery, sizeof(pad_battery), ao_pad_querycxx . . $ ao_pad_query..batterycxx . . $ ao_pad_query#battery.); |
| 238 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("Battery: %sV", pad_battery); |
| 239 | _ao_lco_infocxx . . $ _ao_lco_info(326aeb464d16410c).("Arming switch: %s", ao_pad_querycxx . . $ ao_pad_query..arm_statuscxx . . $ ao_pad_query#arm_status. ? "On" : "Off"); |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | #define AO_LCO_DIM_BACKLIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:243:9`! (AO_LCO_MIN_BACKLIGHTcxx . . $ `src/telelco-v3.0/ao_pins.h:322:9`! + 3 * AO_LCO_BACKLIGHT_STEPcxx . . $ `src/telelco-v3.0/ao_pins.h:324:9`!) |
| 244 | #define AO_AUTO_BACKLIGHT_RANGEcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:244:9`! (AO_LCO_MAX_BACKLIGHT - AO_LCO_DIM_BACKLIGHT) |
| 245 | #define AO_AUTO_BACKLIGHT_GAPcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:245:9`! AO_ADC_MAXcxx . . $ `src/stm32f1/ao_arch.h:68:9`! / 6 |
| 246 | |
| 247 | static structcxx . . $ $anonymous_type_c2c33f636eb105b6_0# { |
| 248 | int16_tcxx . . $ int16_t# v_alscxx . . $ $anonymous_type_c2c33f636eb105b6_0#v_als.; |
| 249 | int32_tcxx . . $ int32_t# backlightcxx . . $ $anonymous_type_c2c33f636eb105b6_0#backlight.; |
| 250 | } ao_lco_backlight_mapcxx . . $ ao_lco_backlight_map.[] = { |
| 251 | { .v_als = AO_ADC_MAXcxx . . $ `src/stm32f1/ao_arch.h:68:9`! / 6, .backlight = AO_LCO_DIM_BACKLIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:243:9`! }, |
| 252 | { .v_als = AO_ADC_MAXcxx . . $ `src/stm32f1/ao_arch.h:68:9`! / 3, .backlight = (AO_LCO_MAX_BACKLIGHTcxx . . $ `src/telelco-v3.0/ao_pins.h:323:9`! - AO_LCO_MIN_BACKLIGHTcxx . . $ `src/telelco-v3.0/ao_pins.h:322:9`!) / 2 }, |
| 253 | { .v_als = AO_ADC_MAXcxx . . $ `src/stm32f1/ao_arch.h:68:9`! / 2, .backlight = AO_LCO_MAX_BACKLIGHTcxx . . $ `src/telelco-v3.0/ao_pins.h:323:9`! }, |
| 254 | { .v_als = AO_ADC_MAXcxx . . $ `src/stm32f1/ao_arch.h:68:9`! * 3 / 4, .backlight = 0 }, |
| 255 | }; |
| 256 | |
| 257 | #define NUM_BACKLIGHT_MAPcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:257:9`! sizeof(ao_lco_backlight_map)/sizeof(ao_lco_backlight_map[0]) |
| 258 | |
| 259 | static unsigned ao_backlight_prevcxx . . $ ao_backlight_prev. = NUM_BACKLIGHT_MAPcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:257:9`! - 1; |
| 260 | |
| 261 | static void |
| 262 | ao_auto_backlightcxx . . $ ao_auto_backlight(af780a7c10c7990f).(int16_tcxx . . $ int16_t# als_min, int16_tcxx . . $ int16_t# als_max) |
| 263 | { |
| 264 | unsigned ao_backlight; |
| 265 | |
| 266 | PRINTDcxx . . $ `src/drivers/ao_lco.h:32:9`!("ao_auto_backlight min %d max %d\n", als_min, als_max); |
| 267 | ao_backlight = ao_backlight_prevcxx . . $ ao_backlight_prev.; |
| 268 | while (als_min > ao_lco_backlight_mapcxx . . $ ao_lco_backlight_map.[ao_backlight].v_alscxx . . $ $anonymous_type_c2c33f636eb105b6_0#v_als. + AO_AUTO_BACKLIGHT_GAPcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:245:9`!) { |
| 269 | if (ao_backlight == NUM_BACKLIGHT_MAPcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:257:9`! - 1) |
| 270 | break; |
| 271 | ao_backlight++; |
| 272 | } |
| 273 | while (als_max < ao_lco_backlight_mapcxx . . $ ao_lco_backlight_map.[ao_backlight].v_alscxx . . $ $anonymous_type_c2c33f636eb105b6_0#v_als. - AO_AUTO_BACKLIGHT_GAPcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:245:9`!) { |
| 274 | if (ao_backlight == 0) |
| 275 | return; |
| 276 | ao_backlight--; |
| 277 | } |
| 278 | if (ao_backlight != ao_backlight_prevcxx . . $ ao_backlight_prev.) |
| 279 | { |
| 280 | PRINTDcxx . . $ `src/drivers/ao_lco.h:32:9`!(" set backlight to %ld\n", ao_lco_backlight_map[ao_backlight].backlight); |
| 281 | ao_lco_set_backlightcxx . . $ ao_lco_set_backlight(d4f767463ce0a6b3).(ao_lco_backlight_mapcxx . . $ ao_lco_backlight_map.[ao_backlight].backlightcxx . . $ $anonymous_type_c2c33f636eb105b6_0#backlight.); |
| 282 | ao_backlight_prevcxx . . $ ao_backlight_prev. = ao_backlight; |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | #define AO_LCO_BACKLIGHT_INTERVALcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:286:9`! AO_SEC_TO_TICKScxx . . $ `src/kernel/ao.h:121:9`!(2) |
| 287 | |
| 288 | static void |
| 289 | ao_lco_datacxx . . $ ao_lco_data(49f6e7a06ebc5aa8).(void) |
| 290 | { |
| 291 | AO_TICK_TYPEcxx . . $ `src/kernel/ao.h:52:9`! backlight_tick = ao_timecxx . . $ ao_time(db52760e79bf9054).() + AO_LCO_BACKLIGHT_INTERVALcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:286:9`!; |
| 292 | AO_TICK_TYPEcxx . . $ `src/kernel/ao.h:52:9`! now; |
| 293 | int16_tcxx . . $ int16_t# als_min = INT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:111:10`!; |
| 294 | int16_tcxx . . $ int16_t# als_max = INT16_MINcxx . . $ `<external>/3415975807581488833/stdint.h:106:10`!; |
| 295 | |
| 296 | ao_timer_set_adc_intervalcxx . . $ ao_timer_set_adc_interval(ac50b47256ae7414).(AO_MS_TO_TICKScxx . . $ `src/kernel/ao.h:120:9`!(100)); |
| 297 | for (;;) { |
| 298 | ao_sleepcxx . . $ ao_sleep(66f908488be5605c).((void *) &ao_data_headcxx . . $ ao_data_head.); |
| 299 | |
| 300 | while (ao_sample_datacxx . . $ ao_sample_data. != ao_data_headcxx . . $ ao_data_head.) { |
| 301 | struct ao_datacxx . . $ ao_data# *ao_data; |
| 302 | |
| 303 | /* Capture a sample */ |
| 304 | ao_data = (struct ao_datacxx . . $ ao_data# *) &ao_data_ringcxx . . $ ao_data_ring.[ao_sample_datacxx . . $ ao_sample_data.]; |
| 305 | |
| 306 | ao_data_curcxx . . $ ao_data_cur. = *ao_data; |
| 307 | if (ao_data_curcxx . . $ ao_data_cur..adccxx . . $ ao_data#adc..v_alscxx . . $ ao_adc#$anonymous_type_0#$anonymous_type_1#v_als. < als_min) |
| 308 | als_min = ao_data_curcxx . . $ ao_data_cur..adccxx . . $ ao_data#adc..v_alscxx . . $ ao_adc#$anonymous_type_0#$anonymous_type_1#v_als.; |
| 309 | if (ao_data_curcxx . . $ ao_data_cur..adccxx . . $ ao_data#adc..v_alscxx . . $ ao_adc#$anonymous_type_0#$anonymous_type_1#v_als. > als_max) |
| 310 | als_max = ao_data_curcxx . . $ ao_data_cur..adccxx . . $ ao_data#adc..v_alscxx . . $ ao_adc#$anonymous_type_0#$anonymous_type_1#v_als.; |
| 311 | ao_sample_datacxx . . $ ao_sample_data. = ao_data_ring_nextcxx . . $ `src/kernel/ao_data.h:167:9`!(ao_sample_data); |
| 312 | } |
| 313 | now = ao_timecxx . . $ ao_time(db52760e79bf9054).(); |
| 314 | if ((AO_TICK_SIGNEDcxx . . $ `src/kernel/ao.h:53:9`!) (backlight_tick - now) < 0) { |
| 315 | backlight_tick = now + AO_LCO_BACKLIGHT_INTERVALcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:286:9`!; |
| 316 | ao_auto_backlightcxx . . $ ao_auto_backlight(af780a7c10c7990f).(als_min, als_max); |
| 317 | als_min = INT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:111:10`!; |
| 318 | als_max = INT16_MINcxx . . $ `<external>/3415975807581488833/stdint.h:106:10`!; |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | void |
| 324 | ao_lco_showcxx . . $ ao_lco_show(49f6e7a06ebc5aa8).(void) |
| 325 | { |
| 326 | ao_mutex_getcxx . . $ ao_mutex_get(f25546b61a629de7).(&ao_lco_display_mutexcxx . . $ ao_lco_display_mutex.); |
| 327 | ao_rectcxx . . $ ao_rect(98c18c42ff1c1831).(&fbcxx . . $ fb., 0, 0, WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:29:9`!, HEIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:30:9`!, AO_WHITEcxx . . $ `src/draw/ao_draw.h:232:9`!, AO_COPYcxx . . $ `src/draw/ao_draw.h:218:9`!); |
| 328 | switch (ao_lco_boxcxx . . $ ao_lco_box.) { |
| 329 | #if AO_LCO_HAS_CONTRAST |
| 330 | case AO_LCO_CONTRAST: |
| 331 | _ao_lco_show_contrast(); |
| 332 | break; |
| 333 | #endif |
| 334 | #if AO_LCO_HAS_BACKLIGHT_UI |
| 335 | case AO_LCO_BACKLIGHT: |
| 336 | _ao_lco_show_backlight(); |
| 337 | break; |
| 338 | #endif |
| 339 | case AO_LCO_LCO_INFOcxx . . $ `src/drivers/ao_lco.h:66:11`!: |
| 340 | _ao_lco_show_lco_infocxx . . $ _ao_lco_show_lco_info(49f6e7a06ebc5aa8).(); |
| 341 | break; |
| 342 | default: |
| 343 | switch (ao_lco_padcxx . . $ ao_lco_pad.) { |
| 344 | case AO_LCO_PAD_INFOcxx . . $ `src/drivers/ao_lco.h:82:10`!: |
| 345 | _ao_lco_show_pad_infocxx . . $ _ao_lco_show_pad_info(49f6e7a06ebc5aa8).(); |
| 346 | break; |
| 347 | default: |
| 348 | _ao_lco_show_padcxx . . $ _ao_lco_show_pad(4af4fd0e2b26c4ac).(ao_lco_padcxx . . $ ao_lco_pad.); |
| 349 | _ao_lco_show_boxcxx . . $ _ao_lco_show_box(68e3ae50fe6578a9).(ao_lco_boxcxx . . $ ao_lco_box.); |
| 350 | ao_rectcxx . . $ ao_rect(98c18c42ff1c1831).(&fbcxx . . $ fb., SEP_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:62:9`!, 0, SEP_WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:63:9`!, HEIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:30:9`!, AO_BLACKcxx . . $ `src/draw/ao_draw.h:233:9`!, AO_COPYcxx . . $ `src/draw/ao_draw.h:218:9`!); |
| 351 | } |
| 352 | break; |
| 353 | } |
| 354 | ao_st7565_updatecxx . . $ ao_st7565_update(fcd32f10d26c4a5c).(&fbcxx . . $ fb.); |
| 355 | ao_mutex_putcxx . . $ ao_mutex_put(f25546b61a629de7).(&ao_lco_display_mutexcxx . . $ ao_lco_display_mutex.); |
| 356 | } |
| 357 | |
| 358 | static void |
| 359 | ao_lco_set_selectcxx . . $ ao_lco_set_select(49f6e7a06ebc5aa8).(void) |
| 360 | { |
| 361 | if (ao_lco_armedcxx . . $ ao_lco_armed.) { |
| 362 | ao_led_offcxx . . $ ao_led_off(cb2f890c2fdad230).(AO_LED_PADcxx . . $ `src/telelco-v3.0/ao_pins.h:150:9`!); |
| 363 | ao_led_offcxx . . $ ao_led_off(cb2f890c2fdad230).(AO_LED_BOXcxx . . $ `src/telelco-v3.0/ao_pins.h:146:9`!); |
| 364 | } else { |
| 365 | switch (ao_lco_select_modecxx . . $ ao_lco_select_mode.) { |
| 366 | case AO_LCO_SELECT_PADcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:106:9`!: |
| 367 | ao_led_offcxx . . $ ao_led_off(cb2f890c2fdad230).(AO_LED_BOXcxx . . $ `src/telelco-v3.0/ao_pins.h:146:9`!); |
| 368 | ao_led_oncxx . . $ ao_led_on(cb2f890c2fdad230).(AO_LED_PADcxx . . $ `src/telelco-v3.0/ao_pins.h:150:9`!); |
| 369 | break; |
| 370 | case AO_LCO_SELECT_BOXcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:105:9`!: |
| 371 | ao_led_offcxx . . $ ao_led_off(cb2f890c2fdad230).(AO_LED_PADcxx . . $ `src/telelco-v3.0/ao_pins.h:150:9`!); |
| 372 | ao_led_oncxx . . $ ao_led_on(cb2f890c2fdad230).(AO_LED_BOXcxx . . $ `src/telelco-v3.0/ao_pins.h:146:9`!); |
| 373 | break; |
| 374 | default: |
| 375 | break; |
| 376 | } |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | |
| 381 | #if AO_LCO_HAS_CONTRAST |
| 382 | void |
| 383 | ao_lco_set_contrast(int32_t contrast) |
| 384 | { |
| 385 | ao_st7565_set_brightness((uint8_t) contrast); |
| 386 | } |
| 387 | |
| 388 | int32_t |
| 389 | ao_lco_get_contrast(void) |
| 390 | { |
| 391 | return (int32_t) ao_st7565_get_brightness(); |
| 392 | } |
| 393 | #endif |
| 394 | |
| 395 | #if AO_LCO_HAS_BACKLIGHTcxx . . $ `src/telelco-v3.0/ao_pins.h:321:9`! |
| 396 | static uint16_tcxx . . $ uint16_t# ao_backlightcxx . . $ ao_backlight.; |
| 397 | |
| 398 | void |
| 399 | ao_lco_set_backlightcxx . . $ ao_lco_set_backlight(d4f767463ce0a6b3).(int32_tcxx . . $ int32_t# backlight) |
| 400 | { |
| 401 | ao_backlightcxx . . $ ao_backlight. = (uint16_tcxx . . $ uint16_t#) backlight; |
| 402 | ao_pwm_setcxx . . $ ao_pwm_set(2b0f6589498b1c50).(AO_LCD_BL_PWM_CHANcxx . . $ `src/telelco-v3.0/ao_pins.h:341:9`!, ao_backlightcxx . . $ ao_backlight.); |
| 403 | } |
| 404 | |
| 405 | int32_tcxx . . $ int32_t# |
| 406 | ao_lco_get_backlightcxx . . $ ao_lco_get_backlight(b126dc7c1de90089).(void) |
| 407 | { |
| 408 | return (int32_tcxx . . $ int32_t#) ao_backlightcxx . . $ ao_backlight.; |
| 409 | } |
| 410 | #endif |
| 411 | |
| 412 | static struct ao_taskcxx . . $ ao_task# ao_lco_drag_taskcxx . . $ ao_lco_drag_task.; |
| 413 | |
| 414 | static void |
| 415 | ao_lco_drag_monitorcxx . . $ ao_lco_drag_monitor(49f6e7a06ebc5aa8).(void) |
| 416 | { |
| 417 | AO_TICK_TYPEcxx . . $ `src/kernel/ao.h:52:9`! delay = ~0UL; |
| 418 | AO_TICK_TYPEcxx . . $ `src/kernel/ao.h:52:9`! now; |
| 419 | |
| 420 | ao_beep_forcxx . . $ ao_beep_for(8c20a40f0f472c58).(AO_BEEP_MIDcxx . . $ `src/kernel/ao_beep.h:36:9`!, AO_MS_TO_TICKScxx . . $ `src/kernel/ao.h:120:9`!(200)); |
| 421 | for (;;) { |
| 422 | PRINTDcxx . . $ `src/drivers/ao_lco.h:32:9`!("Drag monitor count %d delay %lu\n", ao_lco_drag_beep_count, (unsigned long) delay); |
| 423 | if (delay == (AO_TICK_TYPEcxx . . $ `src/kernel/ao.h:52:9`!) ~0) |
| 424 | ao_sleepcxx . . $ ao_sleep(66f908488be5605c).(&ao_lco_drag_beep_countcxx . . $ ao_lco_drag_beep_count.); |
| 425 | else |
| 426 | ao_sleep_forcxx . . $ ao_sleep_for(7aa359ef28790490).(&ao_lco_drag_beep_countcxx . . $ ao_lco_drag_beep_count., delay); |
| 427 | |
| 428 | delay = ~0UL; |
| 429 | now = ao_timecxx . . $ ao_time(db52760e79bf9054).(); |
| 430 | delay = ao_lco_drag_warn_checkcxx . . $ ao_lco_drag_warn_check(83f10ac8959d5577).(now, delay); |
| 431 | delay = ao_lco_drag_beep_checkcxx . . $ ao_lco_drag_beep_check(83f10ac8959d5577).(now, delay); |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | static void |
| 436 | ao_lco_inputcxx . . $ ao_lco_input(49f6e7a06ebc5aa8).(void) |
| 437 | { |
| 438 | static struct ao_eventcxx . . $ ao_event# event; |
| 439 | |
| 440 | for (;;) { |
| 441 | ao_event_getcxx . . $ ao_event_get(3af8059375296eef).(&event); |
| 442 | PRINTEcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:104:9`!("event type %d unit %d value %ld\n", |
| 443 | event.type, event.unit, (long) event.value); |
| 444 | switch (event.typecxx . . $ ao_event#type.) { |
| 445 | case AO_EVENT_QUADRATUREcxx . . $ `src/drivers/ao_event.h:23:9`!: |
| 446 | switch (event.unitcxx . . $ ao_event#unit.) { |
| 447 | case AO_QUADRATURE_SELECTcxx . . $ `src/telelco-v3.0/ao_pins.h:218:9`!: |
| 448 | if (!ao_lco_armedcxx . . $ ao_lco_armed.) { |
| 449 | switch (ao_lco_select_modecxx . . $ ao_lco_select_mode.) { |
| 450 | case AO_LCO_SELECT_PADcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:106:9`!: |
| 451 | ao_lco_step_padcxx . . $ ao_lco_step_pad(4af4fd0e2b26c4ac).((int8_tcxx . . $ int8_t#) event.valuecxx . . $ ao_event#value.); |
| 452 | break; |
| 453 | case AO_LCO_SELECT_BOXcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:105:9`!: |
| 454 | ao_lco_step_boxcxx . . $ ao_lco_step_box(4af4fd0e2b26c4ac).((int8_tcxx . . $ int8_t#) event.valuecxx . . $ ao_event#value.); |
| 455 | break; |
| 456 | default: |
| 457 | break; |
| 458 | } |
| 459 | } |
| 460 | break; |
| 461 | } |
| 462 | break; |
| 463 | case AO_EVENT_BUTTONcxx . . $ `src/drivers/ao_event.h:24:9`!: |
| 464 | switch (event.unitcxx . . $ ao_event#unit.) { |
| 465 | case AO_BUTTON_ARMcxx . . $ `src/telelco-v3.0/ao_pins.h:247:9`!: |
| 466 | ao_lco_set_armedcxx . . $ ao_lco_set_armed(ac50b47256ae7414).((uint8_tcxx . . $ uint8_t#) event.valuecxx . . $ ao_event#value.); |
| 467 | ao_lco_set_selectcxx . . $ ao_lco_set_select(49f6e7a06ebc5aa8).(); |
| 468 | break; |
| 469 | case AO_BUTTON_FIREcxx . . $ `src/telelco-v3.0/ao_pins.h:251:9`!: |
| 470 | if (ao_lco_armedcxx . . $ ao_lco_armed.) |
| 471 | ao_lco_set_firingcxx . . $ ao_lco_set_firing(ac50b47256ae7414).((uint8_tcxx . . $ uint8_t#) event.valuecxx . . $ ao_event#value.); |
| 472 | break; |
| 473 | case AO_BUTTON_DRAG_SELECTcxx . . $ `src/telelco-v3.0/ao_pins.h:231:9`!: |
| 474 | if (event.valuecxx . . $ ao_event#value.) |
| 475 | ao_lco_toggle_dragcxx . . $ ao_lco_toggle_drag(49f6e7a06ebc5aa8).(); |
| 476 | break; |
| 477 | case AO_BUTTON_DRAG_MODEcxx . . $ `src/telelco-v3.0/ao_pins.h:227:9`!: |
| 478 | if (event.valuecxx . . $ ao_event#value.) |
| 479 | ao_lco_drag_enablecxx . . $ ao_lco_drag_enable(49f6e7a06ebc5aa8).(); |
| 480 | else |
| 481 | ao_lco_drag_disablecxx . . $ ao_lco_drag_disable(49f6e7a06ebc5aa8).(); |
| 482 | break; |
| 483 | case AO_BUTTON_ENCODER_SELECTcxx . . $ `src/telelco-v3.0/ao_pins.h:259:9`!: |
| 484 | if (event.valuecxx . . $ ao_event#value.) { |
| 485 | if (!ao_lco_armedcxx . . $ ao_lco_armed.) { |
| 486 | ao_lco_select_modecxx . . $ ao_lco_select_mode. = 1 - ao_lco_select_modecxx . . $ ao_lco_select_mode.; |
| 487 | ao_lco_set_selectcxx . . $ ao_lco_set_select(49f6e7a06ebc5aa8).(); |
| 488 | } |
| 489 | } |
| 490 | break; |
| 491 | } |
| 492 | break; |
| 493 | } |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | /* |
| 498 | * Light up everything for a second at power on to let the user |
| 499 | * visually inspect the system for correct operation |
| 500 | */ |
| 501 | static void |
| 502 | ao_lco_display_testcxx . . $ ao_lco_display_test(49f6e7a06ebc5aa8).(void) |
| 503 | { |
| 504 | ao_led_oncxx . . $ ao_led_on(cb2f890c2fdad230).(AO_LEDS_AVAILABLEcxx . . $ `src/kernel/ao_led.h:217:9`!); |
| 505 | ao_rectcxx . . $ ao_rect(98c18c42ff1c1831).(&fbcxx . . $ fb., 0, 0, WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:29:9`!, HEIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:30:9`!, AO_BLACKcxx . . $ `src/draw/ao_draw.h:233:9`!, AO_COPYcxx . . $ `src/draw/ao_draw.h:218:9`!); |
| 506 | ao_st7565_updatecxx . . $ ao_st7565_update(fcd32f10d26c4a5c).(&fbcxx . . $ fb.); |
| 507 | ao_delaycxx . . $ ao_delay(cb2f890c2fdad230).(AO_MS_TO_TICKScxx . . $ `src/kernel/ao.h:120:9`!(1000)); |
| 508 | ao_led_offcxx . . $ ao_led_off(cb2f890c2fdad230).(AO_LEDS_AVAILABLEcxx . . $ `src/kernel/ao_led.h:217:9`!); |
| 509 | } |
| 510 | |
| 511 | static struct ao_taskcxx . . $ ao_task# ao_lco_input_taskcxx . . $ ao_lco_input_task.; |
| 512 | static struct ao_taskcxx . . $ ao_task# ao_lco_monitor_taskcxx . . $ ao_lco_monitor_task.; |
| 513 | static struct ao_taskcxx . . $ ao_task# ao_lco_data_taskcxx . . $ ao_lco_data_task.; |
| 514 | static struct ao_taskcxx . . $ ao_task# ao_lco_arm_warn_taskcxx . . $ ao_lco_arm_warn_task.; |
| 515 | static struct ao_taskcxx . . $ ao_task# ao_lco_igniter_status_taskcxx . . $ ao_lco_igniter_status_task.; |
| 516 | |
| 517 | static int16_tcxx . . $ int16_t# found_widthcxx . . $ found_width.; |
| 518 | #define MAX_FOUNDcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:518:9`! 32 |
| 519 | static int16_tcxx . . $ int16_t# found_boxescxx . . $ found_boxes.[MAX_FOUNDcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:518:9`!]; |
| 520 | static uint8_tcxx . . $ uint8_t# nfoundcxx . . $ nfound.; |
| 521 | |
| 522 | void |
| 523 | ao_lco_search_startcxx . . $ ao_lco_search_start(49f6e7a06ebc5aa8).(void) |
| 524 | { |
| 525 | ao_rectcxx . . $ ao_rect(98c18c42ff1c1831).(&fbcxx . . $ fb., 0, 0, WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:29:9`!, HEIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:30:9`!, AO_WHITEcxx . . $ `src/draw/ao_draw.h:232:9`!, AO_COPYcxx . . $ `src/draw/ao_draw.h:218:9`!); |
| 526 | ao_logocxx . . $ ao_logo(6fc4fd811aa829e8).(&fbcxx . . $ fb., &logo_transformcxx . . $ logo_transform., &LOGO_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:57:9`!, AO_BLACKcxx . . $ `src/draw/ao_draw.h:233:9`!, AO_COPYcxx . . $ `src/draw/ao_draw.h:218:9`!); |
| 527 | _ao_center_textcxx . . $ _ao_center_text(7f62b814a1e4ca26).(SCANNING_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:74:9`!, SCANNING_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:75:9`!, &TINY_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:56:9`!, "Scanning..."); |
| 528 | found_widthcxx . . $ found_width. = 0; |
| 529 | nfoundcxx . . $ nfound. = 0; |
| 530 | } |
| 531 | |
| 532 | void |
| 533 | ao_lco_search_box_checkcxx . . $ ao_lco_search_box_check(68e3ae50fe6578a9).(int16_tcxx . . $ int16_t# box) |
| 534 | { |
| 535 | if (box > 0) |
| 536 | ao_rectcxx . . $ ao_rect(98c18c42ff1c1831).(&fbcxx . . $ fb., SCAN_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:71:9`!, SCAN_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:72:9`!, box, SCAN_HEIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:73:9`!, AO_BLACKcxx . . $ `src/draw/ao_draw.h:233:9`!, AO_COPYcxx . . $ `src/draw/ao_draw.h:218:9`!); |
| 537 | ao_st7565_updatecxx . . $ ao_st7565_update(fcd32f10d26c4a5c).(&fbcxx . . $ fb.); |
| 538 | } |
| 539 | |
| 540 | void |
| 541 | ao_lco_search_box_presentcxx . . $ ao_lco_search_box_present(68e3ae50fe6578a9).(int16_tcxx . . $ int16_t# box) |
| 542 | { |
| 543 | char str[8]; |
| 544 | int16_tcxx . . $ int16_t# width; |
| 545 | int16_tcxx . . $ int16_t# box_top = FOUND_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:76:9`! - TINY_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:56:9`!.ascentcxx . . $ ao_font#ascent.; |
| 546 | int16_tcxx . . $ int16_t# x; |
| 547 | uint8_tcxx . . $ uint8_t# n; |
| 548 | |
| 549 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(str, sizeof(str), "%s%u", nfoundcxx . . $ nfound. ? ", " : "", box); |
| 550 | width = ao_text_widthcxx . . $ ao_text_width(f6d49ddd198322aa).(&TINY_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:56:9`!, str); |
| 551 | while (found_widthcxx . . $ found_width. + width > FOUND_WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:78:9`! || nfoundcxx . . $ nfound. == MAX_FOUNDcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:518:9`!) |
| 552 | { |
| 553 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(str, sizeof(str), "%u, ", found_boxescxx . . $ found_boxes.[0]); |
| 554 | found_widthcxx . . $ found_width. -= ao_text_widthcxx . . $ ao_text_width(f6d49ddd198322aa).(&TINY_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:56:9`!, str); |
| 555 | memmovecxx . . $ memmove(cc817cb175f282d).(&found_boxescxx . . $ found_boxes.[0], &found_boxescxx . . $ found_boxes.[1], (nfoundcxx . . $ nfound. - 1) * sizeof (int16_tcxx . . $ int16_t#)); |
| 556 | nfoundcxx . . $ nfound.--; |
| 557 | } |
| 558 | found_boxescxx . . $ found_boxes.[nfoundcxx . . $ nfound.++] = box; |
| 559 | |
| 560 | ao_rectcxx . . $ ao_rect(98c18c42ff1c1831).(&fbcxx . . $ fb., FOUND_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:77:9`!, FOUND_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:76:9`! - TINY_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:56:9`!.ascentcxx . . $ ao_font#ascent., FOUND_WIDTHcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:78:9`!, HEIGHTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:30:9`! - box_top, AO_WHITEcxx . . $ `src/draw/ao_draw.h:232:9`!, AO_COPYcxx . . $ `src/draw/ao_draw.h:218:9`!); |
| 561 | x = FOUND_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:77:9`!; |
| 562 | for (n = 0; n < nfoundcxx . . $ nfound.; n++) { |
| 563 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(str, sizeof(str), "%s%u", n ? ", " : "", found_boxescxx . . $ found_boxes.[n]); |
| 564 | int16_tcxx . . $ int16_t# next_x = ao_textcxx . . $ ao_text(25ad7e79b48332a8).(&fbcxx . . $ fb., &TINY_FONTcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:56:9`!, x, FOUND_Ycxx . . $ `src/telelco-v3.0/ao_lco_v3.c:76:9`!, str, AO_BLACKcxx . . $ `src/draw/ao_draw.h:233:9`!, AO_COPYcxx . . $ `src/draw/ao_draw.h:218:9`!); |
| 565 | x = next_x; |
| 566 | } |
| 567 | found_widthcxx . . $ found_width. = x - FOUND_Xcxx . . $ `src/telelco-v3.0/ao_lco_v3.c:77:9`!; |
| 568 | } |
| 569 | |
| 570 | void |
| 571 | ao_lco_search_donecxx . . $ ao_lco_search_done(49f6e7a06ebc5aa8).(void) |
| 572 | { |
| 573 | ao_st7565_updatecxx . . $ ao_st7565_update(fcd32f10d26c4a5c).(&fbcxx . . $ fb.); |
| 574 | } |
| 575 | |
| 576 | static void |
| 577 | ao_lco_maincxx . . $ ao_lco_main(49f6e7a06ebc5aa8).(void) |
| 578 | { |
| 579 | ao_lco_display_testcxx . . $ ao_lco_display_test(49f6e7a06ebc5aa8).(); |
| 580 | ao_lco_searchcxx . . $ ao_lco_search(49f6e7a06ebc5aa8).(); |
| 581 | ao_add_taskcxx . . $ ao_add_task(7d7ba390e8c1967f).(&ao_lco_input_taskcxx . . $ ao_lco_input_task., ao_lco_inputcxx . . $ ao_lco_input(49f6e7a06ebc5aa8)., "lco input"); |
| 582 | ao_add_taskcxx . . $ ao_add_task(7d7ba390e8c1967f).(&ao_lco_arm_warn_taskcxx . . $ ao_lco_arm_warn_task., ao_lco_arm_warncxx . . $ ao_lco_arm_warn(49f6e7a06ebc5aa8)., "lco arm warn"); |
| 583 | ao_add_taskcxx . . $ ao_add_task(7d7ba390e8c1967f).(&ao_lco_igniter_status_taskcxx . . $ ao_lco_igniter_status_task., ao_lco_igniter_statuscxx . . $ ao_lco_igniter_status(49f6e7a06ebc5aa8)., "lco igniter status"); |
| 584 | ao_add_taskcxx . . $ ao_add_task(7d7ba390e8c1967f).(&ao_lco_drag_taskcxx . . $ ao_lco_drag_task., ao_lco_drag_monitorcxx . . $ ao_lco_drag_monitor(49f6e7a06ebc5aa8)., "drag race"); |
| 585 | ao_lco_monitorcxx . . $ ao_lco_monitor(49f6e7a06ebc5aa8).(); |
| 586 | } |
| 587 | |
| 588 | #if DEBUGcxx . . $ `src/drivers/ao_lco.h:28:9`! |
| 589 | static void |
| 590 | ao_lco_set_debugcxx . . $ ao_lco_set_debug(49f6e7a06ebc5aa8).(void) |
| 591 | { |
| 592 | uint32_tcxx . . $ uint32_t# r = ao_cmd_decimalcxx . . $ ao_cmd_decimal(db52760e79bf9054).(); |
| 593 | if (ao_cmd_statuscxx . . $ ao_cmd_status. == ao_cmd_successcxx . . $ ao_cmd_success.){ |
| 594 | ao_lco_debugcxx . . $ ao_lco_debug. = r & 1; |
| 595 | ao_lco_event_debugcxx . . $ ao_lco_event_debug. = (r & 2) >> 1; |
| 596 | } |
| 597 | } |
| 598 | |
| 599 | const struct ao_cmdscxx . . $ ao_cmds# ao_lco_cmdscxx . . $ ao_lco_cmds.[] = { |
| 600 | { ao_lco_set_debugcxx . . $ ao_lco_set_debug(49f6e7a06ebc5aa8)., "D <0 off, 1 on>\0Debug" }, |
| 601 | { ao_lco_searchcxx . . $ ao_lco_search(49f6e7a06ebc5aa8)., "s\0Search for pad boxes" }, |
| 602 | { ao_lco_pretendcxx . . $ ao_lco_pretend(49f6e7a06ebc5aa8)., "p\0Pretend there are lots of pad boxes" }, |
| 603 | { 0, NULLcxx . . $ `/usr/lib/gcc/arm-none-eabi/15/include/stddef.h:419:9`! } |
| 604 | }; |
| 605 | #endif |
| 606 | |
| 607 | void |
| 608 | ao_lco_initcxx . . $ ao_lco_init(49f6e7a06ebc5aa8).(void) |
| 609 | { |
| 610 | ao_add_taskcxx . . $ ao_add_task(7d7ba390e8c1967f).(&ao_lco_monitor_taskcxx . . $ ao_lco_monitor_task., ao_lco_maincxx . . $ ao_lco_main(49f6e7a06ebc5aa8)., "lco monitor"); |
| 611 | ao_add_taskcxx . . $ ao_add_task(7d7ba390e8c1967f).(&ao_lco_data_taskcxx . . $ ao_lco_data_task., ao_lco_datacxx . . $ ao_lco_data(49f6e7a06ebc5aa8)., "lco data"); |
| 612 | #if DEBUGcxx . . $ `src/drivers/ao_lco.h:28:9`! |
| 613 | ao_cmd_registercxx . . $ ao_cmd_register(748e4bb744afc5b0).(&ao_lco_cmdscxx . . $ ao_lco_cmds.[0]); |
| 614 | #endif |
| 615 | } |