Browse Source

Added compile time configuration to select AM/PM or 24 hour time display.

Possible (in order of code size requirements) to compile with 24hr, AM/PM or selectable.
This also breaks the link between metric units and time display mode.
fertito
Dean Sellers 13 years ago
parent
commit
f563696b92
  1. 38
      driver/display.c
  2. 14
      driver/display.h
  3. 1
      include/project.h
  4. 142
      logic/alarm.c
  5. 378
      logic/clock.c
  6. 1
      logic/clock.h

38
driver/display.c

@ -322,24 +322,32 @@ void display_value1(u8 segments, u32 value, u8 digits, u8 blanks)
// *************************************************************************************************
void display_hours1(u8 segments, u32 value, u8 digits, u8 blanks)
{
#ifdef CONFIG_METRIC_ONLY
display_value1(segments, (u16) value, digits, blanks);
#else
u8 hours;
#if (OPTION_TIME_DISPLAY > CLOCK_24HR)
u8 hours;
#endif
#if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT)
if (sys.flag.am_pm_time)
{
#endif
#if (OPTION_TIME_DISPLAY > CLOCK_24HR)
// convert internal 24H time format to 12H time format
hours = convert_hour_to_12H_format(value);
if (sys.flag.use_metric_units)
// display hours in 12H time format
display_value1(segments, hours, digits, blanks);
display_am_pm_symbol(value);
#endif
#if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT)
}
else
{
#endif
#if (OPTION_TIME_DISPLAY != CLOCK_AM_PM)
// Display hours in 24H time format
display_value1(segments, (u16) value, digits, blanks);
}
else
{
// convert internal 24H time format to 12H time format
hours = convert_hour_to_12H_format(value);
// display hours in 12H time format
display_value1(segments, hours, digits, blanks);
display_am_pm_symbol(value);
#endif
#if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT)
}
#endif
}
@ -351,7 +359,7 @@ void display_hours1(u8 segments, u32 value, u8 digits, u8 blanks)
// @param u8 hour 24H internal time format
// @return none
// *************************************************************************************************
#ifndef CONFIG_METRIC_ONLY
#if (OPTION_TIME_DISPLAY > CLOCK_24HR)
void display_am_pm_symbol(u8 hour)
{
// Display AM/PM symbol

14
driver/display.h

@ -42,6 +42,20 @@
#include <project.h>
/*
* Set some options at compile time for how the time is displayed
* The options are, in order of code space used-
* OPTION_TIME_DISPLAY == CLOCK_24HR
* OPTION_TIME_DISPLAY == CLOCK_AM_PM
* OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT
*/
#define CLOCK_24HR 0
#define CLOCK_AM_PM 1
#define CLOCK_DISPLAY_SELECT 2
#define OPTION_TIME_DISPLAY CLOCK_DISPLAY_SELECT
// *************************************************************************************************

1
include/project.h

@ -96,6 +96,7 @@ typedef union
u16 up_down_repeat_enabled : 1; // While in set_value(), create virtual UP/DOWN button events
u16 low_battery : 1; // 1 = Battery is low
u16 use_metric_units : 1; // 1 = Use metric units, 0 = use English units
u16 am_pm_time : 1; // 1 = Display times as AM/PM else 24Hr
u16 delay_over : 1; // 1 = Timer delay over
u16 no_beep : 1; // Don't beep on key press
} flag;

142
logic/alarm.c

