|
|
@@ -1,87 +0,0 @@
|
|
|
-/*
|
|
|
- * RTC.h
|
|
|
- *
|
|
|
- * Created on: 14 janv. 2019
|
|
|
- * Author: e_rcluze
|
|
|
- *
|
|
|
- * Penser a ajouter les fonction de lecture ecriture dans le fichier i2c.c "g�n�rer"
|
|
|
- *
|
|
|
- *
|
|
|
- *
|
|
|
-void readRTC(uint8_t add, uint8_t *tab, int len){
|
|
|
- uint8_t ad[1];
|
|
|
- ad[0]=add;
|
|
|
- HAL_StatusTypeDef res;
|
|
|
- res = HAL_I2C_Master_Transmit(&hi2c?,RTC_ADD,ad,1,1000);
|
|
|
- res = HAL_I2C_Master_Receive(&hi2c?,RTC_ADD,tab,len,1000);
|
|
|
-}
|
|
|
-
|
|
|
-void writeRTC(uint8_t add, uint8_t *tab, int len){
|
|
|
- uint8_t ad[len+1];
|
|
|
- ad[0]=add;
|
|
|
- for (int i = 0; i< len;i++){
|
|
|
- ad[i+1]=tab[i];
|
|
|
- }
|
|
|
- HAL_StatusTypeDef res;
|
|
|
- res = HAL_I2C_Master_Transmit(&hi2c3,RTC_ADD,ad,len+1,1000);
|
|
|
-}
|
|
|
- *
|
|
|
- */
|
|
|
-
|
|
|
-#ifndef RTC_H
|
|
|
-#define RTC_H
|
|
|
-
|
|
|
-#include "Heure.h"
|
|
|
-#include "i2c.h"
|
|
|
-
|
|
|
-#define RTC_ADD 0XD0
|
|
|
-
|
|
|
-#define CENTIEM 0X00
|
|
|
-#define SECOND 0X01
|
|
|
-#define MINUTES 0X02
|
|
|
-#define HOURS 0X03
|
|
|
-#define DAYWEEK 0X04
|
|
|
-#define DAY 0X05
|
|
|
-#define MONTHS 0X06
|
|
|
-#define YEAR 0X07
|
|
|
-#define CALIBRATION 0X08
|
|
|
-#define WATCHDOG 0X09
|
|
|
-#define ALARM_MONTH 0X0A
|
|
|
-#define ALARM_DAY 0X0B
|
|
|
-#define ALARM_HOURS 0X0C
|
|
|
-#define ALARM_MINUTES 0X0D
|
|
|
-#define ALARM_SECOND 0X0E
|
|
|
-#define FLAGS 0X0F
|
|
|
-#define TIMER_VALUE 0X10
|
|
|
-#define TIMER_CONTROL 0X11
|
|
|
-#define ANALOG_CALIBRATION 0X12
|
|
|
-#define SQW 0X13
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-/****Private fonction */
|
|
|
-HAL_StatusTypeDef readRTC(uint8_t reg, uint8_t *tab, int len);
|
|
|
-
|
|
|
-HAL_StatusTypeDef writeRTC(uint8_t reg, uint8_t *tab, int len);
|
|
|
-
|
|
|
-/** Public Fonction*/
|
|
|
-void initRTC(I2C_HandleTypeDef *typ);
|
|
|
-
|
|
|
-HAL_StatusTypeDef readHeure(Heure *heure);
|
|
|
-
|
|
|
-uint16_t HeureEnMinute();
|
|
|
-
|
|
|
-HAL_StatusTypeDef readDate(Date *date);
|
|
|
-
|
|
|
-HAL_StatusTypeDef redemareRTC();
|
|
|
-
|
|
|
-HAL_StatusTypeDef writeDate(Date *date);
|
|
|
-
|
|
|
-/**
|
|
|
- * Fonction qui permet de tester le mat�riel
|
|
|
- */
|
|
|
-void testRTC();
|
|
|
-
|
|
|
-void testBatteryRTC();
|
|
|
-
|
|
|
-#endif /* RTC_H */
|