![]() |
LibDriver DS1302
|
ds1302 basic driver modules More...
Data Structures | |
| struct | ds1302_time_s |
| ds1302 time structure definition More... | |
| struct | ds1302_handle_s |
| ds1302 handle structure definition More... | |
| struct | ds1302_info_s |
| ds1302 information structure definition More... | |
Typedefs | |
| typedef struct ds1302_time_s | ds1302_time_t |
| ds1302 time structure definition | |
| typedef struct ds1302_handle_s | ds1302_handle_t |
| ds1302 handle structure definition | |
| typedef struct ds1302_info_s | ds1302_info_t |
| ds1302 information structure definition | |
Enumerations | |
| enum | ds1302_bool_t { DS1302_BOOL_FALSE = 0x00 , DS1302_BOOL_TRUE = 0x01 } |
| ds1302 bool enumeration definition More... | |
| enum | ds1302_am_pm_t { DS1302_AM = 0x00 , DS1302_PM = 0x01 } |
| ds1302 am pm enumeration definition More... | |
| enum | ds1302_format_t { DS1302_FORMAT_12H = 0x01 , DS1302_FORMAT_24H = 0x00 } |
| ds1302 format enumeration definition More... | |
| enum | ds1302_charge_t { DS1302_CHARGE_ENABLE = (0xA << 4) , DS1302_CHARGE_DISABLE = (0x0 << 0) , DS1302_CHARGE_1_DIODE = (1 << 2) , DS1302_CHARGE_2_DIODE = (2 << 2) , DS1302_CHARGE_2K = (1 << 0) , DS1302_CHARGE_4K = (2 << 0) , DS1302_CHARGE_8K = (3 << 0) } |
| ds1302 charge enumeration definition More... | |
Functions | |
| uint8_t | ds1302_info (ds1302_info_t *info) |
| get chip's information | |
| uint8_t | ds1302_init (ds1302_handle_t *handle) |
| initialize the chip | |
| uint8_t | ds1302_deinit (ds1302_handle_t *handle) |
| close the chip | |
| uint8_t | ds1302_set_time (ds1302_handle_t *handle, ds1302_time_t *t) |
| set the current time | |
| uint8_t | ds1302_get_time (ds1302_handle_t *handle, ds1302_time_t *t) |
| get the current time | |
| uint8_t | ds1302_set_oscillator (ds1302_handle_t *handle, ds1302_bool_t enable) |
| enable or disable the oscillator | |
| uint8_t | ds1302_get_oscillator (ds1302_handle_t *handle, ds1302_bool_t *enable) |
| get the chip oscillator status | |
| uint8_t | ds1302_set_write_protect (ds1302_handle_t *handle, ds1302_bool_t enable) |
| enable or disable write protect | |
| uint8_t | ds1302_get_write_protect (ds1302_handle_t *handle, ds1302_bool_t *enable) |
| get write protect status | |
| uint8_t | ds1302_set_charge (ds1302_handle_t *handle, uint8_t charge) |
| set charge | |
| uint8_t | ds1302_get_charge (ds1302_handle_t *handle, uint8_t *charge) |
| get charge | |
| uint8_t | ds1302_read_ram (ds1302_handle_t *handle, uint8_t addr, uint8_t *buf, uint8_t len) |
| read ram | |
| uint8_t | ds1302_write_ram (ds1302_handle_t *handle, uint8_t addr, uint8_t *buf, uint8_t len) |
| write ram | |
ds1302 basic driver modules
| typedef struct ds1302_handle_s ds1302_handle_t |
ds1302 handle structure definition
| typedef struct ds1302_info_s ds1302_info_t |
ds1302 information structure definition
| typedef struct ds1302_time_s ds1302_time_t |
ds1302 time structure definition
| enum ds1302_am_pm_t |
ds1302 am pm enumeration definition
| Enumerator | |
|---|---|
| DS1302_AM | am |
| DS1302_PM | pm |
Definition at line 71 of file driver_ds1302.h.
| enum ds1302_bool_t |
ds1302 bool enumeration definition
| Enumerator | |
|---|---|
| DS1302_BOOL_FALSE | disable function |
| DS1302_BOOL_TRUE | enable function |
Definition at line 62 of file driver_ds1302.h.
| enum ds1302_charge_t |
ds1302 charge enumeration definition
Definition at line 89 of file driver_ds1302.h.
| enum ds1302_format_t |
ds1302 format enumeration definition
| Enumerator | |
|---|---|
| DS1302_FORMAT_12H | 12h format |
| DS1302_FORMAT_24H | 24h format |
Definition at line 80 of file driver_ds1302.h.
| uint8_t ds1302_deinit | ( | ds1302_handle_t * | handle | ) |
close the chip
| [in] | *handle | pointer to a ds1302 handle structure |
Definition at line 1297 of file driver_ds1302.c.
| uint8_t ds1302_get_charge | ( | ds1302_handle_t * | handle, |
| uint8_t * | charge ) |
get charge
| [in] | *handle | pointer to a ds1302 handle structure |
| [out] | *charge | pointer to a charge buffer |
Definition at line 1046 of file driver_ds1302.c.
| uint8_t ds1302_get_oscillator | ( | ds1302_handle_t * | handle, |
| ds1302_bool_t * | enable ) |
get the chip oscillator status
| [in] | *handle | pointer to a ds1302 handle structure |
| [out] | *enable | pointer to a bool value buffer |
Definition at line 889 of file driver_ds1302.c.
| uint8_t ds1302_get_time | ( | ds1302_handle_t * | handle, |
| ds1302_time_t * | t ) |
get the current time
| [in] | *handle | pointer to a ds1302 handle structure |
| [out] | *t | pointer to a time structure |
Definition at line 782 of file driver_ds1302.c.
| uint8_t ds1302_get_write_protect | ( | ds1302_handle_t * | handle, |
| ds1302_bool_t * | enable ) |
get write protect status
| [in] | *handle | pointer to a ds1302 handle structure |
| [out] | *enable | pointer to a bool value buffer |
Definition at line 973 of file driver_ds1302.c.
| uint8_t ds1302_info | ( | ds1302_info_t * | info | ) |
get chip's information
| [out] | *info | pointer to a ds1302 info structure |
Definition at line 1555 of file driver_ds1302.c.
| uint8_t ds1302_init | ( | ds1302_handle_t * | handle | ) |
initialize the chip
| [in] | *handle | pointer to a ds1302 handle structure |
Definition at line 1184 of file driver_ds1302.c.
| uint8_t ds1302_read_ram | ( | ds1302_handle_t * | handle, |
| uint8_t | addr, | ||
| uint8_t * | buf, | ||
| uint8_t | len ) |
read ram
| [in] | *handle | pointer to a ds1302 handle structure |
| [in] | addr | ram address |
| [out] | *buf | pointer to a data buffer |
| [in] | len | buffer length |
Definition at line 1085 of file driver_ds1302.c.
| uint8_t ds1302_set_charge | ( | ds1302_handle_t * | handle, |
| uint8_t | charge ) |
set charge
| [in] | *handle | pointer to a ds1302 handle structure |
| [in] | charge | charge mode |
Definition at line 1011 of file driver_ds1302.c.
| uint8_t ds1302_set_oscillator | ( | ds1302_handle_t * | handle, |
| ds1302_bool_t | enable ) |
enable or disable the oscillator
| [in] | *handle | pointer to a ds1302 handle structure |
| [in] | enable | bool value |
Definition at line 842 of file driver_ds1302.c.
| uint8_t ds1302_set_time | ( | ds1302_handle_t * | handle, |
| ds1302_time_t * | t ) |
set the current time
| [in] | *handle | pointer to a ds1302 handle structure |
| [in] | *t | pointer to a time structure |
Definition at line 584 of file driver_ds1302.c.
| uint8_t ds1302_set_write_protect | ( | ds1302_handle_t * | handle, |
| ds1302_bool_t | enable ) |
enable or disable write protect
| [in] | *handle | pointer to a ds1302 handle structure |
| [in] | enable | bool value |
Definition at line 927 of file driver_ds1302.c.
| uint8_t ds1302_write_ram | ( | ds1302_handle_t * | handle, |
| uint8_t | addr, | ||
| uint8_t * | buf, | ||
| uint8_t | len ) |
write ram
| [in] | *handle | pointer to a ds1302 handle structure |
| [in] | addr | ram address |
| [in] | *buf | pointer to a data buffer |
| [in] | len | buffer length |
Definition at line 1137 of file driver_ds1302.c.