亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? spi_flash.c

?? stm32單片機的usb程序包
?? C
?? 第 1 頁 / 共 2 頁
字號:
        SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumByteToWrite);
      }
    }
    else /* NumByteToWrite > SPI_FLASH_PageSize */
    {
      NumByteToWrite -= count;
      NumOfPage =  NumByteToWrite / SPI_FLASH_PageSize;
      NumOfSingle = NumByteToWrite % SPI_FLASH_PageSize;
      
      SPI_FLASH_PageWrite(pBuffer, WriteAddr, count);
      WriteAddr +=  count;
      pBuffer += count;  
     
      while(NumOfPage--)
      {
        SPI_FLASH_PageWrite(pBuffer, WriteAddr, SPI_FLASH_PageSize);
        WriteAddr +=  SPI_FLASH_PageSize;
        pBuffer += SPI_FLASH_PageSize;
      }
      
      if(NumOfSingle != 0)
      {
        SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumOfSingle);
      }
    }
  }
}

/*******************************************************************************
* Function Name  : SPI_FLASH_BufferRead
* Description    : Reads a block of data from the FLASH.
* Input          : - pBuffer : pointer to the buffer that receives the data read 
*                    from the FLASH.
*                  - ReadAddr : FLASH's internal address to read from.
*                  - NumByteToRead : number of bytes to read from the FLASH.
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_FLASH_BufferRead(u8* pBuffer, u32 ReadAddr, u16 NumByteToRead)
{
  /* Select the FLASH: Chip Select low */
  SPI_FLASH_CS_LOW();
  
  /* Send "Read from Memory " instruction */
  SPI_FLASH_SendByte(READ);
  
  /* Send ReadAddr high nibble address byte to read from */
  SPI_FLASH_SendByte((ReadAddr & 0xFF0000) >> 16);
  /* Send ReadAddr medium nibble address byte to read from */
  SPI_FLASH_SendByte((ReadAddr& 0xFF00) >> 8);
  /* Send ReadAddr low nibble address byte to read from */
  SPI_FLASH_SendByte(ReadAddr & 0xFF);

  while(NumByteToRead--) /* while there is data to be read */
  {
    /* Read a byte from the FLASH */
    *pBuffer = SPI_FLASH_SendByte(Dummy_Byte);
    /* Point to the next location where the byte read will be saved */
    pBuffer++;
  }
  
  /* Deselect the FLASH: Chip Select high */
  SPI_FLASH_CS_HIGH();
}

/*******************************************************************************
* Function Name  : SPI_FLASH_ReadID
* Description    : Reads FLASH identification.
* Input          : None
* Output         : None
* Return         : FLASH identification
*******************************************************************************/
u32 SPI_FLASH_ReadID(void)
{
  u32 Temp = 0, Temp0 = 0, Temp1 = 0, Temp2 = 0;

  /* Select the FLASH: Chip Select low */
  SPI_FLASH_CS_LOW();
  
  /* Send "RDID " instruction */
  SPI_FLASH_SendByte(0x9F);

  /* Read a byte from the FLASH */
  Temp0 = SPI_FLASH_SendByte(Dummy_Byte);

  /* Read a byte from the FLASH */
  Temp1 = SPI_FLASH_SendByte(Dummy_Byte);

  /* Read a byte from the FLASH */
  Temp2 = SPI_FLASH_SendByte(Dummy_Byte);

  /* Deselect the FLASH: Chip Select high */
  SPI_FLASH_CS_HIGH();
         
  Temp = (Temp0 << 16) | (Temp1 << 8) | Temp2;

  return Temp;
}

/*******************************************************************************
* Function Name  : SPI_FLASH_StartReadSequence
* Description    : Initiates a read data byte (READ) sequence from the Flash.
*                  This is done by driving the /CS line low to select the device,
*                  then the READ instruction is transmitted followed by 3 bytes
*                  address. This function exit and keep the /CS line low, so the
*                  Flash still being selected. With this technique the whole
*                  content of the Flash is read with a single READ instruction.
* Input          : - ReadAddr : FLASH's internal address to read from.
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_FLASH_StartReadSequence(u32 ReadAddr)
{
  /* Select the FLASH: Chip Select low */
  SPI_FLASH_CS_LOW();
  
  /* Send "Read from Memory " instruction */
  SPI_FLASH_SendByte(READ);

/* Send the 24-bit address of the address to read from -----------------------*/  
  /* Send ReadAddr high nibble address byte */
  SPI_FLASH_SendByte((ReadAddr & 0xFF0000) >> 16);
  /* Send ReadAddr medium nibble address byte */
  SPI_FLASH_SendByte((ReadAddr& 0xFF00) >> 8);
  /* Send ReadAddr low nibble address byte */
  SPI_FLASH_SendByte(ReadAddr & 0xFF);
}

/*******************************************************************************
* Function Name  : SPI_FLASH_ReadByte
* Description    : Reads a byte from the SPI Flash.
*                  This function must be used only if the Start_Read_Sequence
*                  function has been previously called.
* Input          : None
* Output         : None
* Return         : Byte Read from the SPI Flash.
*******************************************************************************/
u8 SPI_FLASH_ReadByte(void)
{
  return (SPI_FLASH_SendByte(Dummy_Byte));
}

