Sfoglia il codice sorgente

Modif de dossier + Creation d'un gestionaire de version des programmes

remy 3 anni fa
parent
commit
bd4d17ff4d
6 ha cambiato i file con 261 aggiunte e 0 eliminazioni
  1. BIN
      Fonction.ods
  2. 52 0
      Source/Eeprom.h
  3. 40 0
      Source/FIFO_COM.h
  4. 42 0
      Source/Heure.h
  5. 40 0
      Source/PCF8574.h
  6. 87 0
      Source/RTC.h

BIN
Fonction.ods


+ 52 - 0
Source/Eeprom.h

@@ -0,0 +1,52 @@
+/*
+ * Eeprom.h V1.0
+ *
+ *  Created on: 14 janv. 2019
+ *      Author: e_rcluze
+ *
+ *Le fonctionement de l'Eeprom est en Fifo.
+ *L'adrresse du pointeur de lecture est stocker dans les 16 premier byte de l'eeprom
+ *L'adrresse du pointeur d'ecriture est stocker dans les 16 bit suivant
+ *
+ *
+ *
+ *
+ */
+
+#ifndef EEPROM_H_
+#define EEPROM_H_
+
+#include <stdint.h>
+#include "i2c.h"
+
+#define EepromADD 0XA0
+
+typedef struct {
+	I2C_HandleTypeDef I2C;
+	GPIO_TypeDef WC_PORT;
+	uint16_t WC_PIN;
+} EEprom_HandleTypeDef;
+
+EEprom_HandleTypeDef EEprom;
+
+/****Private fonction */
+void readEeprom(uint8_t *tab, int len);
+void writeEeprom(uint8_t *tab, int len);
+
+uint16_t readPointerEcriture();
+void writePointerEcriture(uint16_t p);
+
+uint16_t readPointerLecture();
+void writePointerLecture(uint16_t p);
+
+/** Public Fonction*/
+
+void initEprom(I2C_HandleTypeDef typ, GPIO_TypeDef port, uint16_t pin);
+
+void writeData(uint16_t add, uint8_t *tab, uint8_t size);
+
+void readData(uint16_t add, uint8_t *tab, uint8_t size);
+
+void testEeprom(); //fonction pour tester le hard de l'Eeprom
+
+#endif /* EEPROM_H_ */

+ 40 - 0
Source/FIFO_COM.h

@@ -0,0 +1,40 @@
+/*
+ * FIFO_COM.h V1.0
+ *
+ *  Created on: 14 janv. 2019
+ *      Author: e_rcluze
+ */
+
+#ifndef _FIFO_COM_H_
+#define _FIFO_COM_H_
+
+// ne fonctionne pas a ne pas utiliser
+
+#include <stdint.h>
+
+#define NBFIFO 16*8 //Toujours un multiple de 8
+
+typedef struct{
+	uint8_t Fifo[NBFIFO];
+	uint8_t pt_read;
+	uint8_t pt_write;
+	uint8_t nb_Element;
+}FIFO_COM;
+
+
+void initFIFO(FIFO_COM *f);
+
+/*
+ * lit dans la fifo (toujours 8 caractere)
+ */
+void readFifo(FIFO_COM *f, uint8_t *r);
+
+void writeFifo(FIFO_COM *f, uint8_t *r);
+
+/*
+ * retourne le nombre d'element a lire dans la fifo
+ */
+uint8_t FIFO_nbRead(FIFO_COM *f);
+
+
+#endif /* _FIFO_COM_H_ */

+ 42 - 0
Source/Heure.h

@@ -0,0 +1,42 @@
+/*
+ * Heure.h V1.0
+ *
+ *  Created on: 14 mai 2019
+ *      Author: e_rcluze
+ */
+
+#ifndef HEURE_H_
+#define HEURE_H_
+
+#include <stdint.h>
+
+typedef struct {
+
+	uint8_t second;
+	uint8_t minute;
+	uint8_t heure;
+	uint8_t jour;
+	uint8_t joursemaine;
+	uint8_t mois;
+	uint16_t annee;
+
+} Date;
+
+typedef struct {
+	uint8_t minute;
+	uint8_t heure;
+} Heure;
+
+/**
+ * fonction qui renvoie
+ * 	-1 si h1 est inf�rieur que H2
+ * 	0 si h1 et h2 egale
+ * 	1 si h1 est sup�rieur a h2
+ */
+int8_t CompareHeure(Heure h1, Heure h2);
+
+int16_t DiffHeure(Heure h1, Heure h2);
+
+int32_t DiffDate(Date h1, Date h2);
+
+#endif /* HEURE_H_ */

+ 40 - 0
Source/PCF8574.h

@@ -0,0 +1,40 @@
+/*
+ * PCF8574.h V1.0
+ *
+ *  Created on: 14 mai 2019
+ *      Author: e_rcluze
+ */
+
+
+#ifndef _PCF8474__H_
+#define _PCF8474__H_
+
+#include "i2c.h"
+#include <stdint.h>
+
+
+
+I2C_HandleTypeDef *I2C_PCF8574;
+
+/** Private Fonction*/
+HAL_StatusTypeDef read_I2C_PCF8574(uint8_t add, uint8_t *tab);
+
+HAL_StatusTypeDef write_I2C_PCF8574(uint8_t addresse, uint8_t *tab);
+/** Public Fonction*/
+
+void initPCF8574(I2C_HandleTypeDef *typ);
+
+/*
+ * PAram addBit : la valeurs des bit A1 A2 A3:
+ * 	0 0 0 = 0;
+ * 	0 0 1 = 1;
+ * 	0 1 0 = 2;
+ * 	...
+ */
+HAL_StatusTypeDef Read_PCF8574(uint8_t addBit, uint8_t* val);
+HAL_StatusTypeDef Write_PCF8574(uint8_t addBit,uint8_t val);
+HAL_StatusTypeDef Write_One_Bit_PCF8574(uint8_t addBit, uint8_t val, uint8_t Local);
+
+
+
+#endif

+ 87 - 0
Source/RTC.h

@@ -0,0 +1,87 @@
+/*
+ * RTC.h V1.0
+ *
+ *  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 */