Sensorian
1.0
C API Reference Guide Library
|
MCP79410 driver header. More...
#include "bcm2835.h"
Go to the source code of this file.
Data Structures | |
struct | _RTCC_Struct |
Macros | |
#define | MCP79410_ADDRESS 0x6f |
The I2C address of the MCP79410 real time clock and calendar. More... | |
#define | EEPROM_WRITE 0xae |
#define | EEPROM_READ 0xaf |
#define | RTCC_WRITE 0xde |
#define | RTCC_READ 0xdf |
#define | SRAM_PTR 0x20 |
#define | EEPROM_SR 0xff |
#define | SEC 0x00 |
#define | MIN 0x01 |
#define | HOUR 0x02 |
#define | DAY 0x03 |
#define | STAT 0x03 |
#define | DATE 0x04 |
#define | MNTH 0x05 |
#define | YEAR 0x06 |
#define | CTRL 0x07 |
#define | CAL 0x08 |
#define | ULID 0x09 |
#define | ALM0SEC 0x0a |
#define | ALM0MIN 0x0b |
#define | ALM0HR 0x0c |
#define | ALM0WDAY 0x0d |
#define | ALM0DATE 0x0e |
#define | ALM0MTH 0x0f |
#define | ALM1SEC 0x11 |
#define | ALM1MIN 0x12 |
#define | ALM1HR 0x13 |
#define | ALM1WDAY 0x14 |
#define | ALM1DATE 0x15 |
#define | ALM1MTH 0x16 |
#define | PWRDNMIN 0x18 |
#define | PWRDNHOUR 0x19 |
#define | PWRDNDATE 0x1a |
#define | PWRDNMTH 0x1b |
#define | PWRUPMIN 0x1c |
#define | PWRUPHOUR 0x1d |
#define | PWRUPDATE 0x1e |
#define | PWRUPMTH 0x1f |
#define | PM 0x20 |
#define | HOUR_FORMAT 0x40 |
#define | OUT_PIN 0x80 |
#define | SQWEN 0x40 |
#define | ALM_NO 0x00 |
#define | ALM_0 0x10 |
#define | ALM_1 0x20 |
#define | ALM_01 0x30 |
#define | MFP_01H 0x00 |
#define | MFP_04K 0x01 |
#define | MFP_08K 0x02 |
#define | MFP_32K 0x03 |
#define | MFP_64H 0x04 |
#define | ALMx_POL 0x80 |
#define | ALMxC_SEC 0x00 |
#define | ALMxC_MIN 0x10 |
#define | ALMxC_HR 0x20 |
#define | ALMxC_DAY 0x30 |
#define | ALMxC_DAT 0x40 |
#define | ALMxC_ALL 0x70 |
#define | ALMx_IF 0x08 |
#define | OSCRUN 0x20 |
#define | PWRFAIL 0x10 |
#define | VBATEN 0x08 |
#define | VBAT_DIS 0x37 |
#define | START_32KHZ 0x80 |
#define | LP 0x20 |
#define | HOUR_12 0x40 |
#define | LPYR 0x20 |
#define | ALM1MSK2 0x40 |
#define | ALM1MSK1 0x20 |
#define | ALM1MSK0 0x10 |
#define | ALM0MSK2 0x40 |
#define | ALM0MSK1 0x20 |
#define | ALM0MSK0 0x10 |
#define | TRUE 1 |
#define | FALSE 0 |
Typedefs | |
typedef struct _RTCC_Struct | RTCC_Struct |
typedef enum Alarm | Alarm_t |
typedef enum AlarmStatus | AlarmStatus_t |
typedef enum PMAM | PMAM_t |
typedef enum Format | Format_t |
typedef enum Match | Match_t |
typedef enum MFP_MODE | MFP_t |
typedef enum MFP_POL | Polarity_t |
Enumerations | |
enum | Alarm { ZERO = 0, ONE, ZERO = 0, ONE, ZERO = 0, ONE, ZERO = 0, ONE } |
enum | AlarmStatus { NOT_SET = 0, SET, NOT_SET = 0, SET, NOT_SET = 0, SET, NOT_SET = 0, SET } |
enum | PMAM { AMT = 0, PMT, AMT = 0, PMT, AMT = 0, PMT, AMT = 0, PMT } |
enum | Format { H24 = 0, H12, H24 = 0, H12, H24 = 0, H12, H24 = 0, H12 } |
enum | Match { SECONDS_MATCH = 0, MINUTES_MATCH, HOURS_MATCH, WEEKDAY_MATCH, DATE_MATCH, FULL_DATE_MATCH, SECONDS_MATCH = 0, MINUTES_MATCH, HOURS_MATCH, WEEKDAY_MATCH, DATE_MATCH, FULL_DATE_MATCH, SECONDS_MATCH = 0, MINUTES_MATCH, HOURS_MATCH, WEEKDAY_MATCH, DATE_MATCH, FULL_DATE_MATCH, SECONDS_MATCH = 0, MINUTES_MATCH, HOURS_MATCH, WEEKDAY_MATCH, DATE_MATCH, FULL_DATE_MATCH } |
enum | MFP_MODE { GPO = 0, ALARM_INTERRUPT, SQUARE_WAVE, GPO = 0, ALARM_INTERRUPT, SQUARE_WAVE, GPO = 0, ALARM_INTERRUPT, SQUARE_WAVE, GPO = 0, ALARM_INTERRUPT, SQUARE_WAVE } |
enum | MFP_POL { LOWPOL = 0, HIGHPOL, LOWPOL = 0, HIGHPOL, LOWPOL = 0, HIGHPOL, LOWPOL = 0, HIGHPOL } |
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_Struct * | MCP79410_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_Struct * | MCP79410_GetPowerUpTime (void) |
This function returns the power-up time of the RTCC. More... | |
RTCC_Struct * | MCP79410_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 data) |
The below function writes a data byte in the I2C RTCC. More... | |
unsigned char | MCP79410_Read (unsigned char rtcc_reg) |
#define ALM0DATE 0x0e |
Definition at line 73 of file MCP79410.h.
#define ALM0HR 0x0c |
Definition at line 71 of file MCP79410.h.
#define ALM0MIN 0x0b |
Definition at line 70 of file MCP79410.h.
#define ALM0MSK0 0x10 |
Definition at line 136 of file MCP79410.h.
#define ALM0MSK1 0x20 |
Definition at line 135 of file MCP79410.h.
#define ALM0MSK2 0x40 |
Definition at line 134 of file MCP79410.h.
#define ALM0MTH 0x0f |
Definition at line 74 of file MCP79410.h.
#define ALM0SEC 0x0a |
Definition at line 69 of file MCP79410.h.
#define ALM0WDAY 0x0d |
Definition at line 72 of file MCP79410.h.
#define ALM1DATE 0x15 |
Definition at line 80 of file MCP79410.h.
#define ALM1HR 0x13 |
Definition at line 78 of file MCP79410.h.
#define ALM1MIN 0x12 |
Definition at line 77 of file MCP79410.h.
#define ALM1MSK0 0x10 |
Definition at line 132 of file MCP79410.h.
#define ALM1MSK1 0x20 |
Definition at line 131 of file MCP79410.h.
#define ALM1MSK2 0x40 |
Definition at line 130 of file MCP79410.h.
#define ALM1MTH 0x16 |
Definition at line 81 of file MCP79410.h.
#define ALM1SEC 0x11 |
Definition at line 76 of file MCP79410.h.
#define ALM1WDAY 0x14 |
Definition at line 79 of file MCP79410.h.
#define ALM_0 0x10 |
Definition at line 100 of file MCP79410.h.
#define ALM_01 0x30 |
Definition at line 102 of file MCP79410.h.
#define ALM_1 0x20 |
Definition at line 101 of file MCP79410.h.
#define ALM_NO 0x00 |
Definition at line 99 of file MCP79410.h.
#define ALMx_IF 0x08 |
Definition at line 115 of file MCP79410.h.
#define ALMx_POL 0x80 |
Definition at line 108 of file MCP79410.h.
#define ALMxC_ALL 0x70 |
Definition at line 114 of file MCP79410.h.
#define ALMxC_DAT 0x40 |
Definition at line 113 of file MCP79410.h.
#define ALMxC_DAY 0x30 |
Definition at line 112 of file MCP79410.h.
#define ALMxC_HR 0x20 |
Definition at line 111 of file MCP79410.h.
#define ALMxC_MIN 0x10 |
Definition at line 110 of file MCP79410.h.
#define ALMxC_SEC 0x00 |
Definition at line 109 of file MCP79410.h.
#define CAL 0x08 |
Definition at line 66 of file MCP79410.h.
#define CTRL 0x07 |
Definition at line 65 of file MCP79410.h.
#define DATE 0x04 |
Definition at line 62 of file MCP79410.h.
#define DAY 0x03 |
Definition at line 60 of file MCP79410.h.
#define EEPROM_READ 0xaf |
Definition at line 50 of file MCP79410.h.
#define EEPROM_SR 0xff |
Definition at line 55 of file MCP79410.h.
#define EEPROM_WRITE 0xae |
Definition at line 49 of file MCP79410.h.
#define FALSE 0 |
Definition at line 191 of file MCP79410.h.
#define HOUR 0x02 |
Definition at line 59 of file MCP79410.h.
#define HOUR_12 0x40 |
Definition at line 124 of file MCP79410.h.
#define HOUR_FORMAT 0x40 |
Definition at line 96 of file MCP79410.h.
#define LP 0x20 |
Definition at line 123 of file MCP79410.h.
#define LPYR 0x20 |
Definition at line 126 of file MCP79410.h.
#define MCP79410_ADDRESS 0x6f |
The I2C address of the MCP79410 real time clock and calendar.
Definition at line 45 of file MCP79410.h.
#define MFP_01H 0x00 |
Definition at line 103 of file MCP79410.h.
#define MFP_04K 0x01 |
Definition at line 104 of file MCP79410.h.
#define MFP_08K 0x02 |
Definition at line 105 of file MCP79410.h.
#define MFP_32K 0x03 |
Definition at line 106 of file MCP79410.h.
#define MFP_64H 0x04 |
Definition at line 107 of file MCP79410.h.
#define MIN 0x01 |
Definition at line 58 of file MCP79410.h.
#define MNTH 0x05 |
Definition at line 63 of file MCP79410.h.
#define OSCRUN 0x20 |
Definition at line 117 of file MCP79410.h.
#define OUT_PIN 0x80 |
Definition at line 97 of file MCP79410.h.
#define PM 0x20 |
Definition at line 95 of file MCP79410.h.
#define PWRDNDATE 0x1a |
Definition at line 85 of file MCP79410.h.
#define PWRDNHOUR 0x19 |
Definition at line 84 of file MCP79410.h.
#define PWRDNMIN 0x18 |
Definition at line 83 of file MCP79410.h.
#define PWRDNMTH 0x1b |
Definition at line 86 of file MCP79410.h.
#define PWRFAIL 0x10 |
Definition at line 118 of file MCP79410.h.
#define PWRUPDATE 0x1e |
Definition at line 90 of file MCP79410.h.
#define PWRUPHOUR 0x1d |
Definition at line 89 of file MCP79410.h.
#define PWRUPMIN 0x1c |
Definition at line 88 of file MCP79410.h.
#define PWRUPMTH 0x1f |
Definition at line 91 of file MCP79410.h.
#define RTCC_READ 0xdf |
Definition at line 52 of file MCP79410.h.
#define RTCC_WRITE 0xde |
Definition at line 51 of file MCP79410.h.
#define SEC 0x00 |
Definition at line 57 of file MCP79410.h.
#define SQWEN 0x40 |
Definition at line 98 of file MCP79410.h.
#define SRAM_PTR 0x20 |
Definition at line 54 of file MCP79410.h.
#define START_32KHZ 0x80 |
Definition at line 122 of file MCP79410.h.
#define STAT 0x03 |
Definition at line 61 of file MCP79410.h.
#define TRUE 1 |
Definition at line 190 of file MCP79410.h.
#define ULID 0x09 |
Definition at line 67 of file MCP79410.h.
#define VBAT_DIS 0x37 |
Definition at line 120 of file MCP79410.h.
#define VBATEN 0x08 |
Definition at line 119 of file MCP79410.h.
#define YEAR 0x06 |
Definition at line 64 of file MCP79410.h.
typedef enum AlarmStatus AlarmStatus_t |
Alarm Status Alarm Status Type .
typedef enum MFP_POL Polarity_t |
MFP_MODE MFP_MODE Type .
typedef struct _RTCC_Struct RTCC_Struct |
MCP79410 RTCC time structure type
enum Alarm |
Alarm Alarm Type.
Enumerator | |
---|---|
ZERO | |
ONE | |
ZERO | |
ONE | |
ZERO | |
ONE | |
ZERO | |
ONE |
Definition at line 157 of file MCP79410.h.
enum AlarmStatus |
Alarm Status Alarm Status Type .
Enumerator | |
---|---|
NOT_SET | |
SET | |
NOT_SET | |
SET | |
NOT_SET | |
SET | |
NOT_SET | |
SET |
Definition at line 162 of file MCP79410.h.
enum Format |
PMAM PMAM Type .
Enumerator | |
---|---|
H24 | |
H12 | |
H24 | |
H12 | |
H24 | |
H12 | |
H24 | |
H12 |
Definition at line 172 of file MCP79410.h.
enum Match |
Hour Format Format Type .
Definition at line 177 of file MCP79410.h.
enum MFP_MODE |
Alarm Match Alarm Match Type .
Enumerator | |
---|---|
GPO | |
ALARM_INTERRUPT | |
SQUARE_WAVE | |
GPO | |
ALARM_INTERRUPT | |
SQUARE_WAVE | |
GPO | |
ALARM_INTERRUPT | |
SQUARE_WAVE | |
GPO | |
ALARM_INTERRUPT | |
SQUARE_WAVE |
Definition at line 182 of file MCP79410.h.
enum MFP_POL |
MFP_MODE MFP_MODE Type .
Enumerator | |
---|---|
LOWPOL | |
HIGHPOL | |
LOWPOL | |
HIGHPOL | |
LOWPOL | |
HIGHPOL | |
LOWPOL | |
HIGHPOL |
Definition at line 187 of file MCP79410.h.
enum PMAM |
Alarm Status Alarm Status Type .
Enumerator | |
---|---|
AMT | |
PMT | |
AMT | |
PMT | |
AMT | |
PMT | |
AMT | |
PMT |
Definition at line 167 of file MCP79410.h.
unsigned char MCP79410_Read | ( | unsigned char | rtcc_reg | ) |
The function reads a data byte from the I2C RTCC
rtcc_reg | Address of register. |
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.
rtcc_reg | Chip register to write to. |
time_var | Byte data for register. |
Definition at line 583 of file MCP79410.c.