![]() |
LibDriver DS3231
|
driver ds3231 header file More...
#include <stdio.h>#include <stdint.h>#include <string.h>Go to the source code of this file.
Data Structures | |
| struct | ds3231_time_s |
| ds3231 time structure definition More... | |
| struct | ds3231_handle_s |
| ds3231 handle structure definition More... | |
| struct | ds3231_info_s |
| ds3231 information structure definition More... | |
Macros | |
| #define | DRIVER_DS3231_LINK_INIT(HANDLE, STRUCTURE) |
| initialize ds3231_handle_t structure | |
| #define | DRIVER_DS3231_LINK_IIC_INIT(HANDLE, FUC) |
| link iic_init function | |
| #define | DRIVER_DS3231_LINK_IIC_DEINIT(HANDLE, FUC) |
| link iic_deinit function | |
| #define | DRIVER_DS3231_LINK_IIC_READ(HANDLE, FUC) |
| link iic_read function | |
| #define | DRIVER_DS3231_LINK_IIC_WRITE(HANDLE, FUC) |
| link iic_write function | |
| #define | DRIVER_DS3231_LINK_DELAY_MS(HANDLE, FUC) |
| link delay_ms function | |
| #define | DRIVER_DS3231_LINK_DEBUG_PRINT(HANDLE, FUC) |
| link debug_print function | |
| #define | DRIVER_DS3231_LINK_RECEIVE_CALLBACK(HANDLE, FUC) |
| link receive_callback function | |
Typedefs | |
| typedef struct ds3231_time_s | ds3231_time_t |
| ds3231 time structure definition | |
| typedef struct ds3231_handle_s | ds3231_handle_t |
| ds3231 handle structure definition | |
| typedef struct ds3231_info_s | ds3231_info_t |
| ds3231 information structure definition | |
Functions | |
| uint8_t | ds3231_info (ds3231_info_t *info) |
| get chip's information | |
| uint8_t | ds3231_init (ds3231_handle_t *handle) |
| initialize the chip | |
| uint8_t | ds3231_deinit (ds3231_handle_t *handle) |
| close the chip | |
| uint8_t | ds3231_irq_handler (ds3231_handle_t *handle) |
| irq handler | |
| uint8_t | ds3231_set_time (ds3231_handle_t *handle, ds3231_time_t *t) |
| set the current time | |
| uint8_t | ds3231_get_time (ds3231_handle_t *handle, ds3231_time_t *t) |
| get the current time | |
| uint8_t | ds3231_set_oscillator (ds3231_handle_t *handle, ds3231_bool_t enable) |
| enable or disable the oscillator | |
| uint8_t | ds3231_get_oscillator (ds3231_handle_t *handle, ds3231_bool_t *enable) |
| get the chip oscillator status | |
| uint8_t | ds3231_get_status (ds3231_handle_t *handle, uint8_t *status) |
| get the chip status | |
| uint8_t | ds3231_set_pin (ds3231_handle_t *handle, ds3231_pin_t pin) |
| set the chip pin function | |
| uint8_t | ds3231_get_pin (ds3231_handle_t *handle, ds3231_pin_t *pin) |
| get the chip pin function | |
| uint8_t | ds3231_set_square_wave (ds3231_handle_t *handle, ds3231_bool_t enable) |
| enable or disable the square wave output | |
| uint8_t | ds3231_get_square_wave (ds3231_handle_t *handle, ds3231_bool_t *enable) |
| get the square wave output status | |
| uint8_t | ds3231_set_32khz_output (ds3231_handle_t *handle, ds3231_bool_t enable) |
| enable or disable the 32KHz output | |
| uint8_t | ds3231_get_32khz_output (ds3231_handle_t *handle, ds3231_bool_t *enable) |
| get the 32KHz output status | |
| uint8_t | ds3231_get_temperature (ds3231_handle_t *handle, int16_t *raw, float *s) |
| get the chip temperature | |
| uint8_t | ds3231_set_aging_offset (ds3231_handle_t *handle, int8_t offset) |
| set the chip aging offset | |
| uint8_t | ds3231_get_aging_offset (ds3231_handle_t *handle, int8_t *offset) |
| get the chip aging offset | |
| uint8_t | ds3231_aging_offset_convert_to_register (ds3231_handle_t *handle, float offset, int8_t *reg) |
| convert a aging offset value to a register raw data | |
| uint8_t | ds3231_aging_offset_convert_to_data (ds3231_handle_t *handle, int8_t reg, float *offset) |
| convert a register raw data to a converted aging offset data | |
| uint8_t | ds3231_set_alarm_interrupt (ds3231_handle_t *handle, ds3231_alarm_t alarm, ds3231_bool_t enable) |
| enable or disable the alarm interrupt | |
| uint8_t | ds3231_get_alarm_interrupt (ds3231_handle_t *handle, ds3231_alarm_t alarm, ds3231_bool_t *enable) |
| get the alarm interrupt status | |
| uint8_t | ds3231_set_alarm1 (ds3231_handle_t *handle, ds3231_time_t *t, ds3231_alarm1_mode_t mode) |
| set the alarm1 time | |
| uint8_t | ds3231_get_alarm1 (ds3231_handle_t *handle, ds3231_time_t *t, ds3231_alarm1_mode_t *mode) |
| get the alarm1 time | |
| uint8_t | ds3231_set_alarm2 (ds3231_handle_t *handle, ds3231_time_t *t, ds3231_alarm2_mode_t mode) |
| set the alarm2 time | |
| uint8_t | ds3231_get_alarm2 (ds3231_handle_t *handle, ds3231_time_t *t, ds3231_alarm2_mode_t *mode) |
| get the alarm2 time | |
| uint8_t | ds3231_alarm_clear (ds3231_handle_t *handle, ds3231_alarm_t alarm) |
| clear the alarm flag | |
| uint8_t | ds3231_set_reg (ds3231_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len) |
| set the chip register | |
| uint8_t | ds3231_get_reg (ds3231_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len) |
| get the chip register | |
driver ds3231 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.
| Date | Version | Author | Description |
|---|---|---|---|
| 2021/03/15 | 2.0 | Shifeng Li | format the code |
| 2020/11/30 | 1.0 | Shifeng Li | first upload |
Definition in file driver_ds3231.h.