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

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

?? spi_flash.c

?? STM32F10x USB Library V1.0
?? 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一区二区三区免费野_久草精品视频
一本大道久久a久久精品综合| 精品国产成人在线影院 | 夜夜精品浪潮av一区二区三区| 麻豆一区二区在线| 日韩一区二区在线观看| 久久精品国产在热久久| 精品国产一区a| 成人综合婷婷国产精品久久免费| 国产亚洲欧洲一区高清在线观看| 久久99久久99| 一区二区三区成人在线视频| 欧美日韩五月天| 久久丁香综合五月国产三级网站| 亚洲男人的天堂在线观看| 粉嫩绯色av一区二区在线观看| 亚洲不卡在线观看| 欧美日韩在线综合| 日韩在线一二三区| 26uuu欧美| 成人永久aaa| 亚洲国产aⅴ成人精品无吗| 精品视频一区二区三区免费| 丝袜美腿一区二区三区| 欧美激情艳妇裸体舞| 91亚洲男人天堂| 久久成人免费电影| 综合激情网...| 欧美一区二区视频免费观看| 国产一区二区美女| 亚洲综合色视频| 国产三级精品视频| 日韩片之四级片| 91美女片黄在线观看| 国产精品1区二区.| 日本午夜一本久久久综合| 亚洲精品免费播放| 日韩一区欧美小说| 亚洲乱码一区二区三区在线观看| 久久久www成人免费毛片麻豆 | 91精品国产综合久久精品| 精品一区二区三区蜜桃| 秋霞午夜鲁丝一区二区老狼| 亚洲综合色在线| 香蕉影视欧美成人| 亚洲成a天堂v人片| 日日夜夜精品视频免费| 午夜精品影院在线观看| 亚洲小说欧美激情另类| 亚洲国产日韩一级| 奇米影视一区二区三区| 欧美aa在线视频| 久久国产夜色精品鲁鲁99| 久久99精品久久只有精品| 国产精品一级黄| av在线一区二区| 欧美羞羞免费网站| 884aa四虎影成人精品一区| 欧美一区二区在线免费观看| 精品毛片乱码1区2区3区| 中文字幕av不卡| 一区二区三区av电影| 人人超碰91尤物精品国产| 久久97超碰色| 色悠久久久久综合欧美99| 欧美性大战久久久久久久| 欧美videos大乳护士334| 久久久久久久一区| 国产精品一区二区久激情瑜伽| 成人高清在线视频| 日韩精品一区二区三区老鸭窝| 欧美激情一区二区三区蜜桃视频| 亚洲另类在线视频| 欧美在线一二三四区| 国产日韩欧美不卡| 久久国产尿小便嘘嘘| 在线免费观看日韩欧美| 国产网站一区二区| 日本人妖一区二区| 欧美亚洲禁片免费| 国产精品久久久久久久久搜平片 | www.日韩大片| 亚洲精品一区二区三区在线观看 | 视频一区二区三区在线| 97超碰欧美中文字幕| 中文字幕高清一区| 国产精品99久久久久久久女警| 日韩一区二区三区在线观看| 亚洲国产aⅴ天堂久久| 色哟哟亚洲精品| 亚洲欧洲精品天堂一级| 成人免费视频国产在线观看| 久久久久久久久99精品| 九一久久久久久| 精品少妇一区二区三区在线播放| 日日夜夜一区二区| 日韩一区二区在线看| 色欧美88888久久久久久影院| 中文字幕亚洲视频| 91福利在线免费观看| 亚洲大片精品永久免费| 欧美日韩精品一二三区| 精品一区二区三区香蕉蜜桃| 精品国产免费人成在线观看| 国产精品主播直播| 亚洲激情自拍偷拍| 欧美日韩一区 二区 三区 久久精品 | 奇米四色…亚洲| 久久久久久夜精品精品免费| 成人免费视频网站在线观看| 一区二区免费看| 91精品国产品国语在线不卡| 国产在线日韩欧美| 夜夜嗨av一区二区三区| 精品久久久久久久久久久久久久久| 狠狠色丁香婷婷综合久久片| 中文字幕一区在线观看| 欧美一区二区三区视频免费| 国产成人免费在线观看| 午夜不卡av免费| 亚洲视频一二三| 日韩精品专区在线| 欧美在线观看18| 成人晚上爱看视频| 久久99精品国产麻豆不卡| 亚洲综合999| 日韩理论片中文av| 久久亚洲春色中文字幕久久久| 欧美私人免费视频| 99天天综合性| 91女人视频在线观看| 成人av电影观看| 成人免费毛片app| 国产又黄又大久久| 麻豆精品国产传媒mv男同| 午夜影院久久久| 亚洲国产精品一区二区www在线 | 国产一区视频导航| 麻豆91精品视频| 日本欧美一区二区| 日韩专区一卡二卡| 午夜精品aaa| 婷婷开心久久网| 亚洲国产精品一区二区久久恐怖片 | 亚洲一区免费视频| 亚洲电影你懂得| 天天综合天天做天天综合| 亚洲国产日韩精品| 亚洲成a人片在线观看中文| 亚洲高清视频在线| 天堂久久久久va久久久久| 丝袜诱惑亚洲看片| 久久99精品一区二区三区三区| 美女一区二区三区| 国产乱码精品一区二区三区忘忧草| 国产福利一区二区三区视频在线| 国产一区二区免费看| 91免费视频大全| 欧美亚洲图片小说| 欧美成人艳星乳罩| 国产精品黄色在线观看| 午夜精品久久久久久久久久久| 免费精品99久久国产综合精品| 狠狠狠色丁香婷婷综合激情 | 日韩高清欧美激情| 国产成人午夜99999| 色94色欧美sute亚洲线路二 | 欧美日韩国产大片| 欧美国产视频在线| 免费观看在线综合色| av中文字幕不卡| 精品成人在线观看| 亚洲午夜精品17c| 国产精品99久久久久久久vr| 欧美在线视频全部完| 中文字幕欧美日韩一区| 久久成人羞羞网站| 51久久夜色精品国产麻豆| 亚洲天堂2016| 成人自拍视频在线| 精品久久久久久久久久久院品网| 一区二区高清在线| 不卡高清视频专区| 国产欧美日韩视频在线观看| 青青草97国产精品免费观看 | 国产精品久久免费看| 九一九一国产精品| 日韩欧美高清在线| 日本强好片久久久久久aaa| 欧美日韩成人一区| 琪琪久久久久日韩精品| 这里只有精品视频在线观看| 亚洲制服丝袜av| 在线观看亚洲一区| 一区二区三区不卡视频在线观看| 91视频精品在这里| 亚洲最大成人综合| 69精品人人人人| 国产精品996| 国产精品久久久久久久午夜片| 99久免费精品视频在线观看|