@ -197,37 +197,37 @@ void mx_alarm(u8 line)
// Loop values until all are set or user breaks set
while(1)
{
// Idle timeout: exit without saving
if (sys.flag.idle_timeout) break;
// STAR (short): save, then exit
if (button.flag.star)
{
// Store local variables in global alarm time
sAlarm.hour = hours;
sAlarm.minute = minutes;
// Set display update flag
display.flag.line1_full_update = 1;
break;
}
switch (select)
{
case 0: // Set hour
set_value(&hours, 2, 0, 0, 23, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_2, display_hours1);
select = 1;
break;
case 1: // Set minutes
set_value(&minutes, 2, 0, 0, 59, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_1_0, display_value1);
select = 0;
break;
}
// Idle timeout: exit without saving
if (sys.flag.idle_timeout) break;
// STAR (short): save, then exit
if (button.flag.star)
{
// Store local variables in global alarm time
sAlarm.hour = hours;
sAlarm.minute = minutes;
// Set display update flag
display.flag.line1_full_update = 1;
break;
}
switch (select)
{
case 0: // Set hour
set_value(&hours, 2, 0, 0, 23, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_2, display_hours1);
select = 1;
break;
case 1: // Set minutes
set_value(&minutes, 2, 0, 0, 59, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_1_0, display_value1);
select = 0;
break;
}
}
// Clear button flag
button.all_flags = 0;
// Indicate to display function that new value is available
display.flag.update_alarm = 1;
}
@ -242,59 +242,55 @@ void mx_alarm(u8 line)
// *************************************************************************************************
void display_alarm(u8 line, u8 update)
{
#ifndef CONFIG_METRIC_ONLY
#if (OPTION_TIME_DISPLAY > CLOCK_24HR)
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);
}
#if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT)
if (sys.flag.am_pm_time)
{
#endif
#if (OPTION_TIME_DISPLAY > CLOCK_24HR)
// 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
#if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT)
}
else
{
#endif
#if (OPTION_TIME_DISPLAY != CLOCK_AM_PM)
// 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);
#endif
#if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT)
}
#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)
// {
// }
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);
}
// 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);
}
}
}

378
logic/clock.c

