TestEeprom.c 613 B

123456789101112131415161718192021222324252627
  1. #include "i2c.h"
  2. #include "gpio.h"
  3. #include <stdint.h>
  4. #include <TestEeprom.h>
  5. void testecr(){
  6. uint16_t add= EepromADD;
  7. uint8_t tab[3];
  8. tab[0]=0x00;
  9. tab[1]=0x00;
  10. tab[2]=0XAA;
  11. HAL_StatusTypeDef res;
  12. HAL_GPIO_WritePin(WC_GPIO_Port,WC_Pin,0);
  13. res = HAL_I2C_Master_Transmit(&hi2c3,add,tab,3,1000);
  14. }
  15. void testlec(){
  16. uint16_t add= EepromADD;
  17. uint8_t tab[2];
  18. tab[0]=0x00;
  19. tab[1]=0x00;
  20. uint8_t lec;
  21. HAL_StatusTypeDef res;
  22. HAL_GPIO_WritePin(WC_GPIO_Port,WC_Pin,1);
  23. res = HAL_I2C_Master_Transmit(&hi2c3,add,tab,2,1000);
  24. res = HAL_I2C_Master_Receive(&hi2c2,add,&lec,1,1000);
  25. }