37#ifndef DRIVER_DS1307_H
38#define DRIVER_DS1307_H
138 uint8_t (*
iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
139 uint8_t (*
iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
178#define DRIVER_DS1307_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
186#define DRIVER_DS1307_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
194#define DRIVER_DS1307_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
202#define DRIVER_DS1307_LINK_IIC_READ(HANDLE, FUC) (HANDLE)->iic_read = FUC
210#define DRIVER_DS1307_LINK_IIC_WRITE(HANDLE, FUC) (HANDLE)->iic_write = FUC
218#define DRIVER_DS1307_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
226#define DRIVER_DS1307_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
uint8_t ds1307_info(ds1307_info_t *info)
get chip's information
ds1307_am_pm_t
ds1307 am pm enumeration definition
struct ds1307_info_s ds1307_info_t
ds1307 information structure definition
uint8_t ds1307_get_output_level(ds1307_handle_t *handle, ds1307_output_level_t *level)
get the output level
struct ds1307_handle_s ds1307_handle_t
ds1307 handle structure definition
ds1307_square_wave_frequency_t
ds1307 square wave frequency enumeration definition
uint8_t ds1307_get_square_wave_frequency(ds1307_handle_t *handle, ds1307_square_wave_frequency_t *freq)
get the square wave frequency
ds1307_format_t
ds1307 format enumeration definition
uint8_t ds1307_read_ram(ds1307_handle_t *handle, uint8_t addr, uint8_t *buf, uint8_t len)
read ram
uint8_t ds1307_get_oscillator(ds1307_handle_t *handle, ds1307_bool_t *enable)
get the chip oscillator status
uint8_t ds1307_set_output_mode(ds1307_handle_t *handle, ds1307_output_mode_t mode)
set the output mode
struct ds1307_time_s ds1307_time_t
ds1307 time structure definition
uint8_t ds1307_get_output_mode(ds1307_handle_t *handle, ds1307_output_mode_t *mode)
get the output mode
uint8_t ds1307_set_oscillator(ds1307_handle_t *handle, ds1307_bool_t enable)
enable or disable the oscillator
uint8_t ds1307_init(ds1307_handle_t *handle)
initialize the chip
uint8_t ds1307_set_time(ds1307_handle_t *handle, ds1307_time_t *t)
set the current time
ds1307_output_level_t
ds1307 output level enumeration definition
uint8_t ds1307_write_ram(ds1307_handle_t *handle, uint8_t addr, uint8_t *buf, uint8_t len)
write ram
uint8_t ds1307_set_output_level(ds1307_handle_t *handle, ds1307_output_level_t level)
set the output level
uint8_t ds1307_set_square_wave_frequency(ds1307_handle_t *handle, ds1307_square_wave_frequency_t freq)
set the square wave frequency
ds1307_bool_t
ds1307 bool enumeration definition
uint8_t ds1307_deinit(ds1307_handle_t *handle)
close the chip
uint8_t ds1307_get_time(ds1307_handle_t *handle, ds1307_time_t *t)
get the current time
ds1307_output_mode_t
ds1307 output mode enumeration definition
@ DS1307_SQUARE_WAVE_FREQUENCY_4096_HZ
@ DS1307_SQUARE_WAVE_FREQUENCY_8192_HZ
@ DS1307_SQUARE_WAVE_FREQUENCY_32768_HZ
@ DS1307_SQUARE_WAVE_FREQUENCY_1_HZ
@ DS1307_OUTPUT_LEVEL_HIGH
@ DS1307_OUTPUT_LEVEL_LOW
@ DS1307_OUTPUT_MODE_SQUARE_WAVE
@ DS1307_OUTPUT_MODE_LEVEL
uint8_t ds1307_get_reg(ds1307_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get the chip register
uint8_t ds1307_set_reg(ds1307_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
set the chip register
ds1307 handle structure definition
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
ds1307 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v
ds1307 time structure definition