Eeprom.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Eeprom.h
  3. *
  4. * Created on: 14 janv. 2019
  5. * Author: e_rcluze
  6. *
  7. *Le fonctionement de l'Eeprom est en Fifo.
  8. *L'adrresse du pointeur de lecture est stocker dans les 16 premier byte de l'eeprom
  9. *L'adrresse du pointeur d'ecriture est stocker dans les 16 bit suivant
  10. *
  11. *
  12. *
  13. *
  14. */
  15. #ifndef EEPROM_H_
  16. #define EEPROM_H_
  17. #include <stdint.h>
  18. #include "i2c.h"
  19. #define EepromADD 0XA0
  20. typedef struct {
  21. I2C_HandleTypeDef I2C;
  22. GPIO_TypeDef WC_PORT;
  23. uint16_t WC_PIN;
  24. } EEprom_HandleTypeDef;
  25. EEprom_HandleTypeDef EEprom;
  26. /****Private fonction */
  27. void readEeprom(uint8_t *tab, int len);
  28. void writeEeprom(uint8_t *tab, int len);
  29. uint16_t readPointerEcriture();
  30. void writePointerEcriture(uint16_t p);
  31. uint16_t readPointerLecture();
  32. void writePointerLecture(uint16_t p);
  33. /** Public Fonction*/
  34. void initEprom(I2C_HandleTypeDef typ, GPIO_TypeDef port, uint16_t pin);
  35. void writeData(uint16_t add, uint8_t *tab, uint8_t size);
  36. void readData(uint16_t add, uint8_t *tab, uint8_t size);
  37. void testEeprom(); //fonction pour tester le hard de l'Eeprom
  38. #endif /* EEPROM_H_ */