Sensorian  1.0
C API Reference Guide Library
MCP79410.c File Reference

MCP79410 driver. More...

#include "MCP79410.h"
#include "i2c.h"
#include <time.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

void MCP79410_Initialize (void)
 Initializes the RTCC with the system time. More...
 
void MCP79410_EnableOscillator (void)
 Enables the clock oscillator. This must be enabled in order for the RTCC to run. More...
 
void MCP79410_DisableOscillator (void)
 Disables the clock oscillator.The RTCC does not operate once the oscillator is stopped. More...
 
unsigned char MCP79410_IsRunning (void)
 Checks if the chip clock is running. More...
 
RTCC_StructMCP79410_GetTime (void)
 The function returns a time structure with the current time from the RTCC. More...
 
void MCP79410_SetTime (RTCC_Struct *time)
 This function initializes the RTCC with a specific time contained in the time structure. More...
 
void MCP79410_SetHourFormat (Format_t format)
 This function sets the hour format. More...
 
void MCP79410_SetPMAM (PMAM_t meridian)
 This function sets the meridian mode. More...
 
void MCP79410_EnableAlarm (Alarm_t alarm)
 This function sets the alarm time. More...
 
void MCP79410_DisableAlarm (Alarm_t alarm)
 This function disables one of the two alarms. More...
 
AlarmStatus_t MCP79410_GetAlarmStatus (Alarm_t alarm)
 This function gets the status of the alarm interrupt flag. More...
 
void MCP79410_ClearInterruptFlag (Alarm_t alarm)
 Clears the interrupt alarm flag. More...
 
void MCP79410_SetAlarmTime (RTCC_Struct *time, Alarm_t alarm)
 This function sets the alarm time for one of the two alarms. More...
 
void MCP79410_SetAlarmMFPPolarity (Polarity_t MFP_pol, Alarm_t alarm)
 This function sets the MFP polarity either high or low. More...
 
void MCP79410_SetAlarmMatch (Match_t match, Alarm_t alarm)
 Alarm Asserts on Match on seconds, minutes ,hours depending on match parameter. More...
 
void MCP79410_SetMFP_Functionality (MFP_t mode)
 This function sets the MFP pin mode. More...
 
void MCP79410_SetMFP_GPOStatus (Polarity_t status)
 This function sets the MFP output logic level when the pin is configured as GPO. More...
 
unsigned char MCP79410_CheckPowerFailure (void)
 This function checks if there was a power failure. More...
 
unsigned char MCP79410_IsVbatEnabled (void)
 This function checks if battery mode is enabled. More...
 
void MCP79410_EnableVbat (void)
 This function enables backup battery mode. More...
 
void MCP79410_DisableVbat (void)
 This function disables the backup battery functionality. More...
 
RTCC_StructMCP79410_GetPowerUpTime (void)
 This function returns the power-up time of the RTCC. More...
 
RTCC_StructMCP79410_GetPowerDownTime (void)
 This function returns the power-down time of the RTCC. More...
 
unsigned char MCP79410_dec2bcd (unsigned char num)
 Convert Binary Coded Decimal (BCD) to Decimal. More...
 
unsigned char MCP79410_bcd2dec (unsigned char num)
 Convert Binary Coded Decimal (BCD) to Decimal. More...
 
void MCP79410_Write (unsigned char rtcc_reg, unsigned char time_var)
 The below function writes a data byte in the I2C RTCC. More...
 
unsigned char MCP79410_Read (unsigned char rtcc_reg)
 

Detailed Description

MCP79410 driver.

Author
D.Qendri
Date
30 Dec 2014

Definition in file MCP79410.c.

Function Documentation

unsigned char MCP79410_Read ( unsigned char  rtcc_reg)

The function reads a data byte from the I2C RTCC

Parameters
rtcc_regAddress of register.
Returns
reg Register content.

Definition at line 593 of file MCP79410.c.

void MCP79410_Write ( unsigned char  rtcc_reg,
unsigned char  time_var 
)

The below function writes a data byte in the I2C RTCC.

Parameters
rtcc_regChip register to write to.
time_varByte data for register.
Returns
none

Definition at line 583 of file MCP79410.c.