w25x20cl.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //w25x20cl.h
  2. #ifndef _W25X20CL_H
  3. #define _W25X20CL_H
  4. #include <inttypes.h>
  5. #include "config.h"
  6. #include "spi.h"
  7. #define W25X20CL_STATUS_BUSY 0x01
  8. #define W25X20CL_STATUS_WEL 0x02
  9. #define W25X20CL_STATUS_BP0 0x04
  10. #define W25X20CL_STATUS_BP1 0x08
  11. #define W25X20CL_STATUS_TB 0x20
  12. #define W25X20CL_STATUS_SRP 0x80
  13. #define W25X20CL_SPI_ENTER() spi_setup(W25X20CL_SPCR, W25X20CL_SPSR)
  14. #if defined(__cplusplus)
  15. extern "C" {
  16. #endif //defined(__cplusplus)
  17. extern int8_t w25x20cl_init(void);
  18. extern void w25x20cl_enable_wr(void);
  19. extern void w25x20cl_disable_wr(void);
  20. extern uint8_t w25x20cl_rd_status_reg(void);
  21. extern void w25x20cl_wr_status_reg(uint8_t val);
  22. extern void w25x20cl_rd_data(uint32_t addr, uint8_t* data, uint16_t cnt);
  23. extern void w25x20cl_page_program(uint32_t addr, uint8_t* data, uint16_t cnt);
  24. extern void w25x20cl_page_program_P(uint32_t addr, uint8_t* data, uint16_t cnt);
  25. extern void w25x20cl_sector_erase(uint32_t addr);
  26. extern void w25x20cl_block32_erase(uint32_t addr);
  27. extern void w25x20cl_block64_erase(uint32_t addr);
  28. extern void w25x20cl_chip_erase(void);
  29. extern void w25x20cl_rd_uid(uint8_t* uid);
  30. #if defined(__cplusplus)
  31. }
  32. #endif //defined(__cplusplus)
  33. #endif //_W25X20CL_H