// ************************************************************************************************* // @fn display_heartrate // @brief Heart rate display routine. // @param u8 line LINE1 // u8 update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_UPDATE_PARTIAL, DISPLAY_LINE_CLEAR // @return none // ************************************************************************************************* void display_heartrate(u8 line, u8 update) { u8 * str; if (update != DISPLAY_LINE_CLEAR) { if (is_bluerobin()) { str = itoa(sBlueRobin.heartrate, 3, 2); display_chars(LCD_SEG_L1_2_0, str, SEG_ON); } else { display_chars(LCD_SEG_L1_2_0, (u8 *)"---", SEG_ON); } } // Redraw whole screen if (!is_bluerobin()) { if (update == DISPLAY_LINE_UPDATE_FULL) { display_symbol(LCD_ICON_HEART, SEG_ON); } else if (update == DISPLAY_LINE_CLEAR) { // Clear heart when not connected display_symbol(LCD_ICON_HEART, SEG_OFF); } } }
// ************************************************************************************************* // @fn display_alarm // @brief Display alarm time. 24H / 12H time format. // @param u8 line LINE1, LINE2 // u8 update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_CLEAR // @return none // ************************************************************************************************* void display_alarm(u8 line, u8 update) { if (update == DISPLAY_LINE_UPDATE_FULL) { display_hours_12_or_24(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), sAlarm.hour, 2, 1, SEG_ON); display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), _itoa(sAlarm.minute, 2, 0), SEG_ON); display_symbol(switch_seg(line, LCD_SEG_L1_COL, LCD_SEG_L2_COL0), SEG_ON); // Show blinking alarm icon display_symbol(LCD_ICON_ALARM, SEG_ON_BLINK_ON); } else if (update == DISPLAY_LINE_CLEAR) { // Clean up function-specific segments before leaving function display_symbol(LCD_SYMB_AM, SEG_OFF); // Clear / set alarm icon if (sAlarm.state == ALARM_DISABLED) { display_symbol(LCD_ICON_ALARM, SEG_OFF_BLINK_OFF); } else { display_symbol(LCD_ICON_ALARM, SEG_ON_BLINK_OFF); } } }
// ************************************************************************************************* // @fn check_ucs // @brief Check the Unified Clock System. // @param none // @return none // ************************************************************************************************* void check_ucs(void) { // Incremet counter every minute if started if(sUcsResetHandling.counter != 0) { sUcsResetHandling.counter++; // Reset UCS twice: one times after one minute and a second time after an other minute if((sUcsResetHandling.counter == 2) || (sUcsResetHandling.counter == 3)) { // Reset UCS __disable_interrupt(); init_ucs(); __enable_interrupt(); } // Switch off symbol on display after 12 hours (60*12=720 minutes) and stop counter if(sUcsResetHandling.counter >= 720) { sUcsResetHandling.counter = 0; display_symbol(LCD_SYMB_MAX, SEG_OFF); } } // Check UCS for failure if((SFRIFG1 & OFIFG) != 0) { display_symbol(LCD_SYMB_MAX, SEG_ON); if(sUcsResetHandling.status == UCSRESET_AUTO) { // Start counter sUcsResetHandling.counter = 1; } } }
static void menumode_handler(void) { if (ports_button_pressed(PORTS_BTN_STAR, 0)) { /* exit mode mode */ menumode.enabled = 0; /* clear both lines but keep symbols! */ display_clear(0, 1); display_clear(0, 2); /* turn off up/down symbols */ display_symbol(0, LCD_SYMB_ARROW_UP, SEG_OFF); display_symbol(0, LCD_SYMB_ARROW_DOWN, SEG_OFF); /* stop blinking name of current selected module */ display_chars(0, LCD_SEG_L2_4_0, NULL, BLINK_OFF); /* activate item */ if (menumode.item->activate_fn) menumode.item->activate_fn(); } else if (ports_button_pressed(PORTS_BTN_UP, 0)) { menumode.item = menumode.item->next; display_chars(0, LCD_SEG_L2_4_0, menumode.item->name, SEG_SET); } else if (ports_button_pressed(PORTS_BTN_DOWN, 0)) { menumode.item = menumode.item->prev; display_chars(0, LCD_SEG_L2_4_0, menumode.item->name, SEG_SET); } }
static void altitude_activate(void) { /* display -- symbol while a measure is not performed */ display_chars(0, LCD_SEG_L1_3_0, "----", SEG_SET); update(SYS_MSG_FAKE); sys_messagebus_register(&update, consumption_array[consumption-1]); sys_messagebus_register(&time_callback, SYS_MSG_RTC_MINUTE | SYS_MSG_RTC_HOUR #ifdef CONFIG_MOD_CLOCK_BLINKCOL | SYS_MSG_RTC_SECOND #endif ); lcd_screens_create(6); display_chars(ALT_SCREEN_CLIMB, LCD_SEG_L2_5_0, " CLIMB", SEG_SET); display_symbol(ALT_SCREEN_CLIMB, LCD_SEG_L1_DP0, SEG_ON); display_symbol(ALT_SCREEN_CLIMB, LCD_UNIT_L1_PER_S, SEG_ON); display_chars(ALT_SCREEN_MIN, LCD_SEG_L2_5_0, " MIN ", SEG_SET); display_chars(ALT_SCREEN_MAX, LCD_SEG_L2_5_0, " MAX ", SEG_SET); display_chars(ALT_SCREEN_ACC_N, LCD_SEG_L2_5_0, " ACC N", SEG_SET); display_chars(ALT_SCREEN_ACC_P, LCD_SEG_L2_5_0, " ACC P", SEG_SET); }
// ************************************************************************************************* // @fn display_time // @brief Clock display routine. Supports 24H and 12H time format, // through the helper display_hours_with_12_24. // @param u8 line LINE1 // u8 update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_UPDATE_PARTIAL // @return none // ************************************************************************************************* void display_time(u8 line, u8 update) { // Partial and full update if (update == DISPLAY_LINE_UPDATE_PARTIAL || update == DISPLAY_LINE_UPDATE_FULL) { if ( ( line == LINE1 && sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW ) || ( line == LINE2 && sTime.line2ViewStyle == DISPLAY_DEFAULT_VIEW ) ) { // Display hours #ifndef LZH display_hours_12_or_24(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), sTime.hour, 2, 1, SEG_ON); #else display_hours_12_or_24(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), sTime.hour, 2, 0, SEG_ON); #endif // Display minute display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), _itoa(sTime.minute, 2, 0), SEG_ON); display_symbol(switch_seg(line, LCD_SEG_L1_COL, LCD_SEG_L2_COL0), SEG_ON_BLINK_ON); } else { // Display seconds display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), _itoa(sTime.second, 2, 0), SEG_ON); display_symbol(switch_seg(line, LCD_SEG_L1_DP1, LCD_SEG_L2_DP), SEG_ON); } } else if (update == DISPLAY_LINE_CLEAR) { display_symbol(switch_seg(line, LCD_SEG_L1_COL, LCD_SEG_L2_COL0), SEG_OFF_BLINK_OFF); // Change display style to default (HH:MM) sTime.line1ViewStyle = DISPLAY_DEFAULT_VIEW; // Clean up AM/PM icon display_symbol(LCD_SYMB_AM, SEG_OFF); } }
static void temperature_deactivate(void) { sys_messagebus_unregister(&measure_temp); /* cleanup screen */ display_symbol(0, LCD_UNIT_L1_DEGREE, SEG_OFF); display_symbol(0, LCD_SEG_L1_DP0, SEG_OFF); }
// ************************************************************************************************* // @fn display_alarm // @brief Display alarm time. 24H / 12H time format. // @param u8 line LINE1, LINE2 // u8 update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_CLEAR // @return none // ************************************************************************************************* void display_alarm(u8 line, u8 update) { #ifndef CONFIG_METRIC_ONLY u8 hour12; #endif if (update == DISPLAY_LINE_UPDATE_FULL) { #ifdef CONFIG_METRIC_ONLY display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(sAlarm.hour, 2, 0), SEG_ON); #else if (sys.flag.use_metric_units) { // Display 24H alarm time "HH:MM" display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(sAlarm.hour, 2, 0), SEG_ON); } else { // Display 12H alarm time "HH:MM" + AM/PM hour12 = convert_hour_to_12H_format(sAlarm.hour); display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(hour12, 2, 0), SEG_ON); // Display AM/PM symbol display_am_pm_symbol(sAlarm.hour); } #endif display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), itoa(sAlarm.minute, 2, 0), SEG_ON); display_symbol(switch_seg(line, LCD_SEG_L1_COL, LCD_SEG_L2_COL0), SEG_ON); // Show blinking alarm icon display_symbol(LCD_ICON_ALARM, SEG_ON_BLINK_ON); // // If alarm is enabled, show icon // if (sAlarm.state == ALARM_ENABLED) // { // display_symbol(LCD_ICON_ALARM, SEG_ON_BLINK_OFF); // } // // When alarm is disabled, blink icon to indicate that this is not current time! // else if (sAlarm.state == ALARM_DISABLED) // { // } } else if (update == DISPLAY_LINE_CLEAR) { // Clean up function-specific segments before leaving function display_symbol(LCD_SYMB_AM, SEG_OFF); // Clear / set alarm icon if (sAlarm.state == ALARM_DISABLED) { display_symbol(LCD_ICON_ALARM, SEG_OFF_BLINK_OFF); } else { display_symbol(LCD_ICON_ALARM, SEG_ON_BLINK_OFF); } } }
void it_tx_cmd(uint8_t prefix, uint8_t cmd) { uint8_t p = 0; uint8_t rprefix; uint8_t it_buff[INTERTECHNO_SEQ_SIZE]; int8_t i; rprefix = rotate_byte(prefix); // replace 1 with 0x8e and 0 with 0x88 for (i = 7; i >= 0; i--) { if (rprefix & (1 << i)) { it_buff[p] = 0x8e; } else { it_buff[p] = 0x88; } p++; } for (i = 3; i >= 0; i--) { if (cmd & (1 << i)) { it_buff[p] = 0x8e; } else { it_buff[p] = 0x88; } p++; } // sync sequence it_buff[p++] = 0x80; it_buff[p++] = 0; it_buff[p++] = 0; it_buff[p] = 0; // display RF symbol display_symbol(0, LCD_ICON_BEEPER1, SEG_ON); display_symbol(0, LCD_ICON_BEEPER2, SEG_ON); display_symbol(0, LCD_ICON_BEEPER3, SEG_ON); it_rf_init(); Strobe(RF_SCAL); // re-calibrate radio // set an interrupt to trigger when the packet is fully sent RF1AIES |= BIT9; RF1AIFG &= ~BIT9; // Clear pending interrupts RF1AIE |= BIT9; // Enable TX end-of-packet interrupt // factory remotes send the command sequence 4 times for (i = 0; i < 4; i++) { WriteBurstReg(RF_TXFIFOWR, it_buff, INTERTECHNO_SEQ_SIZE); } Strobe(RF_STX); // transmit }
/* Activation of the module */ static void stopwatch_activated() { display_symbol(0, LCD_SEG_L2_COL0, SEG_ON); display_symbol(0, LCD_SEG_L2_COL1, SEG_ON); if (sSwatch_conf.state == SWATCH_MODE_BACKGROUND) { sSwatch_conf.state = SWATCH_MODE_ON; return; } sys_messagebus_register(&stopwatch_event, SYS_MSG_TIMER_20HZ); drawStopWatchScreen(); }
static void it_tx_end(enum sys_message msg) { Strobe(RF_SIDLE); // IDLE Strobe(RF_SFTX); // flush TXFIFO Strobe(RF_SPWD); // power-down mode // clear RF symbol display_symbol(0, LCD_ICON_BEEPER1, SEG_OFF); display_symbol(0, LCD_ICON_BEEPER2, SEG_OFF); display_symbol(0, LCD_ICON_BEEPER3, SEG_OFF); }
//* ************************************************************************************************ /// @fn display_temp_symbols(int8_t disp) /// @brief Display the current unit symbol & +/- value indicator. /// @param disp Toogle on/off the symbols /// @return none //* ************************************************************************************************ void display_temp_symbols(int8_t disp) { if(disp == 0) { display_symbol(0,LCD_UNIT_L1_DEGREE, SEG_OFF); display_symbol(0, LCD_SYMB_ARROW_UP, SEG_OFF); display_symbol(0, LCD_SYMB_ARROW_DOWN, SEG_OFF); } else { display_symbol(0,LCD_SEG_L1_DP1, SEG_ON); display_symbol(0,LCD_UNIT_L1_DEGREE, SEG_ON); } }
// ************************************************************************************************* // @fn stop_eggtimer_alarm // @brief Puts eggtimer in STOP mode, halts alarm mode and buzzing if active, updates eggtimer // symbol. Safe to call, even if eggtimer menu not active. // @param none // @return none // ************************************************************************************************* void stop_eggtimer_alarm(void) { sEggtimer.state = EGGTIMER_STOP; sEggtimer.duration = EGGTIMER_ALARM_DURATION; if (eggtimer_visible()) { display_symbol(LCD_ICON_RECORD, SEG_ON_BLINK_OFF); } else { display_symbol(LCD_ICON_RECORD, SEG_OFF_BLINK_OFF); } stop_buzzer(); // FIXME: needs to play friendly with other buzzer-using modules (e.g. alarm) }
// // Common function to turn off various symbols we use in our view modes. // void _display_l2_clean( void ) { #if ( VARIO_VZ || VARIO_ALTMAX ) display_symbol( LCD_SYMB_MAX, SEG_OFF); #endif #if VARIO_F_TIME display_symbol(LCD_SEG_L2_COL1, SEG_OFF); display_symbol(LCD_SEG_L2_COL0, SEG_OFF); #endif }
void display_sort(Z3_context c, FILE * out, Z3_sort ty) { switch (Z3_get_sort_kind(c, ty)) { case Z3_UNINTERPRETED_SORT: display_symbol(c, out, Z3_get_sort_name(c, ty)); break; /* case Z3_BOOL_SORT: */ /* fprintf(out, "bool"); */ /* break; */ case Z3_INT_SORT: fprintf(out, "int"); break; case Z3_REAL_SORT: fprintf(out, "real"); break; /* case Z3_BV_SORT: */ /* fprintf(out, "bv%d", Z3_get_bv_sort_size(c, ty)); */ /* break; */ case Z3_ARRAY_SORT: fprintf(out, "["); display_sort(c, out, Z3_get_array_sort_domain(c, ty)); fprintf(out, "->"); display_sort(c, out, Z3_get_array_sort_range(c, ty)); fprintf(out, "]"); break; /* case Z3_DATATYPE_SORT: */ /* if (Z3_get_datatype_sort_num_constructors(c, ty) != 1) */ /* { */ /* fprintf(out, "%s", Z3_sort_to_string(c,ty)); */ /* break; */ /* } */ /* { */ /* unsigned num_fields = Z3_get_tuple_sort_num_fields(c, ty); */ /* unsigned i; */ /* fprintf(out, "("); */ /* for (i = 0; i < num_fields; i++) { */ /* Z3_func_decl field = Z3_get_tuple_sort_field_decl(c, ty, i); */ /* if (i > 0) { */ /* fprintf(out, ", "); */ /* } */ /* display_sort(c, out, Z3_get_range(c, field)); */ /* } */ /* fprintf(out, ")"); */ /* break; */ /* } */ default: fprintf(out, "unknown["); display_symbol(c, out, Z3_get_sort_name(c, ty)); fprintf(out, "]"); break; } }
// ************************************************************************************************* // @fn start_simpliciti_tx_only // @brief Start SimpliciTI (tx only). // @param simpliciti_state_t SIMPLICITI_ACCELERATION, SIMPLICITI_BUTTONS // @return none // ************************************************************************************************* void start_simpliciti_tx_only(simpliciti_mode_t mode) { // Turn on beeper icon to show activity display_symbol(LCD_ICON_BEEPER1, SEG_ON_BLINK_ON); // Prepare radio for RF communication open_radio(); // Set SimpliciTI mode sRFsmpl.mode = mode; // Set SimpliciTI timeout to save battery power sRFsmpl.timeout = SIMPLICITI_TIMEOUT; // Start SimpliciTI stack. Try to link to access point. // Exit with timeout or by a button DOWN press. if (simpliciti_link()) { // Enter TX only routine. This will transfer button events and/or acceleration data to access point. simpliciti_main_tx_only(); } // Set SimpliciTI state to OFF sRFsmpl.mode = SIMPLICITI_OFF; // Stop acceleration sensor as_stop(); // Powerdown radio close_radio(); // Clear last button events BUTTONS_IFG = 0x00; button.all_flags = 0; // Clear icons display_symbol(LCD_ICON_BEEPER1, SEG_OFF_BLINK_OFF); }
// ************************************************************************************************* // @fn display_time // @brief Clock display routine. Supports 24H and 12H time format, // through the helper display_hours_with_12_24. // @param uint8_t line LINE1 // uint8_t update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_UPDATE_PARTIAL // @return none // ************************************************************************************************* void display_time(uint8_t line, uint8_t update) { // Partial update if (update == DISPLAY_LINE_UPDATE_PARTIAL) { if(sTime.drawFlag != 0) { if (sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW) { switch(sTime.drawFlag) { case 3: display_hours_12_or_24(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), sTime.hour, 2, 1, SEG_ON); case 2: display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), itoa(sTime.minute, 2, 0), SEG_ON); } } else { // Seconds are always updated display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), itoa(sTime.second, 2, 0), SEG_ON); } } } else if (update == DISPLAY_LINE_UPDATE_FULL) { // Full update if ( ( line == LINE1 && sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW ) || ( line == LINE2 && sTime.line2ViewStyle == DISPLAY_DEFAULT_VIEW ) ) { // Display hours display_hours_12_or_24(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), sTime.hour, 2, 1, SEG_ON); // Display minute display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), itoa(sTime.minute, 2, 0), SEG_ON); display_symbol(switch_seg(line, LCD_SEG_L1_COL, LCD_SEG_L2_COL0), SEG_ON_BLINK_ON); } else { // Display seconds display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), itoa(sTime.second, 2, 0), SEG_ON); display_symbol(switch_seg(line, LCD_SEG_L1_DP1, LCD_SEG_L2_DP), SEG_ON); } } else if (update == DISPLAY_LINE_CLEAR) { display_symbol(switch_seg(line, LCD_SEG_L1_COL, LCD_SEG_L2_COL0), SEG_OFF_BLINK_OFF); // Change display style to default (HH:MM) sTime.line1ViewStyle = DISPLAY_DEFAULT_VIEW; // Clean up AM/PM icon display_symbol(LCD_SYMB_AM, SEG_OFF); } }
void edit_unit_sel(uint8_t pos) { if(useMetric){ display_chars(0, LCD_SEG_L1_2_1, "M", SEG_SET); display_symbol(0, LCD_UNIT_L1_M, SEG_ON); display_symbol(0, LCD_UNIT_L1_FT, SEG_OFF); }else{ display_chars(0, LCD_SEG_L1_2_1, "FT", SEG_SET); display_symbol(0, LCD_UNIT_L1_M, SEG_OFF); display_symbol(0, LCD_UNIT_L1_FT, SEG_ON); } display_chars(0, LCD_SEG_L1_2_1, NULL, BLINK_ON); display_chars(0, LCD_SEG_L2_3_0, "UNIT", SEG_SET); }
// ************************************************************************************************* // @fn display_date // @brief Display date in DD.MM format (metric units) or MM.DD (English units). // @param u8 line LINE1, LINE2 // u8 update DISPLAY_LINE_UPDATE_FULL, // DISPLAY_LINE_UPDATE_PARTIAL // @return none // ************************************************************************************************* void display_date(u8 line, u8 update) { u8 *str; if (update == DISPLAY_LINE_UPDATE_FULL) { if (sDate.display == DISPLAY_DEFAULT_VIEW) { // Convert day to string str = int_to_array(sDate.day, 2, 0); if (sys.flag.use_metric_units) { display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), str, SEG_ON); } else { display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), str, SEG_ON); } // Convert month to string str = int_to_array(sDate.month, 2, 0); if (sys.flag.use_metric_units) { display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), str, SEG_ON); } else { display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), str, SEG_ON); } // Display "." to separate day and month display_symbol(switch_seg(line, LCD_SEG_L1_DP1, LCD_SEG_L2_DP), SEG_ON); } else { // Convert year to string str = int_to_array(sDate.year, 4, 0); display_chars(switch_seg(line, LCD_SEG_L1_3_0, LCD_SEG_L2_3_0), str, SEG_ON); // Clear "." display_symbol(switch_seg(line, LCD_SEG_L1_DP1, LCD_SEG_L2_DP), SEG_OFF); } } else if (update == DISPLAY_LINE_CLEAR) { // Show day and month on display when coming around next time sDate.display = DISPLAY_DEFAULT_VIEW; } }
// ************************************************************************************************* // @fn display_eggtimer // @brief eggtimer user routine. // @param u8 line LINE2 // u8 update DISPLAY_LINE_UPDATE_PARTIAL, DISPLAY_LINE_UPDATE_FULL // @return none // ************************************************************************************************* void display_eggtimer(u8 line, u8 update) { u8 * str; // Partial line update only if (update == DISPLAY_LINE_UPDATE_PARTIAL) { // Check draw flag to minimize workload switch(sEggtimer.drawFlag) { case 3: // Hours changed str = _itoa(sEggtimer.hours, 2, 0); display_chars(LCD_SEG_L2_5_4, str, SEG_ON); case 2: // Minutes changed str = _itoa(sEggtimer.minutes, 2, 0); display_chars(LCD_SEG_L2_3_2, str, SEG_ON); case 1: // Seconds changed str = _itoa(sEggtimer.seconds, 2, 0); display_chars(LCD_SEG_L2_1_0, str, SEG_ON); } sEggtimer.drawFlag = 0; // Clear draw flag } // Redraw whole line else if (update == DISPLAY_LINE_UPDATE_FULL) { // Display HH:MM:SS str = _itoa(sEggtimer.hours, 2, 0); display_chars(LCD_SEG_L2_5_4, str, SEG_ON); str = _itoa(sEggtimer.minutes, 2, 0); display_chars(LCD_SEG_L2_3_2, str, SEG_ON); str = _itoa(sEggtimer.seconds, 2, 0); display_chars(LCD_SEG_L2_1_0, str, SEG_ON); display_symbol(LCD_SEG_L2_COL1, SEG_ON); display_symbol(LCD_SEG_L2_COL0, SEG_ON); if (sEggtimer.state != EGGTIMER_STOP) { // Blink if running or alarm triggered display_symbol(LCD_ICON_RECORD, SEG_ON_BLINK_ON); } else { // Solid on if not running display_symbol(LCD_ICON_RECORD, SEG_ON_BLINK_OFF); } } else if (update == DISPLAY_LINE_CLEAR) { // Stop blinking icon only if eggtimer isn't running if (sEggtimer.state == EGGTIMER_STOP) display_symbol(LCD_ICON_RECORD, SEG_OFF); } }
void blinkCol(uint8_t screen, uint8_t line) { switch (line) { case 1: display_symbol(screen, LCD_SEG_L1_COL, SEG_ON); display_symbol(screen, LCD_SEG_L1_COL, BLINK_ON); break; case 2: display_symbol(screen, LCD_SEG_L2_COL0, SEG_ON); display_symbol(screen, LCD_SEG_L2_COL0, BLINK_ON); break; default: break; } }
// ************************************************************************************************* // @fn stop_eggtimer_alarm // @brief Puts eggtimer in STOP mode, halts alarm mode and buzzing if active, updates eggtimer // symbol. Safe to call, even if eggtimer menu not active. // @param none // @return none // ************************************************************************************************* void stop_eggtimer_alarm(void) { // We dont need the timer active anymore Timer0_A1_Unregister(eggtimer_tick); sEggtimer.state = EGGTIMER_STOP; sEggtimer.duration = EGGTIMER_ALARM_DURATION; if (eggtimer_visible()) { display_symbol(LCD_ICON_RECORD, SEG_ON_BLINK_OFF); } else { display_symbol(LCD_ICON_RECORD, SEG_OFF_BLINK_OFF); } stop_buzzer(); // FIXME: needs to play friendly with other buzzer-using modules (e.g. alarm) }
/* Deactivation of the module */ static void stopwatch_deactivated() { /* clean up screen */ display_clear(0, 1); display_clear(0, 2); if (sSwatch_conf.state == SWATCH_MODE_ON) { sSwatch_conf.state = SWATCH_MODE_BACKGROUND; return; } else { sys_messagebus_unregister_all(&stopwatch_event); display_symbol(0, LCD_ICON_STOPWATCH, SEG_OFF); display_symbol(0, LCD_SEG_L2_COL0, SEG_OFF); display_symbol(0, LCD_SEG_L2_COL1, SEG_OFF); } }
void edit_unit_set(uint8_t pos, int8_t step) { if(useMetric){ useMetric = 0; display_chars(0, LCD_SEG_L1_2_1, "FT", SEG_SET); display_symbol(0, LCD_UNIT_L1_M, SEG_OFF); display_symbol(0, LCD_UNIT_L1_FT, SEG_ON); }else{ useMetric = 1; display_clear(0,1); display_chars(0, LCD_SEG_L1_2_1, "M", SEG_SET); display_symbol(0, LCD_UNIT_L1_M, SEG_ON); display_symbol(0, LCD_UNIT_L1_FT, SEG_OFF); } }
// ************************************************************************************************* // @fn display_altitude // @brief Display routine. Supports display in meters and feet. // @param u8 line LINE1 // u8 update DISPLAY_LINE_UPDATE_FULL, // DISPLAY_LINE_UPDATE_PARTIAL, DISPLAY_LINE_CLEAR // @return none // ************************************************************************************************* void display_altitude(int16_t alt, uint8_t scr) { int16_t ft; uint16_t value; if(useMetric){ // Display altitude in xxxx m format, allow 3 leading blank digits if (alt >= 0) { value = alt; display_symbol(scr, LCD_SYMB_ARROW_UP, SEG_ON); display_symbol(scr, LCD_SYMB_ARROW_DOWN, SEG_OFF); } else { value = alt * (-1); display_symbol(scr, LCD_SYMB_ARROW_UP, SEG_OFF); display_symbol(scr, LCD_SYMB_ARROW_DOWN, SEG_ON); } display_symbol(scr, LCD_UNIT_L1_M, SEG_ON); }else{ // Convert from meters to feet ft = convert_m_to_ft(alt); // Limit to 9999ft (3047m) if (ft > 9999) ft = 9999; // Display altitude in xxxx ft format, allow 3 leading blank digits if (ft >= 0) { value = ft; display_symbol(scr, LCD_SYMB_ARROW_UP, SEG_ON); display_symbol(scr, LCD_SYMB_ARROW_DOWN, SEG_OFF); } else { value = ft * -1; display_symbol(scr, LCD_SYMB_ARROW_UP, SEG_OFF); display_symbol(scr, LCD_SYMB_ARROW_DOWN, SEG_ON); } display_symbol(scr, LCD_UNIT_L1_FT, SEG_ON); } _printf(scr, LCD_SEG_L1_3_0, "%4u", value); }
void time_callback(enum sys_message msg) { if((submenuState == 0) && (accelerometer == 0)){ #ifdef CONFIG_MOD_CLOCK_BLINKCOL display_symbol(0, LCD_SEG_L2_COL0, ((rtca_time.sec & 0x01) ? SEG_ON : SEG_OFF)); #endif if (msg & SYS_MSG_RTC_HOUR) { #ifdef CONFIG_MOD_CLOCK_AMPM uint8_t tmp_hh = rtca_time.hour; if (tmp_hh > 12) { tmp_hh -= 12; } else if(tmp_hh == 0) { tmp_hh = 12; } _printf(0, LCD_SEG_L2_4_2, " %2u", tmp_hh); #else _printf(0, LCD_SEG_L2_4_2, " %02u", rtca_time.hour); #endif } if (msg & SYS_MSG_RTC_MINUTE) _printf(0, LCD_SEG_L2_1_0, "%02u", rtca_time.min); } }
static void clock_deactivated() { sys_messagebus_unregister(&clock_event); /* destroy virtual screens */ lcd_screens_destroy(); /* clean up screen */ display_symbol(0, LCD_SEG_L1_COL, SEG_OFF); #ifdef CONFIG_MOD_CLOCK_AMPM display_symbol(0, LCD_SYMB_AM, SEG_OFF); display_symbol(0, LCD_SYMB_PM, SEG_OFF); #endif display_clear(0, 1); display_clear(0, 2); }
/************************ menu callbacks **********************************/ static void clock_activated() { sys_messagebus_register(&clock_event, SYS_MSG_RTC_MINUTE | SYS_MSG_RTC_HOUR | SYS_MSG_RTC_DAY | SYS_MSG_RTC_MONTH #ifdef CONFIG_MOD_CLOCK_BLINKCOL | SYS_MSG_RTC_SECOND #endif ); /* create two screens, the first is always the active one */ lcd_screens_create(2); /* display stuff that won't change with time */ display_symbol(0, LCD_SEG_L1_COL, SEG_ON); display_char(0, LCD_SEG_L2_2, '-', SEG_SET); /* update screens with fake event */ clock_event(SYS_MSG_RTC_YEAR | SYS_MSG_RTC_MONTH | SYS_MSG_RTC_DAY | SYS_MSG_RTC_HOUR | SYS_MSG_RTC_MINUTE); }
static void temperature_activate(void) { /* display static elements */ display_symbol(0, LCD_UNIT_L1_DEGREE, SEG_ON); display_symbol(0, LCD_SEG_L1_DP0, SEG_ON); #ifdef CONFIG_TEMPERATURE_METRIC display_char(0, LCD_SEG_L2_4, 'C', SEG_SET); #else display_char(0, LCD_SEG_L2_4, 'F', SEG_SET); #endif /* display -- symbol while a measure is not performed */ display_chars(0, LCD_SEG_L1_2_0, "---", SEG_ON); sys_messagebus_register(&measure_temp, SYS_MSG_TIMER_4S); }
void battery_measurement(void) { /* Convert external battery voltage (ADC12INCH_11=AVCC-AVSS/2) voltage = adc12_single_conversion(REFVSEL_2, ADC12SHT0_10, ADC12SSEL_0, ADC12SREF_1, ADC12INCH_11, ADC12_BATT_CONVERSION_TIME_USEC); */ uint16_t voltage = adc12_single_conversion(REFVSEL_1, ADC12SHT0_10, ADC12INCH_11); /* Convert ADC value to "x.xx V" Ideally we have A11=0->AVCC=0V ... A11=4095(2^12-1)->AVCC=4V --> (A11/4095)*4V=AVCC --> AVCC=(A11*4)/4095 */ voltage = (voltage << 2) / 41; /* Correct measured voltage with calibration value */ voltage += battery_info.offset; /* Discard values that are clearly outside the measurement range */ if (voltage > BATTERY_HIGH_THRESHOLD) voltage = battery_info.voltage; #ifndef CONFIG_BATTERY_DISABLE_FILTER /* Filter battery voltage */ battery_info.voltage = ((voltage << 1) + (battery_info.voltage << 3)) / 10; #else /* Get it raw instead for testing */ battery_info.voltage = voltage; #endif /* Display blinking battery symbol if low */ if (battery_info.voltage < BATTERY_LOW_THRESHOLD) display_symbol(0, LCD_SYMB_BATTERY, SEG_ON | BLINK_ON); }