Browse Source

Merge branch 'add_am_pm'

fertito
Dean Sellers 13 years ago
parent
commit
ae7430d448
  1. 48
      driver/display.c
  2. 18
      driver/display.h
  3. 1
      include/project.h
  4. 122
      logic/alarm.c
  5. 2
      logic/bluerobin.c
  6. 345
      logic/clock.c
  7. 3
      logic/clock.h
  8. 4
      logic/user.c
  9. 2
      logic/user.h

48
driver/display.c

@ -298,21 +298,21 @@ u8 * itoa(u32 n, u8 digits, u8 blanks)
// u8 blanks Number of leadings blanks in itoa result string
// @return none
// *************************************************************************************************
void display_value1(u8 segments, u32 value, u8 digits, u8 blanks)
void display_value1(u8 segments, u32 value, u8 digits, u8 blanks, u8 disp_mode)
{
u8 * str;
str = itoa(value, digits, blanks);
// Display string in blink mode
display_chars(segments, str, SEG_ON_BLINK_ON);
display_chars(segments, str, disp_mode);
}
// *************************************************************************************************
// @fn display_hours
// @fn display_hours_12_or_24
// @brief Display hours in 24H / 12H time format.
// @param u8 segments Segments where to display hour data
// u32 value Hour data
@ -320,26 +320,34 @@ void display_value1(u8 segments, u32 value, u8 digits, u8 blanks)
// u8 blanks Must be "0"
// @return none
// *************************************************************************************************
void display_hours1(u8 segments, u32 value, u8 digits, u8 blanks)
void display_hours_12_or_24(u8 segments, u32 value, u8 digits, u8 blanks, u8 disp_mode)
{
#ifdef CONFIG_METRIC_ONLY
display_value1(segments, (u16) value, digits, blanks);
#else
u8 hours;
#if (OPTION_TIME_DISPLAY > CLOCK_24HR)
u8 hours;
#endif
if (sys.flag.use_metric_units)
{
// Display hours in 24H time format
display_value1(segments, (u16) value, digits, blanks);
}
#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);
// display hours in 12H time format
display_value1(segments, hours, digits, blanks, disp_mode);
display_am_pm_symbol(value);
#endif
#if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT)
}
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_AM_PM)
// Display hours in 24H time format
display_value1(segments, (u16) value, digits, blanks, disp_mode);
#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

18
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
// *************************************************************************************************
@ -337,8 +351,8 @@ extern void DisplayTime(u8 updateMode);
extern void display_am_pm_symbol(u8 timeAM);
// Set_value display functions
extern void display_value1(u8 segments, u32 value, u8 digits, u8 blanks);
extern void display_hours1(u8 segments, u32 value, u8 digits, u8 blanks);
extern void display_value1(u8 segments, u32 value, u8 digits, u8 blanks, u8 disp_mode);
extern void display_hours_12_or_24(u8 segments, u32 value, u8 digits, u8 blanks, u8 disp_mode);
// Integer to string conversion
extern u8 * itoa(u32 n, u8 digits, u8 blanks);

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;

122
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_hours_12_or_24);
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,29 @@ void mx_alarm(u8 line)
// *************************************************************************************************
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)
// {
// }
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);
}
// 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);
}
}
}

2
logic/bluerobin.c

@ -257,7 +257,7 @@ void sx_bluerobin(u8 line)
//
// @return none
// *************************************************************************************************
void display_selection_User_Sex1(u8 segments, u32 index, u8 digits, u8 blanks)
void display_selection_User_Sex1(u8 segments, u32 index, u8 digits, u8 blanks, u8 dummy)
{
if (index < 2) display_chars(segments, (u8 *)selection_User_Sex[index], SEG_ON_BLINK_ON);
}

345
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
@ -204,12 +204,12 @@ u8 is_hour_am(u8 hour)
// u8 blanks Not used
// @return none
// *************************************************************************************************
void display_selection_Timeformat1(u8 segments, u32 index, u8 digits, u8 blanks)
void display_selection_Timeformat1(u8 segments, u32 index, u8 digits, u8 blanks, u8 dummy)
{
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_hours_12_or_24);
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,62 @@ void sx_time(u8 line)
else sTime.line1ViewStyle = DISPLAY_DEFAULT_VIEW;
}
// *************************************************************************************************
// @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_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 (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_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);
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);
}
}

3
logic/clock.h

@ -43,14 +43,13 @@
#define TIMEFORMAT_24H (0u)
#define TIMEFORMAT_12H (1u)
// *************************************************************************************************
// Prototypes section
extern void reset_clock(void);
extern void sx_time(u8 line);
extern void mx_time(u8 line);
extern void clock_tick(void);
extern void display_selection_Timeformat1(u8 segments, u32 index, u8 digits, u8 blanks);
extern void display_selection_Timeformat1(u8 segments, u32 index, u8 digits, u8 blanks, u8 dummy);
extern void display_time(u8 line, u8 update);
// English units support

4
logic/user.c

@ -96,7 +96,7 @@ void dummy(u8 line)
// fptr_setValue_display_function1 Value-specific display routine
// @return none
// *************************************************************************************************
void set_value(s32 * value, u8 digits, u8 blanks, s32 limitLow, s32 limitHigh, u16 mode, u8 segments, void (*fptr_setValue_display_function1)(u8 segments, u32 value, u8 digits, u8 blanks))
void set_value(s32 * value, u8 digits, u8 blanks, s32 limitLow, s32 limitHigh, u16 mode, u8 segments, void (*fptr_setValue_display_function1)(u8 segments, u32 value, u8 digits, u8 blanks, u8 disp_mode))
{
u8 update;
s16 stepValue = 1;
@ -241,7 +241,7 @@ void set_value(s32 * value, u8 digits, u8 blanks, s32 limitLow, s32 limitHigh, u
// Display function can either display value directly, modify value before displaying
// or display a string referenced by the value
fptr_setValue_display_function1(segments, val, digits, blanks);
fptr_setValue_display_function1(segments, val, digits, blanks, SEG_ON_BLINK_ON);
// Clear update flag
update = 0;

2
logic/user.h

@ -51,7 +51,7 @@
// Prototypes section
extern u8 * select_view_style(u8 line, u8 * view1, u8 * view2);
extern void (*fptr_setValue_display_function1)(u8 segments, u32 value, u8 digits, u8 blanks);
extern void set_value(s32 * value, u8 digits, u8 blanks, s32 limitLow, s32 limitHigh, u16 mode, u8 segments, void (*fptr_setValue_display_function1)(u8 segments, u32 value, u8 digits, u8 blanks));
extern void set_value(s32 * value, u8 digits, u8 blanks, s32 limitLow, s32 limitHigh, u16 mode, u8 segments, void (*fptr_setValue_display_function1)(u8 segments, u32 value, u8 digits, u8 blanks, u8 disp_mode));
extern void dummy(u8 line);
#endif /*USER_H_*/

Loading…
Cancel
Save