![]() |
LibDriver DS1302
|
driver ds1302 source file More...
#include "driver_ds1302.h"Go to the source code of this file.
Macros | |
| #define | CHIP_NAME "Maxim Integrated DS1302" |
| chip information definition | |
| #define | MANUFACTURER_NAME "Maxim Integrated" |
| #define | SUPPLY_VOLTAGE_MIN 2.0f |
| #define | SUPPLY_VOLTAGE_MAX 5.5f |
| #define | MAX_CURRENT 1.28f |
| #define | TEMPERATURE_MIN -40.0f |
| #define | TEMPERATURE_MAX 85.0f |
| #define | DRIVER_VERSION 1000 |
| #define | DS1302_REG_SECOND (0 << 1) |
| chip register definition | |
| #define | DS1302_REG_MINUTE (1 << 1) |
| #define | DS1302_REG_HOUR (2 << 1) |
| #define | DS1302_REG_DATE (3 << 1) |
| #define | DS1302_REG_MONTH (4 << 1) |
| #define | DS1302_REG_WEEK (5 << 1) |
| #define | DS1302_REG_YEAR (6 << 1) |
| #define | DS1302_REG_CONTROL (7 << 1) |
| #define | DS1302_REG_CHARGE (8 << 1) |
| #define | DS1302_COMMAND_RTC (0 << 6) |
| chip command definition | |
| #define | DS1302_COMMAND_RAM (1 << 6) |
| #define | DS1302_COMMAND_BURST (0x1F << 1) |
Functions | |
| uint8_t | ds1302_set_time (ds1302_handle_t *handle, ds1302_time_t *t) |
| set the current time | |
| uint8_t | ds1302_get_time (ds1302_handle_t *handle, ds1302_time_t *t) |
| get the current time | |
| uint8_t | ds1302_set_oscillator (ds1302_handle_t *handle, ds1302_bool_t enable) |
| enable or disable the oscillator | |
| uint8_t | ds1302_get_oscillator (ds1302_handle_t *handle, ds1302_bool_t *enable) |
| get the chip oscillator status | |
| uint8_t | ds1302_set_write_protect (ds1302_handle_t *handle, ds1302_bool_t enable) |
| enable or disable write protect | |
| uint8_t | ds1302_get_write_protect (ds1302_handle_t *handle, ds1302_bool_t *enable) |
| get write protect status | |
| uint8_t | ds1302_set_charge (ds1302_handle_t *handle, uint8_t charge) |
| set charge | |
| uint8_t | ds1302_get_charge (ds1302_handle_t *handle, uint8_t *charge) |
| get charge | |
| uint8_t | ds1302_read_ram (ds1302_handle_t *handle, uint8_t addr, uint8_t *buf, uint8_t len) |
| read ram | |
| uint8_t | ds1302_write_ram (ds1302_handle_t *handle, uint8_t addr, uint8_t *buf, uint8_t len) |
| write ram | |
| uint8_t | ds1302_init (ds1302_handle_t *handle) |
| initialize the chip | |
| uint8_t | ds1302_deinit (ds1302_handle_t *handle) |
| close the chip | |
| uint8_t | ds1302_clock_burst_write (ds1302_handle_t *handle, uint8_t *buf, uint8_t len) |
| clock burst write | |
| uint8_t | ds1302_clock_burst_read (ds1302_handle_t *handle, uint8_t *buf, uint8_t len) |
| clock burst read | |
| uint8_t | ds1302_ram_burst_write (ds1302_handle_t *handle, uint8_t *buf, uint8_t len) |
| ram burst write | |
| uint8_t | ds1302_ram_burst_read (ds1302_handle_t *handle, uint8_t *buf, uint8_t len) |
| ram burst read | |
| uint8_t | ds1302_set_reg (ds1302_handle_t *handle, uint8_t reg, uint8_t *buf, uint8_t len) |
| set the chip register | |
| uint8_t | ds1302_get_reg (ds1302_handle_t *handle, uint8_t reg, uint8_t *buf, uint8_t len) |
| get the chip register | |
| uint8_t | ds1302_info (ds1302_info_t *info) |
| get chip's information | |
driver ds1302 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 |
|---|---|---|---|
| 2024/02/15 | 1.0 | Shifeng Li | first upload |
Definition in file driver_ds1302.c.
| #define CHIP_NAME "Maxim Integrated DS1302" |
| #define DRIVER_VERSION 1000 |
driver version
Definition at line 49 of file driver_ds1302.c.
| #define DS1302_COMMAND_BURST (0x1F << 1) |
burst command
Definition at line 69 of file driver_ds1302.c.
| #define DS1302_COMMAND_RAM (1 << 6) |
ram command
Definition at line 68 of file driver_ds1302.c.
| #define DS1302_COMMAND_RTC (0 << 6) |
| #define DS1302_REG_CHARGE (8 << 1) |
charge register
Definition at line 62 of file driver_ds1302.c.
| #define DS1302_REG_CONTROL (7 << 1) |
control register
Definition at line 61 of file driver_ds1302.c.
| #define DS1302_REG_DATE (3 << 1) |
date register
Definition at line 57 of file driver_ds1302.c.
| #define DS1302_REG_HOUR (2 << 1) |
hour register
Definition at line 56 of file driver_ds1302.c.
| #define DS1302_REG_MINUTE (1 << 1) |
minute register
Definition at line 55 of file driver_ds1302.c.
| #define DS1302_REG_MONTH (4 << 1) |
month register
Definition at line 58 of file driver_ds1302.c.
| #define DS1302_REG_SECOND (0 << 1) |
| #define DS1302_REG_WEEK (5 << 1) |
week register
Definition at line 59 of file driver_ds1302.c.
| #define DS1302_REG_YEAR (6 << 1) |
year register
Definition at line 60 of file driver_ds1302.c.
| #define MANUFACTURER_NAME "Maxim Integrated" |
manufacturer name
Definition at line 43 of file driver_ds1302.c.
| #define MAX_CURRENT 1.28f |
chip max current
Definition at line 46 of file driver_ds1302.c.
| #define SUPPLY_VOLTAGE_MAX 5.5f |
chip max supply voltage
Definition at line 45 of file driver_ds1302.c.
| #define SUPPLY_VOLTAGE_MIN 2.0f |
chip min supply voltage
Definition at line 44 of file driver_ds1302.c.
| #define TEMPERATURE_MAX 85.0f |
chip max operating temperature
Definition at line 48 of file driver_ds1302.c.
| #define TEMPERATURE_MIN -40.0f |
chip min operating temperature
Definition at line 47 of file driver_ds1302.c.