LibDriver DS1307
Loading...
Searching...
No Matches
driver_ds1307.h File Reference

driver ds1307 header file More...

#include <stdio.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for driver_ds1307.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ds1307_time_s
 ds1307 time structure definition More...
struct  ds1307_handle_s
 ds1307 handle structure definition More...
struct  ds1307_info_s
 ds1307 information structure definition More...

Macros

#define DRIVER_DS1307_LINK_INIT(HANDLE, STRUCTURE)
 initialize ds1307_handle_t structure
#define DRIVER_DS1307_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_DS1307_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_DS1307_LINK_IIC_READ(HANDLE, FUC)
 link iic_read function
#define DRIVER_DS1307_LINK_IIC_WRITE(HANDLE, FUC)
 link iic_write function
#define DRIVER_DS1307_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_DS1307_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct ds1307_time_s ds1307_time_t
 ds1307 time structure definition
typedef struct ds1307_handle_s ds1307_handle_t
 ds1307 handle structure definition
typedef struct ds1307_info_s ds1307_info_t
 ds1307 information structure definition

Enumerations

enum  ds1307_bool_t { DS1307_BOOL_FALSE = 0x00 , DS1307_BOOL_TRUE = 0x01 }
 ds1307 bool enumeration definition More...
enum  ds1307_am_pm_t { DS1307_AM = 0x00 , DS1307_PM = 0x01 }
 ds1307 am pm enumeration definition More...
enum  ds1307_format_t { DS1307_FORMAT_12H = 0x01 , DS1307_FORMAT_24H = 0x00 }
 ds1307 format enumeration definition More...
enum  ds1307_output_level_t { DS1307_OUTPUT_LEVEL_LOW = 0x00 , DS1307_OUTPUT_LEVEL_HIGH = 0x01 }
 ds1307 output level enumeration definition More...
enum  ds1307_output_mode_t { DS1307_OUTPUT_MODE_LEVEL = 0x00 , DS1307_OUTPUT_MODE_SQUARE_WAVE = 0x01 }
 ds1307 output mode enumeration definition More...
enum  ds1307_square_wave_frequency_t { DS1307_SQUARE_WAVE_FREQUENCY_1_HZ = 0x00 , DS1307_SQUARE_WAVE_FREQUENCY_4096_HZ = 0x01 , DS1307_SQUARE_WAVE_FREQUENCY_8192_HZ = 0x02 , DS1307_SQUARE_WAVE_FREQUENCY_32768_HZ = 0x03 }
 ds1307 square wave frequency enumeration definition More...

Functions

uint8_t ds1307_info (ds1307_info_t *info)
 get chip's information
uint8_t ds1307_init (ds1307_handle_t *handle)
 initialize the chip
uint8_t ds1307_deinit (ds1307_handle_t *handle)
 close the chip
uint8_t ds1307_set_time (ds1307_handle_t *handle, ds1307_time_t *t)
 set the current time
uint8_t ds1307_get_time (ds1307_handle_t *handle, ds1307_time_t *t)
 get the current time
uint8_t ds1307_read_ram (ds1307_handle_t *handle, uint8_t addr, uint8_t *buf, uint8_t len)
 read ram
uint8_t ds1307_write_ram (ds1307_handle_t *handle, uint8_t addr, uint8_t *buf, uint8_t len)
 write ram
uint8_t ds1307_set_oscillator (ds1307_handle_t *handle, ds1307_bool_t enable)
 enable or disable the oscillator
uint8_t ds1307_get_oscillator (ds1307_handle_t *handle, ds1307_bool_t *enable)
 get the chip oscillator status
uint8_t ds1307_set_output_level (ds1307_handle_t *handle, ds1307_output_level_t level)
 set the output level
uint8_t ds1307_get_output_level (ds1307_handle_t *handle, ds1307_output_level_t *level)
 get the output level
uint8_t ds1307_set_output_mode (ds1307_handle_t *handle, ds1307_output_mode_t mode)
 set the output mode
uint8_t ds1307_get_output_mode (ds1307_handle_t *handle, ds1307_output_mode_t *mode)
 get the output mode
uint8_t ds1307_set_square_wave_frequency (ds1307_handle_t *handle, ds1307_square_wave_frequency_t freq)
 set the square wave frequency
uint8_t ds1307_get_square_wave_frequency (ds1307_handle_t *handle, ds1307_square_wave_frequency_t *freq)
 get the square wave frequency
uint8_t ds1307_set_reg (ds1307_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t ds1307_get_reg (ds1307_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver ds1307 header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2023-05-31

history

Date Version Author Description
2023/05/31 1.0 Shifeng Li first upload

Definition in file driver_ds1307.h.