![]() |
LibDriver DS3231
|
driver ds3231 source file More...
#include "driver_ds3231.h"Go to the source code of this file.
Macros | |
| #define | CHIP_NAME "Maxim Integrated DS3231" |
| chip information definition | |
| #define | MANUFACTURER_NAME "Maxim Integrated" |
| #define | SUPPLY_VOLTAGE_MIN 2.3f |
| #define | SUPPLY_VOLTAGE_MAX 5.5f |
| #define | MAX_CURRENT 0.65f |
| #define | TEMPERATURE_MIN -40.0f |
| #define | TEMPERATURE_MAX 85.0f |
| #define | DRIVER_VERSION 2000 |
| #define | DS3231_REG_SECOND 0x00 |
| chip register definition | |
| #define | DS3231_REG_MINUTE 0x01 |
| #define | DS3231_REG_HOUR 0x02 |
| #define | DS3231_REG_WEEK 0x03 |
| #define | DS3231_REG_DATE 0x04 |
| #define | DS3231_REG_MONTH 0x05 |
| #define | DS3231_REG_YEAR 0x06 |
| #define | DS3231_REG_ALARM1_SECOND 0x07 |
| #define | DS3231_REG_ALARM1_MINUTE 0x08 |
| #define | DS3231_REG_ALARM1_HOUR 0x09 |
| #define | DS3231_REG_ALARM1_WEEK 0x0A |
| #define | DS3231_REG_ALARM2_MINUTE 0x0B |
| #define | DS3231_REG_ALARM2_HOUR 0x0C |
| #define | DS3231_REG_ALARM2_WEEK 0x0D |
| #define | DS3231_REG_CONTROL 0x0E |
| #define | DS3231_REG_STATUS 0x0F |
| #define | DS3231_REG_XTAL 0x10 |
| #define | DS3231_REG_TEMPERATUREH 0x11 |
| #define | DS3231_REG_TEMPERATUREL 0x12 |
| #define | DS3231_ADDRESS 0xD0 |
| chip address definition | |
Functions | |
| 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_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_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_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_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_get_temperature (ds3231_handle_t *handle, int16_t *raw, float *s) |
| get the chip temperature | |
| uint8_t | ds3231_get_status (ds3231_handle_t *handle, uint8_t *status) |
| get the chip status | |
| 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_irq_handler (ds3231_handle_t *handle) |
| irq handler | |
| 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_alarm_clear (ds3231_handle_t *handle, ds3231_alarm_t alarm) |
| clear the alarm flag | |
| 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_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 | |
| uint8_t | ds3231_info (ds3231_info_t *info) |
| get chip's information | |
driver ds3231 source 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.c.
| #define CHIP_NAME "Maxim Integrated DS3231" |
| #define DRIVER_VERSION 2000 |
driver version
Definition at line 50 of file driver_ds3231.c.
| #define DS3231_ADDRESS 0xD0 |
| #define DS3231_REG_ALARM1_HOUR 0x09 |
alarm1 hour register
Definition at line 64 of file driver_ds3231.c.
| #define DS3231_REG_ALARM1_MINUTE 0x08 |
alarm1 minute register
Definition at line 63 of file driver_ds3231.c.
| #define DS3231_REG_ALARM1_SECOND 0x07 |
alarm1 second register
Definition at line 62 of file driver_ds3231.c.
| #define DS3231_REG_ALARM1_WEEK 0x0A |
alarm1 week register
Definition at line 65 of file driver_ds3231.c.
| #define DS3231_REG_ALARM2_HOUR 0x0C |
alarm2 hour register
Definition at line 67 of file driver_ds3231.c.
| #define DS3231_REG_ALARM2_MINUTE 0x0B |
alarm2 minute register
Definition at line 66 of file driver_ds3231.c.
| #define DS3231_REG_ALARM2_WEEK 0x0D |
alarm2 week register
Definition at line 68 of file driver_ds3231.c.
| #define DS3231_REG_CONTROL 0x0E |
control register
Definition at line 69 of file driver_ds3231.c.
| #define DS3231_REG_DATE 0x04 |
date register
Definition at line 59 of file driver_ds3231.c.
| #define DS3231_REG_HOUR 0x02 |
hour register
Definition at line 57 of file driver_ds3231.c.
| #define DS3231_REG_MINUTE 0x01 |
minute register
Definition at line 56 of file driver_ds3231.c.
| #define DS3231_REG_MONTH 0x05 |
month register
Definition at line 60 of file driver_ds3231.c.
| #define DS3231_REG_SECOND 0x00 |
| #define DS3231_REG_STATUS 0x0F |
status register
Definition at line 70 of file driver_ds3231.c.
| #define DS3231_REG_TEMPERATUREH 0x11 |
temperature high register
Definition at line 72 of file driver_ds3231.c.
| #define DS3231_REG_TEMPERATUREL 0x12 |
temperature low register
Definition at line 73 of file driver_ds3231.c.
| #define DS3231_REG_WEEK 0x03 |
week register
Definition at line 58 of file driver_ds3231.c.
| #define DS3231_REG_XTAL 0x10 |
xtal register
Definition at line 71 of file driver_ds3231.c.
| #define DS3231_REG_YEAR 0x06 |
year register
Definition at line 61 of file driver_ds3231.c.
| #define MANUFACTURER_NAME "Maxim Integrated" |
manufacturer name
Definition at line 44 of file driver_ds3231.c.
| #define MAX_CURRENT 0.65f |
chip max current
Definition at line 47 of file driver_ds3231.c.
| #define SUPPLY_VOLTAGE_MAX 5.5f |
chip max supply voltage
Definition at line 46 of file driver_ds3231.c.
| #define SUPPLY_VOLTAGE_MIN 2.3f |
chip min supply voltage
Definition at line 45 of file driver_ds3231.c.
| #define TEMPERATURE_MAX 85.0f |
chip max operating temperature
Definition at line 49 of file driver_ds3231.c.
| #define TEMPERATURE_MIN -40.0f |
chip min operating temperature
Definition at line 48 of file driver_ds3231.c.