no-OS
Classes | Macros | Functions
pcf85263.h File Reference

Header file of pcf85263 Driver. More...

#include <stdint.h>
#include <string.h>
#include "no_os_util.h"
#include "no_os_i2c.h"
Include dependency graph for pcf85263.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pcf85263_date
 Structure holding the date parameters. More...
 
struct  pcf85263_init_param
 PCF85263 Device initialization parameters. More...
 
struct  pcf85263_dev
 PCF85263 Device structure. More...
 

Macros

#define PCF85263_REG_100TH_SECONDS   0x00
 
#define PCF85263_REG_SECONDS   0x01
 
#define PCF85263_REG_MINUTES   0x02
 
#define PCF85263_REG_HOURS   0x03
 
#define PCF85263_REG_DAYS   0x04
 
#define PCF85263_REG_WEEKDAYS   0x05
 
#define PCF85263_REG_MONTHS   0x06
 
#define PCF85263_REG_YEARS   0x07
 
#define PCF85263_REG_SECOND_ALARM1   0x08
 
#define PCF85263_REG_MINUTE_ALARM1   0x09
 
#define PCF85263_REG_HOUR_ALARM1   0x0A
 
#define PCF85263_REG_DAY_ALARM1   0x0B
 
#define PCF85263_REG_MONTH_ALARM1   0x0C
 
#define PCF85263_REG_MINUTE_ALARM2   0x0D
 
#define PCF85263_REG_HOUR_ALARM2   0x0E
 
#define PCF85263_REG_WEEKDAY_ALARM2   0x0F
 
#define PCF85263_REG_ALARM_ENABLES   0x10
 
#define PCF85263_REG_TSR1_SECONDS   0x11
 
#define PCF85263_REG_TSR1_MINUTES   0x12
 
#define PCF85263_REG_TSR1_HOURS   0x13
 
#define PCF85263_REG_TSR1_DAYS   0x14
 
#define PCF85263_REG_TSR1_MONTHS   0x15
 
#define PCF85263_REG_TSR1_YEARS   0x16
 
#define PCF85263_REG_TSR2_SECONDS   0x17
 
#define PCF85263_REG_TSR2_MINUTES   0x18
 
#define PCF85263_REG_TSR2_HOURS   0x19
 
#define PCF85263_REG_TSR2_DAYS   0x1A
 
#define PCF85263_REG_TSR2_MONTHS   0x1B
 
#define PCF85263_REG_TSR2_YEARS   0x1C
 
#define PCF85263_REG_TSR3_SECONDS   0x1D
 
#define PCF85263_REG_TSR3_MINUTES   0x1E
 
#define PCF85263_REG_TSR3_HOURS   0x1F
 
#define PCF85263_REG_TSR3_DAYS   0x20
 
#define PCF85263_REG_TSR3_MONTHS   0x21
 
#define PCF85263_REG_TSR3_YEARS   0x22
 
#define PCF85263_REG_TSR_MODE   0x23
 
#define PCF85263_REG_OFFSET   0x24
 
#define PCF85263_REG_OSCILLATOR   0x25
 
#define PCF85263_REG_BATTERY_SWITCH   0x26
 
#define PCF85263_REG_PIN_IO   0x27
 
#define PCF85263_REG_FUNCTION   0x28
 
#define PCF85263_REG_INTA_ENABLE   0x29
 
#define PCF85263_REG_INTB_ENABLE   0x2A
 
#define PCF85263_REG_FLAGS   0x2B
 
#define PCF85263_REG_RAM_BYTE   0x2C
 
#define PCF85263_REG_WATCH_DOG   0x2D
 
#define PCF85263_REG_STOP_ENABLE   0x2E
 
#define PCF85263_REG_RESETS   0x2F
 
#define PCF85263_CPR   0xA4
 
#define PCF85263_BATTERY_SW_MSK   NO_OS_BIT(4)
 

Functions

