【闸机】UID-教程篇

//原文地址:http://www.cnblogs.com/foxclever/p/Flash.html
#define SECTOR_SIZE           1024*128    //字节


//从指定地址开始读取多个数据
void FLASH_ReadMoreData(uint32_t startAddress,uint16_t *readData,uint16_t countToRead)
{
  uint16_t dataIndex;
  for(dataIndex=0;dataIndex<countToRead;dataIndex++)
  {
    readData[dataIndex]=FLASH_ReadHalfWord(startAddress+dataIndex*2);
  }
}

 

//读取指定地址的半字(16位数据)
uint16_t FLASH_ReadHalfWord(uint32_t address)
{
  return *(__IO uint16_t*)address;
}

 

//读取指定地址的全字(32位数据)
uint32_t FLASH_ReadWord(uint32_t address)
{
  uint32_t temp1,temp2;

  temp1=*(__IO uint16_t*)address;

  temp2=*(__IO uint16_t*)(address+2);

  return (temp2<<16)+temp1;

}

猜你喜欢

转载自blog.csdn.net/weixin_42381351/article/details/90071678