/*******************************************************************************
* Function Name  : SPI_FLASH_SendByte
* Description    : Sends a byte through the SPI interface and return the byte 
*                  received from the SPI bus.
* Input          : byte : byte to send.
* Output         : None
* Return         : The value of the received byte.
*******************************************************************************/
u8 SPI_FLASH_SendByte(u8 byte)
{
  /* Loop while DR register in not emplty */
  while(SPI_GetFlagStatus(SPI1, SPI_FLAG_TXE) == RESET);

  /* Send byte through the SPI1 peripheral */
  SPI_SendData(SPI1, byte);

  /* Wait to receive a byte */
  while(SPI_GetFlagStatus(SPI1, SPI_FLAG_RXNE) == RESET);

  /* Return the byte read from the SPI bus */
  return SPI_ReceiveData(SPI1);
}

/*******************************************************************************
* Function Name  : SPI_FLASH_SendHalfWord
* Description    : Sends a Half Word through the SPI interface and return the  
*                  Half Word received from the SPI bus.
* Input          : Half Word : Half Word to send.
* Output         : None
* Return         : The value of the received Half Word.
*******************************************************************************/
u16 SPI_FLASH_SendHalfWord(u16 HalfWord)
{
  /* Loop while DR register in not emplty */
  while(SPI_GetFlagStatus(SPI1, SPI_FLAG_TXE) == RESET);

  /* Send Half Word through the SPI1 peripheral */
  SPI_SendData(SPI1, HalfWord);

  /* Wait to receive a Half Word */
  while(SPI_GetFlagStatus(SPI1, SPI_FLAG_RXNE) == RESET);

  /* Return the Half Word read from the SPI bus */
  return SPI_ReceiveData(SPI1);
}

/*******************************************************************************
* Function Name  : SPI_FLASH_WriteEnable
* Description    : Enables the write access to the FLASH.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_FLASH_WriteEnable(void)
{
  /* Select the FLASH: Chip Select low */
  SPI_FLASH_CS_LOW();
  
  /* Send "Write Enable" instruction */
  SPI_FLASH_SendByte(WREN);
  
  /* Deselect the FLASH: Chip Select high */
  SPI_FLASH_CS_HIGH();
}

/*******************************************************************************
* Function Name  : SPI_FLASH_WaitForWriteEnd
* Description    : Polls the status of the Write In Progress (WIP) flag in the  
*                  FLASH's status  register  and  loop  until write  opertaion
*                  has completed.  
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_FLASH_WaitForWriteEnd(void)
{
  u8 FLASH_Status = 0;
  
  /* Select the FLASH: Chip Select low */
  SPI_FLASH_CS_LOW();
  
  /* Send "Read Status Register" instruction */
  SPI_FLASH_SendByte(RDSR);
  
  /* Loop as long as the memory is busy with a write cycle */
  do
  {
    /* Send a dummy byte to generate the clock needed by the FLASH 
    and put the value of the status register in FLASH_Status variable */
    FLASH_Status = SPI_FLASH_SendByte(Dummy_Byte);

  } while((FLASH_Status & WIP_Flag) == SET); /* Write in progress */

  /* Deselect the FLASH: Chip Select high */
  SPI_FLASH_CS_HIGH();
}