int pcf85263_read (struct pcf85263_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
 Read device register. More...
 
int pcf85263_write (struct pcf85263_dev *dev, uint8_t reg_addr, uint8_t reg_data)
 Write device register. More...
 
int pcf85263_update_bits (struct pcf85263_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t reg_data)
 Update specific register bits. More...
 
int pcf85263_set_date (struct pcf85263_dev *dev, struct pcf85263_date date)
 Set date. More...
 
int pcf85263_read_ts (struct pcf85263_dev *dev, struct pcf85263_date *ts)
 Read time stamp. More...
 
int pcf85263_init (struct pcf85263_dev **device, struct pcf85263_init_param init_param)
 Initialize the device. More...
 
int pcf85263_remove (struct pcf85263_dev *dev)
 Remove the device and release resources. More...
 

Detailed Description

Header file of pcf85263 Driver.

Author
Antoniu Miclaus (anton.nosp@m.iu.m.nosp@m.iclau.nosp@m.s@an.nosp@m.alog..nosp@m.com)

Copyright 2023(c) Analog Devices, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ PCF85263_BATTERY_SW_MSK

#define PCF85263_BATTERY_SW_MSK   NO_OS_BIT(4)

◆ PCF85263_CPR

#define PCF85263_CPR   0xA4

◆ PCF85263_REG_100TH_SECONDS

#define PCF85263_REG_100TH_SECONDS   0x00

◆ PCF85263_REG_ALARM_ENABLES

#define PCF85263_REG_ALARM_ENABLES   0x10

◆ PCF85263_REG_BATTERY_SWITCH

#define PCF85263_REG_BATTERY_SWITCH   0x26

◆ PCF85263_REG_DAY_ALARM1

#define PCF85263_REG_DAY_ALARM1   0x0B

◆ PCF85263_REG_DAYS

#define PCF85263_REG_DAYS   0x04

◆ PCF85263_REG_FLAGS

#define PCF85263_REG_FLAGS   0x2B

◆ PCF85263_REG_FUNCTION

#define PCF85263_REG_FUNCTION   0x28

◆ PCF85263_REG_HOUR_ALARM1

#define PCF85263_REG_HOUR_ALARM1   0x0A

◆ PCF85263_REG_HOUR_ALARM2

#define PCF85263_REG_HOUR_ALARM2   0x0E

◆ PCF85263_REG_HOURS

#define PCF85263_REG_HOURS   0x03

◆ PCF85263_REG_INTA_ENABLE

#define PCF85263_REG_INTA_ENABLE   0x29

◆ PCF85263_REG_INTB_ENABLE

#define PCF85263_REG_INTB_ENABLE   0x2A

◆ PCF85263_REG_MINUTE_ALARM1

#define PCF85263_REG_MINUTE_ALARM1   0x09

◆ PCF85263_REG_MINUTE_ALARM2

#define PCF85263_REG_MINUTE_ALARM2   0x0D

◆ PCF85263_REG_MINUTES

#define PCF85263_REG_MINUTES   0x02

◆ PCF85263_REG_MONTH_ALARM1

#define PCF85263_REG_MONTH_ALARM1   0x0C

◆ PCF85263_REG_MONTHS

#define PCF85263_REG_MONTHS   0x06

◆ PCF85263_REG_OFFSET

#define PCF85263_REG_OFFSET   0x24

◆ PCF85263_REG_OSCILLATOR

#define PCF85263_REG_OSCILLATOR   0x25

◆ PCF85263_REG_PIN_IO

#define PCF85263_REG_PIN_IO   0x27

◆ PCF85263_REG_RAM_BYTE

#define PCF85263_REG_RAM_BYTE   0x2C

◆ PCF85263_REG_RESETS

#define PCF85263_REG_RESETS   0x2F

◆ PCF85263_REG_SECOND_ALARM1

#define PCF85263_REG_SECOND_ALARM1   0x08

◆ PCF85263_REG_SECONDS

#define PCF85263_REG_SECONDS   0x01

◆ PCF85263_REG_STOP_ENABLE

#define PCF85263_REG_STOP_ENABLE   0x2E

◆ PCF85263_REG_TSR1_DAYS

#define PCF85263_REG_TSR1_DAYS   0x14

◆ PCF85263_REG_TSR1_HOURS

#define PCF85263_REG_TSR1_HOURS   0x13

◆ PCF85263_REG_TSR1_MINUTES

#define PCF85263_REG_TSR1_MINUTES   0x12

◆ PCF85263_REG_TSR1_MONTHS

#define PCF85263_REG_TSR1_MONTHS   0x15

◆ PCF85263_REG_TSR1_SECONDS

#define PCF85263_REG_TSR1_SECONDS   0x11

◆ PCF85263_REG_TSR1_YEARS

#define PCF85263_REG_TSR1_YEARS   0x16

◆ PCF85263_REG_TSR2_DAYS

#define PCF85263_REG_TSR2_DAYS   0x1A

◆ PCF85263_REG_TSR2_HOURS

#define PCF85263_REG_TSR2_HOURS   0x19

◆ PCF85263_REG_TSR2_MINUTES

#define PCF85263_REG_TSR2_MINUTES   0x18

◆ PCF85263_REG_TSR2_MONTHS

#define PCF85263_REG_TSR2_MONTHS   0x1B

◆ PCF85263_REG_TSR2_SECONDS

#define PCF85263_REG_TSR2_SECONDS   0x17

◆ PCF85263_REG_TSR2_YEARS

#define PCF85263_REG_TSR2_YEARS   0x1C

◆ PCF85263_REG_TSR3_DAYS

#define PCF85263_REG_TSR3_DAYS   0x20

◆ PCF85263_REG_TSR3_HOURS

#define PCF85263_REG_TSR3_HOURS   0x1F

◆ PCF85263_REG_TSR3_MINUTES

#define PCF85263_REG_TSR3_MINUTES   0x1E

◆ PCF85263_REG_TSR3_MONTHS

#define PCF85263_REG_TSR3_MONTHS   0x21

◆ PCF85263_REG_TSR3_SECONDS

#define PCF85263_REG_TSR3_SECONDS   0x1D

◆ PCF85263_REG_TSR3_YEARS

#define PCF85263_REG_TSR3_YEARS   0x22

◆ PCF85263_REG_TSR_MODE

#define PCF85263_REG_TSR_MODE   0x23

◆ PCF85263_REG_WATCH_DOG

#define PCF85263_REG_WATCH_DOG   0x2D

◆ PCF85263_REG_WEEKDAY_ALARM2

#define PCF85263_REG_WEEKDAY_ALARM2   0x0F

◆ PCF85263_REG_WEEKDAYS

#define PCF85263_REG_WEEKDAYS   0x05

◆ PCF85263_REG_YEARS

#define PCF85263_REG_YEARS   0x07

Function Documentation

◆ pcf85263_init()

int pcf85263_init ( struct pcf85263_dev **  device,
struct pcf85263_init_param  init_param 
)

Initialize the device.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ pcf85263_read()

int pcf85263_read ( struct pcf85263_dev dev,
uint8_t  reg_addr,
uint8_t *  reg_data 
)

Read device register.

Parameters
dev- The device structure.
reg_addr- The register address.
reg_data- The data read from the register.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ pcf85263_read_ts()

int pcf85263_read_ts ( struct pcf85263_dev dev,
struct pcf85263_date ts 
)

Read time stamp.

Parameters
dev- The device structure.
ts- Structure holding the time stamp read.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ pcf85263_remove()

int pcf85263_remove ( struct pcf85263_dev dev)

Remove the device and release resources.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ pcf85263_set_date()

int pcf85263_set_date ( struct pcf85263_dev dev,
struct pcf85263_date  date 
)

Set date.

Parameters
dev- The device structure.
date- Structure holding the date to be set.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ pcf85263_update_bits()

int pcf85263_update_bits ( struct pcf85263_dev dev,
uint8_t  reg_addr,
uint8_t  mask,
uint8_t  reg_data 
)

Update specific register bits.

Parameters
dev- The device structure.
reg_addr- The register address.
mask- Specific bits mask.
reg_data- The data to be written.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ pcf85263_write()

int pcf85263_write ( struct pcf85263_dev dev,
uint8_t  reg_addr,
uint8_t  reg_data 
)

Write device register.

Parameters
dev-The device structure.
reg_addr- The register address.
reg_data- The data to be written.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function: