forked from SZV10X_Software/SZV103_FM33A0xxEV_SiZhu

wujiazhi
2024-06-13 72def895431ad7a08e635b11f3da738e2b2c4618
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef __FM25V02_H
#define __FM25V02_H     
#include "define_all.h" 
 
//op cmd
#define FM_WREN       0x06      //write enable
#define FM_WRDI       0x04      //write disable
#define FM_RDSR       0x05      //read  status register
#define FM_WRSR       0x01      //write status register
#define FM_READ       0x03      //read  fram memory data
#define FM_FSTRD      0x0b      //fast  read  fram memory data
#define FM_WRITE      0x02      //write fram memory data
#define FM_SLEEP      0xb9      //go to sleep mode
#define FM_RDID       0x9f      //read  fram ID:9 bytes
 
 
#define  FM25V02_CS_LOW       GPIO_ResetBits(GPIOA,GPIO_Pin_15)//CS = 0
#define  FM25V02_CS_HIGH      GPIO_SetBits(GPIOA,GPIO_Pin_15)  //CS = 1
 
 
#define    FM_ReadWriteByte(dat) SPI3_ReadWriteByte(dat)
#define FM25V02_ioconfig()    SPI3_ioconfig()
 
 
typedef union 
{
    double     dou;
    uint8        data[8];
}double_un; 
 
typedef union 
{
    float     flo;
    uint8    data[4];
}float_un;
 
 
typedef union 
{
  uint32     uio;
    uint8    data[4];
}u32_un;
 
typedef union 
{
  uint16     uso;
    uint8    data[2];
}u16_un;
 
 
u8      EEPROM_MultipleWrite(u8 *data,u32 addr,u16 bytes);
void     EEPROM_MultipleRead(u8 *data, u32 addr, u16 bytes);
void     EEPROM_MultipleRead_Continue(u8 *data, u32 addr, u16 bytes);
 
void  FM25V02_data_write(uint8 data,u32 addr16);
uint8 FM25V02_data_read(uint32 addr16); 
void  FM25V02_stat_write(uint8 stat);
uint8 FM25V02_stat_read(void); 
void  FM25V02_sleep(void); 
void  FM25V02_ID_read(uint8 *dst);
float FM25V02_data_read_float(uint32 addr16);
void FM25V02_data_write_float(uint32 addr16, float data);
double FM25V02_data_read_double(uint32 addr16);
void FM25V02_data_write_double(uint32 addr16, double data);
u32 FM25V02_data_read_uint32(uint32 addr16);
u32 FM25V02_data_read_uint32_Check(uint32 addr16) ;
void FM25V02_data_write_uint32(uint32 addr16, uint32 data);
void FM25V02_data_write_uint32_WRCheck(uint32 addr16, uint32 data);
u16 FM25V02_data_read_uint16(uint32 addr16);
void FM25V02_data_write_uint16(uint32 addr16, uint16 data);
 
 
#endif