|
int | libx52_set_clock (libx52_device *x52, time_t time, int local) |
| Set the clock. More...
|
|
int | libx52_set_clock_timezone (libx52_device *x52, libx52_clock_id clock, int offset) |
| Set the timezone for the secondary and tertiary clocks. More...
|
|
int | libx52_set_clock_format (libx52_device *x52, libx52_clock_id clock, libx52_clock_format format) |
| Set whether the clock is displayed in 12 hour or 24 hour format. More...
|
|
int | libx52_set_time (libx52_device *x52, uint8_t hour, uint8_t minute) |
| Set the hour and minute on clock 1. More...
|
|
int | libx52_set_date (libx52_device *x52, uint8_t dd, uint8_t mm, uint8_t yy) |
| Set the date. More...
|
|
int | libx52_set_date_format (libx52_device *x52, libx52_date_format format) |
| Set the date format for the MFD date display. More...
|
|
Control the clocks on the MFD
◆ libx52_clock_format
Supported clock formats.
Enumerator |
---|
LIBX52_CLOCK_FORMAT_12HR | 12-hour display on the MFD clock
|
LIBX52_CLOCK_FORMAT_24HR | 24-hour display on the MFD clock
|
◆ libx52_clock_id
List of supported clocks on the MFD.
Enumerator |
---|
LIBX52_CLOCK_1 | Primary clock on the MFD, indicated by the number 1
|
LIBX52_CLOCK_2 | Secondary clock on the MFD, indicated by the number 2
|
LIBX52_CLOCK_3 | Tertiary clock on the MFD, indicated by the number 3
|
◆ libx52_date_format
Supported date formats.
Enumerator |
---|
LIBX52_DATE_FORMAT_DDMMYY | Date format DD-MM-YY
|
LIBX52_DATE_FORMAT_MMDDYY | Date format MM-DD-YY
|
LIBX52_DATE_FORMAT_YYMMDD | Date format YY-MM-DD
|
◆ libx52_set_clock()
int libx52_set_clock |
( |
libx52_device * |
x52, |
|
|
time_t |
time, |
|
|
int |
local |
|
) |
| |
Set the clock.
This function sets the primary clock's date and time with the specified Unix time value. time
can be obtained from time(2)
. local
controls whether the primary clock displays local time or GMT.
If this function is called again within the same minute as calculated by localtime(3)
or gmtime(3)
, it will return LIBX52_ERROR_TRY_AGAIN, as it does not require any updates to be written to the joystick. However, if the call changes the timezone from local time to GMT or vice-versa, then the function will return 0, since it requires a write to the device to update the clock with the new timezone.
The secondary and tertiary clocks are driven off the primary clock and set using libx52_set_clock_timezone.
- Parameters
-
[in] | x52 | Pointer to the device context |
[in] | time | Time value from time(3) |
[in] | local | 0 for GM time, non-zero for localtime |
- Returns
-
◆ libx52_set_clock_format()
Set whether the clock is displayed in 12 hour or 24 hour format.
The clocks on the X52 Pro MFD are all displayed as HH:MM, but can be set to display it in 12-hour (AM/PM) or 24-hour format. The default format if not specified is 12-hour.
- Limitations
- The hardware has a limitation that it cannot display 12:00 am in 12 hour mode - instead it will display as 00:00 am
- Parameters
-
- Returns
-
◆ libx52_set_clock_timezone()
Set the timezone for the secondary and tertiary clocks.
The X52 Pro has a total of 3 clock displays. The secondary and tertiary clocks are controlled as an offset from the primary clock in minutes. However, for convenience, the X52 library calculates this offset internally and only requires you to set the timezone as the number of minutes east of UTC. offset
is limited to ± 1440 minutes, and any offset outside this range will result in a return value of LIBX52_ERROR_OUT_OF_RANGE
- Example
int libx52_set_clock_timezone(libx52_device *x52, libx52_clock_id clock, int offset)
Set the timezone for the secondary and tertiary clocks.
@ LIBX52_CLOCK_2
Definition: libx52.h:57
- Parameters
-
[in] | x52 | Pointer to the device context |
[in] | clock | libx52_clock_id, cannot be LIBX52_CLOCK_1 |
[in] | offset | Offset in minutes from GMT (east is positive, west is negative) |
- Returns
-
◆ libx52_set_date()
int libx52_set_date |
( |
libx52_device * |
x52, |
|
|
uint8_t |
dd, |
|
|
uint8_t |
mm, |
|
|
uint8_t |
yy |
|
) |
| |
Set the date.
This is a raw API which can be used for manual control if the user so desires, however, it will not update the timezone or the time values.
- Parameters
-
[in] | x52 | Pointer to the device context |
[in] | dd | Day to display |
[in] | mm | Month to display |
[in] | yy | Year to display |
- Returns
-
◆ libx52_set_date_format()
Set the date format for the MFD date display.
If not set, the date format defaults to DD-MM-YY
- Parameters
-
- Returns
-
◆ libx52_set_time()
int libx52_set_time |
( |
libx52_device * |
x52, |
|
|
uint8_t |
hour, |
|
|
uint8_t |
minute |
|
) |
| |
Set the hour and minute on clock 1.
This is a raw API which can be used for manual control if the user so desires, however, it will not update the timezone or the date values.
- Parameters
-
[in] | x52 | Pointer to the device context |
[in] | hour | Hour to display |
[in] | minute | Minute to display |
- Returns
-