GeekIMU/2.Firmware/STM32/Firmware/driver/stmflash.h

42 lines
995 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef __STMFLASH_H__
#define __STMFLASH_H__
#include "sys.h"
//用户根据自己的需要设置
#define STM32_FLASH_SIZE 64 //所选STM32的FLASH容量大小(单位为K)
#define STM32_FLASH_WREN 1 //使能FLASH写入(0不是能;1使能)
/*STM32 FLASH的起始地址*/
#define STM32_FLASH_BASE 0x08000000
/*Laputa存储陀螺仪零偏的地址*/
#define FLASH_SAVE_ADDR 0X0800FF00
/****************************************STM32 EEPROM读写库函数****************************************/
u16 STMFLASH_ReadHalfWord(u32 faddr); //读出半字
void STMFLASH_WriteLenByte(u32 WriteAddr,u32 DataToWrite,u16 Len); //指定地址开始写入指定长度的数据
u32 STMFLASH_ReadLenByte(u32 ReadAddr,u16 Len); //指定地址开始读取指定长度数据
void STMFLASH_Write(u32 WriteAddr,u16 *pBuffer,u16 NumToWrite); //从指定地址开始写入指定长度的数据
void STMFLASH_Read(u32 ReadAddr,u16 *pBuffer,u16 NumToRead); //从指定地址开始读出指定长度的数据
#endif