forked from prusa3d/Prusa-Firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathw25x20cl.h
44 lines (35 loc) · 1.31 KB
/
w25x20cl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//w25x20cl.h
#ifndef _W25X20CL_H
#define _W25X20CL_H
#include <inttypes.h>
#include "config.h"
#include "spi.h"
#define W25X20CL_STATUS_BUSY 0x01
#define W25X20CL_STATUS_WEL 0x02
#define W25X20CL_STATUS_BP0 0x04
#define W25X20CL_STATUS_BP1 0x08
#define W25X20CL_STATUS_TB 0x20
#define W25X20CL_STATUS_SRP 0x80
#define W25X20CL_SPI_ENTER() spi_setup(W25X20CL_SPCR, W25X20CL_SPSR)
#if defined(__cplusplus)
extern "C" {
#endif //defined(__cplusplus)
extern int8_t w25x20cl_init(void);
extern void w25x20cl_enable_wr(void);
extern void w25x20cl_disable_wr(void);
extern uint8_t w25x20cl_rd_status_reg(void);
extern void w25x20cl_wr_status_reg(uint8_t val);
extern void w25x20cl_rd_data(uint32_t addr, uint8_t* data, uint16_t cnt);
extern void w25x20cl_page_program(uint32_t addr, uint8_t* data, uint16_t cnt);
extern void w25x20cl_page_program_P(uint32_t addr, uint8_t* data, uint16_t cnt);
extern void w25x20cl_sector_erase(uint32_t addr);
extern void w25x20cl_block32_erase(uint32_t addr);
extern void w25x20cl_block64_erase(uint32_t addr);
extern void w25x20cl_chip_erase(void);
extern void w25x20cl_page_program(uint32_t addr, uint8_t* data, uint16_t cnt);
extern void w25x20cl_rd_uid(uint8_t* uid);
extern void w25x20cl_wait_busy(void);
#if defined(__cplusplus)
}
#endif //defined(__cplusplus)
#endif //_W25X20CL_H