@ -80,7 +80,7 @@ void conv_24H_to_12H(u8 * hours24, u8 * hours12, u8 * timeAMorPM);
struct time sTime;
// Display values for time format selection
#ifndef CONFIG_METRIC_ONLY
#if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT)
const u8 selection_Timeformat[][4] =
{
"24H", "12H"
@ -169,7 +169,7 @@ void clock_tick(void)
// @param u8 hour Hour in 24H format
// @return u8 Hour in 12H format
// *************************************************************************************************
#ifndef CONFIG_METRIC_ONLY
#if (OPTION_TIME_DISPLAY > CLOCK_24HR)
u8 convert_hour_to_12H_format(u8 hour)
{
// 00:00 .. 11:59 --> AM 12:00 .. 11:59
@ -209,7 +209,7 @@ void display_selection_Timeformat1(u8 segments, u32 index, u8 digits, u8 blanks)
if (index < 2) display_chars(segments, (u8 *)selection_Timeformat[index], SEG_ON_BLINK_ON);
}
#endif // CONFIG_METRIC_ONLY
#endif //OPTION_TIME_DISPLAY
// *************************************************************************************************
@ -220,116 +220,118 @@ void display_selection_Timeformat1(u8 segments, u32 index, u8 digits, u8 blanks)
// *************************************************************************************************
void mx_time(u8 line)
{
u8 select;
s32 timeformat;
s16 timeformat1;
s32 hours;
s32 minutes;
s32 seconds;
u8 * str;
// Clear display
clear_display_all();
// Convert global time to local variables
// Global time keeps on ticking in background until it is overwritten
if (sys.flag.use_metric_units)
{
timeformat = TIMEFORMAT_24H;
}
else
{
timeformat = TIMEFORMAT_12H;
}
timeformat1 = timeformat;
hours = sTime.hour;
minutes = sTime.minute;
seconds = sTime.second;
// Init value index
select = 0;
// Loop values until all are set or user breaks set
while(1)
{
// Idle timeout: exit without saving
if (sys.flag.idle_timeout)
{
// Roll back time format
if (timeformat1 == TIMEFORMAT_24H) sys.flag.use_metric_units = 1;
else sys.flag.use_metric_units = 0;
display_symbol(LCD_SYMB_AM, SEG_OFF);
break;
}
// Button STAR (short): save, then exit
if (button.flag.star)
{
// Stop clock timer
Timer0_Stop();
// Store local variables in global clock time
sTime.hour = hours;
sTime.minute = minutes;
sTime.second = seconds;
// Start clock timer
Timer0_Start();
// Full display update is done when returning from function
display_symbol(LCD_SYMB_AM, SEG_OFF);
break;
}
switch (select)
{
#ifndef CONFIG_METRIC_ONLY
case 0: // Clear LINE1 and LINE2 and AM icon - required when coming back from set_value(seconds)
clear_display();
display_symbol(LCD_SYMB_AM, SEG_OFF);
// Set 24H / 12H time format
set_value(&timeformat, 1, 0, 0, 1, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_SELECTION + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_1, display_selection_Timeformat1);
// Modify global time format variable immediately to update AM/PM icon correctly
if (timeformat == TIMEFORMAT_24H) sys.flag.use_metric_units = 1;
else sys.flag.use_metric_units = 0;
select = 1;
break;
u8 select;
s32 timeformat;
s16 timeformat1;
s32 hours;
s32 minutes;
s32 seconds;
u8 * str;
// Clear display
clear_display_all();
// Convert global time to local variables
// Global time keeps on ticking in background until it is overwritten
if (sys.flag.am_pm_time)
{
timeformat = TIMEFORMAT_12H;
}
else
{
timeformat = TIMEFORMAT_24H;
}
timeformat1 = timeformat;
hours = sTime.hour;
minutes = sTime.minute;
seconds = sTime.second;
// Init value index
select = 0;
// Loop values until all are set or user breaks set
while(1)
{
// Idle timeout: exit without saving
if (sys.flag.idle_timeout)
{
// Roll back time format
if (timeformat1 == TIMEFORMAT_12H)
sys.flag.am_pm_time = 1;
else
sys.flag.am_pm_time = 0;
display_symbol(LCD_SYMB_AM, SEG_OFF);
break;
}
// Button STAR (short): save, then exit
if (button.flag.star)
{
// Stop clock timer
Timer0_Stop();
// Store local variables in global clock time
sTime.hour = hours;
sTime.minute = minutes;
sTime.second = seconds;
// Start clock timer
Timer0_Start();
// Full display update is done when returning from function
display_symbol(LCD_SYMB_AM, SEG_OFF);
break;
}
switch (select)
{
#if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT)
case 0: // Clear LINE1 and LINE2 and AM icon - required when coming back from set_value(seconds)
clear_display();
display_symbol(LCD_SYMB_AM, SEG_OFF);
// Set 24H / 12H time format
set_value(&timeformat, 1, 0, 0, 1, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_SELECTION + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_1, display_selection_Timeformat1);
// Modify global time format variable immediately to update AM/PM icon correctly
if (timeformat == TIMEFORMAT_12H) sys.flag.am_pm_time = 1;
else sys.flag.am_pm_time = 0;
select = 1;
break;
#else
case 0:
case 0:
#endif
case 1: // Display HH:MM (LINE1) and .SS (LINE2)
str = itoa(hours, 2, 0);
display_chars(LCD_SEG_L1_3_2, str, SEG_ON);
display_symbol(LCD_SEG_L1_COL, SEG_ON);
str = itoa(minutes, 2, 0);
display_chars(LCD_SEG_L1_1_0, str, SEG_ON);
str = itoa(seconds, 2, 0);
display_chars(LCD_SEG_L2_1_0, str, SEG_ON);
display_symbol(LCD_SEG_L2_DP, SEG_ON);
// Set hours
set_value(&hours, 2, 0, 0, 23, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_2, display_hours1);
select = 2;
break;
case 2: // Set minutes
set_value(&minutes, 2, 0, 0, 59, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_1_0, display_value1);
select = 3;
break;
case 3: // Set seconds
set_value(&seconds, 2, 0, 0, 59, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L2_1_0, display_value1);
select = 0;
break;
}
}
// Clear button flags
button.all_flags = 0;
case 1: // Display HH:MM (LINE1) and .SS (LINE2)
str = itoa(hours, 2, 0);
display_chars(LCD_SEG_L1_3_2, str, SEG_ON);
display_symbol(LCD_SEG_L1_COL, SEG_ON);
str = itoa(minutes, 2, 0);
display_chars(LCD_SEG_L1_1_0, str, SEG_ON);
str = itoa(seconds, 2, 0);
display_chars(LCD_SEG_L2_1_0, str, SEG_ON);
display_symbol(LCD_SEG_L2_DP, SEG_ON);
// Set hours
set_value(&hours, 2, 0, 0, 23, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_2, display_hours1);
select = 2;
break;
case 2: // Set minutes
set_value(&minutes, 2, 0, 0, 59, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_1_0, display_value1);
select = 3;
break;
case 3: // Set seconds
set_value(&seconds, 2, 0, 0, 59, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L2_1_0, display_value1);
select = 0;
break;
}
}
// Clear button flags
button.all_flags = 0;
}
@ -346,99 +348,99 @@ void sx_time(u8 line)
else sTime.line1ViewStyle = DISPLAY_DEFAULT_VIEW;
}
// *************************************************************************************************
// @fn display_hours_with_12_24
// @brief Clock display helper routine. Supports 24H and 12H time format.
// @param u8 line LINE1
//
// @return none
// *************************************************************************************************
static void display_hours_with_12_24(u8 line)
{
#if (OPTION_TIME_DISPLAY > CLOCK_24HR)
u8 hour12;
#endif
#if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT)
if (sys.flag.am_pm_time)
{
#endif
#if (OPTION_TIME_DISPLAY > CLOCK_24HR)
// Display 12H time "HH" + AM/PM
hour12 = convert_hour_to_12H_format(sTime.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(sTime.hour);
#endif
#if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT)
}
else
{
#endif
#if(OPTION_TIME_DISPLAY != CLOCK_AM_PM)
// Display 24H time "HH"
display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(sTime.hour, 2, 0), SEG_ON);
#endif
#if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT)
}
#endif
}
// *************************************************************************************************
// @fn display_time
// @brief Clock display routine. Supports 24H and 12H time format.
// @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)
{
#ifndef CONFIG_METRIC_ONLY
u8 hour12;
#endif
// Partial update
if (update == DISPLAY_LINE_UPDATE_PARTIAL)
if (update == DISPLAY_LINE_UPDATE_PARTIAL)
{
if(sTime.drawFlag != 0)
{
if (sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW)
{
switch(sTime.drawFlag)
{
case 3:
#ifdef CONFIG_METRIC_ONLY
display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(sTime.hour, 2, 0), SEG_ON);
#else
if (sys.flag.use_metric_units)
{
// Display 24H time "HH"
display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(sTime.hour, 2, 0), SEG_ON);
}
else
{
// Display 12H time "HH" + AM/PM
hour12 = convert_hour_to_12H_format(sTime.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(sTime.hour);
}
#endif
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);
}
}
if(sTime.drawFlag != 0)
{
if (sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW)
{
switch(sTime.drawFlag)
{
case 3:
display_hours_with_12_24(line);
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 (sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW)
{
// Display 24H/12H time
#ifdef CONFIG_METRIC_ONLY
display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(sTime.hour, 2, 0), SEG_ON);
#else
if (sys.flag.use_metric_units)
{
// Display 24H time "HH"
display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(sTime.hour, 2, 0), SEG_ON);
}
else
{
// Display 12H time "HH" + AM/PM information
hour12 = convert_hour_to_12H_format(sTime.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 information
if (line == LINE1)
{
display_am_pm_symbol(sTime.hour);
}
}
#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);
}
// Full update
if (sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW)
{
// Display hours
display_hours_with_12_24(line);
// 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);
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);
}
}

1
logic/clock.h

@ -43,7 +43,6 @@
#define TIMEFORMAT_24H (0u)
#define TIMEFORMAT_12H (1u)
// *************************************************************************************************
// Prototypes section
extern void reset_clock(void);

Loading…
Cancel
Save