/******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区欧美| 国产成人精品三级| 成人一级黄色片| 欧美日韩综合不卡| 国产精品欧美一区喷水| 午夜精品福利在线| 成人午夜电影久久影院| 欧美人xxxx| 成人免费小视频| 国产一区二区三区免费| 日韩一区二区三区视频| 夜夜揉揉日日人人青青一国产精品 | www..com久久爱| 日韩精品中文字幕一区| 亚洲成人精品一区| 色婷婷综合激情| 国产精品久久一级| 成人手机电影网| 久久久久国产免费免费| 免费在线看一区| 欧美美女视频在线观看| 亚洲黄色av一区| 色噜噜狠狠成人中文综合| 国产精品久久久久久久岛一牛影视 | 久久久午夜精品理论片中文字幕| 亚洲一二三四久久| 欧美色图片你懂的| 一卡二卡三卡日韩欧美| 色偷偷88欧美精品久久久| 亚洲欧美日韩在线不卡| 91网站在线观看视频| 综合色天天鬼久久鬼色| av亚洲精华国产精华精华| 一色屋精品亚洲香蕉网站| 99视频一区二区| 一区二区三区四区不卡在线| 91国偷自产一区二区三区观看| 一区二区在线观看免费视频播放 | 国产又粗又猛又爽又黄91精品| 3d成人动漫网站| 午夜精品久久久久久久久 | 99久久久精品| 亚洲欧美一区二区三区国产精品 | 日韩欧美电影一区| 麻豆国产精品一区二区三区| 欧美一级黄色录像| 国产精品一区一区三区| 国产精品毛片无遮挡高清| av电影在线观看一区| 亚洲精品国产成人久久av盗摄 | 午夜视频在线观看一区二区| 欧美剧情电影在线观看完整版免费励志电影 | 久久久久久久久一| 高清视频一区二区| 亚洲欧美激情插| 欧美一区二区精美| 国产一区二区三区不卡在线观看 | caoporen国产精品视频| 一区二区三区在线影院| 69堂成人精品免费视频| 国产精品一线二线三线精华| 亚洲视频你懂的| 91精品福利在线一区二区三区 | 国产调教视频一区| 色婷婷激情综合| 老司机一区二区| 国产精品视频一二| 欧美一卡二卡三卡| av资源站一区| 久久99国产精品尤物| 亚洲蜜臀av乱码久久精品蜜桃| 欧美一区二区在线视频| aaa欧美色吧激情视频| 日韩av网站在线观看| 国产精品久久久久影院老司| 51精品秘密在线观看| 99精品视频一区二区| 久久精品二区亚洲w码| 亚洲精品免费在线播放| 久久久亚洲午夜电影| 欧美色爱综合网| 成人av网在线| 麻豆国产欧美一区二区三区| 亚洲精品中文字幕在线观看| 国产欧美精品区一区二区三区| 欧美日韩在线播放一区| 99久久精品一区| 精品一区二区三区在线播放| 亚洲午夜在线视频| 17c精品麻豆一区二区免费| 欧美成人一区二区三区片免费 | 久久伊人蜜桃av一区二区| 欧美午夜精品免费| 99国产一区二区三精品乱码| 国产综合成人久久大片91| 亚洲成av人片观看| 亚洲免费看黄网站| 国产精品国产精品国产专区不蜜 | 一区2区3区在线看| 中文字幕在线不卡视频| 国产三级精品在线| 337p日本欧洲亚洲大胆色噜噜| 欧美色图激情小说| 一本一本大道香蕉久在线精品| 国产黄人亚洲片| 国产美女视频一区| 国产乱子伦视频一区二区三区| 免费在线观看视频一区| 免费观看在线色综合| 日本大胆欧美人术艺术动态| 视频一区欧美精品| 丝袜亚洲另类欧美| 视频一区视频二区中文| 日韩va欧美va亚洲va久久| 日韩电影在线一区二区三区| 香蕉加勒比综合久久| 视频在线在亚洲| 免费观看日韩电影| 韩国成人精品a∨在线观看| 狠狠色综合日日| 国产美女精品在线| 国产91丝袜在线播放九色| 国产精品一区二区三区乱码| 成人做爰69片免费看网站| 成人av动漫在线| 色天使色偷偷av一区二区 | av一二三不卡影片| 91网上在线视频| 日本电影欧美片| 欧美日韩一区二区三区四区五区| 欧美精三区欧美精三区| 精品日韩一区二区三区免费视频| 久久综合狠狠综合久久综合88 | 337p粉嫩大胆噜噜噜噜噜91av| 精品国产1区二区| 国产欧美日韩综合精品一区二区| 中文字幕欧美激情| 亚洲精品高清在线观看| 日韩不卡一区二区| 国产成人自拍在线| 在线看国产一区二区| 日韩一区二区在线观看视频 | 亚洲人成在线观看一区二区| 亚洲尤物视频在线| 捆绑变态av一区二区三区 | 久久99国产精品麻豆| 国产91丝袜在线播放九色| 欧美亚洲丝袜传媒另类| 2019国产精品| 亚洲精品久久7777| 久久爱另类一区二区小说| 99在线精品一区二区三区| 欧美猛男gaygay网站| 欧美经典一区二区三区| 亚洲mv大片欧洲mv大片精品| 国产精品自拍一区| 欧美日韩久久久久久| 中文字幕+乱码+中文字幕一区| 性久久久久久久久久久久| 国产精品一二三| 777奇米成人网| 国产精品超碰97尤物18| 男男成人高潮片免费网站| av在线播放成人| 欧美不卡激情三级在线观看| 一区二区三区精品在线观看| 国产成人av资源| 欧美一区二区三区婷婷月色| 亚洲免费伊人电影| 国产不卡视频一区二区三区| 欧美一区二区视频观看视频| 亚洲精品视频一区二区| 国产高清一区日本| 日韩美女视频在线| 午夜婷婷国产麻豆精品| 91亚洲精品乱码久久久久久蜜桃 | 国产一区二区视频在线| 56国语精品自产拍在线观看| 日韩一区欧美小说| 成人一区二区三区视频| 精品国产一区久久| 日韩精品每日更新| 欧美中文字幕一区二区三区亚洲| 国产精品久久久久影院亚瑟 | 久久99精品国产.久久久久久| 欧美午夜免费电影| 亚洲免费观看高清| 91麻豆产精品久久久久久 | 国产亚洲污的网站| 麻豆一区二区三区| 欧美日韩成人高清| 视频一区中文字幕| 5566中文字幕一区二区电影 | 亚洲一区在线电影| 91视频在线看| 怡红院av一区二区三区| 91国偷自产一区二区开放时间 | 91麻豆.com| 亚洲三级在线免费观看| 成人18精品视频|