You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
3.5 KiB
128 lines
3.5 KiB
6 months ago
|
/**
|
||
|
* 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.
|
||
|
*
|
||
|
* @file driver_ds3231_interface.h
|
||
|
* @brief driver ds3231 interface header file
|
||
|
* @version 2.0.0
|
||
|
* @author Shifeng Li
|
||
|
* @date 2021-03-15
|
||
|
*
|
||
|
* <h3>history</h3>
|
||
|
* <table>
|
||
|
* <tr><th>Date <th>Version <th>Author <th>Description
|
||
|
* <tr><td>2021/03/15 <td>2.0 <td>Shifeng Li <td>format the code
|
||
|
* <tr><td>2020/11/30 <td>1.0 <td>Shifeng Li <td>first upload
|
||
|
* </table>
|
||
|
*/
|
||
|
|
||
|
#ifndef DRIVER_DS3231_INTERFACE_H
|
||
|
#define DRIVER_DS3231_INTERFACE_H
|
||
|
|
||
|
#include "driver_ds3231.h"
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C"{
|
||
|
#endif
|
||
|
|
||
|
/**
|
||
|
* @defgroup ds3231_interface_driver ds3231 interface driver function
|
||
|
* @brief ds3231 interface driver modules
|
||
|
* @ingroup ds3231_driver
|
||
|
* @{
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* @brief interface iic bus init
|
||
|
* @return status code
|
||
|
* - 0 success
|
||
|
* - 1 iic init failed
|
||
|
* @note none
|
||
|
*/
|
||
|
uint8_t ds3231_interface_iic_init(void);
|
||
|
|
||
|
/**
|
||
|
* @brief interface iic bus deinit
|
||
|
* @return status code
|
||
|
* - 0 success
|
||
|
* - 1 iic deinit failed
|
||
|
* @note none
|
||
|
*/
|
||
|
uint8_t ds3231_interface_iic_deinit(void);
|
||
|
|
||
|
/**
|
||
|
* @brief interface iic bus read
|
||
|
* @param[in] addr is the iic device write address
|
||
|
* @param[in] reg is the iic register address
|
||
|
* @param[out] *buf points to a data buffer
|
||
|
* @param[in] len is the length of the data buffer
|
||
|
* @return status code
|
||
|
* - 0 success
|
||
|
* - 1 read failed
|
||
|
* @note none
|
||
|
*/
|
||
|
uint8_t ds3231_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
|
||
|
|
||
|
/**
|
||
|
* @brief interface iic bus write
|
||
|
* @param[in] addr is the iic device write address
|
||
|
* @param[in] reg is the iic register address
|
||
|
* @param[in] *buf points to a data buffer
|
||
|
* @param[in] len is the length of the data buffer
|
||
|
* @return status code
|
||
|
* - 0 success
|
||
|
* - 1 write failed
|
||
|
* @note none
|
||
|
*/
|
||
|
uint8_t ds3231_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
|
||
|
|
||
|
/**
|
||
|
* @brief interface delay ms
|
||
|
* @param[in] ms
|
||
|
* @note none
|
||
|
*/
|
||
|
void ds3231_interface_delay_ms(uint32_t ms);
|
||
|
|
||
|
/**
|
||
|
* @brief interface print format data
|
||
|
* @param[in] fmt is the format data
|
||
|
* @note none
|
||
|
*/
|
||
|
void ds3231_interface_debug_print(const char *const fmt, ...);
|
||
|
|
||
|
/**
|
||
|
* @brief interface receive callback
|
||
|
* @param[in] type is the interrupt type
|
||
|
* @note none
|
||
|
*/
|
||
|
void ds3231_interface_receive_callback(uint8_t type);
|
||
|
|
||
|
/**
|
||
|
* @}
|
||
|
*/
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
#endif
|