“SPIFlash库”的版本间的差异

来自YFRobotwiki
跳转至: 导航搜索
(以“ {| border="0" cellpadding="10" width="100%" |- |width="30%" valign="top" align="left"| SPIFlash库 -- SPI华邦电子闪存Flash芯片arduino库 GITHUB 工程地...”为内容创建页面)
 
 
(未显示1个用户的11个中间版本)
第1行: 第1行:
 +
 +
 +
'''小编奋力编辑中....'''
  
  
 
{| border="0" cellpadding="10" width="100%"
 
{| border="0" cellpadding="10" width="100%"
 
|-
 
|-
|width="30%" valign="top" align="left"|
+
|width="100%" valign="top" align="left"|
 
+
'''SPIFlash库''' -- SPI华邦电子闪存Flash芯片arduino库
SPIFlash库 -- SPI华邦电子闪存Flash芯片arduino库
+
 
GITHUB 工程地址:[https://github.com/Marzogh/SPIFlash  SPIFlash]
 
GITHUB 工程地址:[https://github.com/Marzogh/SPIFlash  SPIFlash]
  
 该库是用于华邦串行闪存芯片的库。
+
 该库是用于华邦串行闪存芯片的库。 目前的形式 支持 识别闪存芯片和它的各种功能;自动地址分配管理;在不同位置读写数据类型bytes/chars/ints/longs/floats/Strings;读写页面字节;连续读写字节/字符数组;扇区,块或整个芯片的擦除,关闭低功率操作。
 
+
支持 设备
+
 
+
'''DS1307''' 
+
  
Full support including squarewave output pin and memory access --  全部功能 持,包括方波输出和内存访问  
+
 支 持arduino IDE 版本:
 +
* IDE v1.5.x
 +
* IDE v1.6.0-v1.6.5
 +
* IDE v1.6.9-v1.6.11
  
'''DS3231'''  
+
 支持 控制板:
 
+
* Arduino Uno
Full support including squarewave output pin and alarms.  --  全部功能 支持 ,包括方波输出和闹钟  
+
* Arduino Leonardo
 +
* Arduino Micro
 +
* Arduino Fio
 +
* Arduino Mega
 +
* Arduino Due
 +
* ESP8266 (On the Arduino IDE)
 +
* ATTiny85
 +
   
  
  
第24行: 第32行:
  
  
:-[[ DS1307_Memory]]: This demonstrates how to write and read data from the extended memory of the deviceThis memory is retained even after the device has lost power./演示如何读写数据从设备的扩展内存。即使设备掉电内存依然保存
+
:-[[ Diagnostics]]: For a full diagnostics rundown - with error codes and details of the errors./有关完整诊断程序 - 包含错误代码和错误详细信息
  
:-[[ DS1307_Simple]]: This demonstrates how to set and get the date and time from the device./ 演示了如何在设备上设 和获 日期和时间 
+
:-[[ Struct_writer]]: This program writes a struct to a random location on your flash memory chip and reads it back./ 这个程序写一个struct到闪存芯片的随机位 然后读 它。 
  
:-[[ DS3231_Alarms]]: This demonstrates how to set the alarms and check when the alarms are triggered.  This includes using the squarewave output to trigger an interrupt./演示 如何设置闹钟和检查何时触发闹钟。这包含使用方波输出触发一个中断
+
:-[[ TestFlash]]: The Test program show all most function./ 测试程序 演示 大部分功能函数
  
:-[[ DS3231_Simple]]: This demonstrates how to set and get the date and time from the device./演示 如何在设备上设 和获取日期和时间
+
:-[[ getAddressEx]]: This program shows the method to use the getAddress() function to automate the process of address allocation when using a flash memory module. Please note the special function used to get the size of the String object./ 这个程序 演示 了使用getAddress()函数自动地址配 的过程在使用闪存模块。 请注意特殊函数使用字符串对象的大小。
 +
  
:-[[ DS3231_StoreIt]]: This demonstrates how to turn off the Rtc clock so that the onboard battery will last longer./演示 如何关闭RTC时钟以 证板载电池能持续更长时间
+
:-[[ readWriteString]]: This program shows the method of reading a string from the console and saving it to flash memory./ 这个程序 演示 了阅读一个字符串从控制台并 存到闪存
  
|width="10%" valign="top" align="left"|
+
|width="0%" valign="top" align="left"|
 
<!-- 空白 -->
 
<!-- 空白 -->
 +
|}
  
|width="30%" valign="top" align="left"|
+
{| border="0" cellpadding="10" width="100%"
<br><br><br>
+
|-
 +
|width="100%" valign="top" align="left"|
 +
<font color="orange" size="+2">'''SPIFlash'''</font><br>
  
<font color="orange" size="+2">'''DS1307'''</font><br>
+
'''SPIFlash 函数。'''
  
'''DS1307 函数。'''
+
|}
  
:- <font color="forestgreen">Begin()</font> -- 初始化
+
{| border="0" cellpadding="10" width="100%"
 +
|-
 +
|width="50%" valign="top" align="left"|
 +
 
 +
:- <font color="forestgreen">begin()</font> -- 初始化
 
::参数:无
 
::参数:无
 
::返回:无
 
::返回:无
  
:-[[RtcDS1307.GetIsRunning()| GetIsRunning()]]
+
:- <font color="forestgreen">error()</font>  -- 检查错误
 +
::参数:无
 +
::返回:uint8_t
  
:-[[RtcDS1307.SetIsRunning()| SetIsRunning()]]
+
:- <font color="forestgreen">getCapacity()</font>  -- 获取芯片容量
 +
::参数:无
 +
::返回:uint32_t
  
:-[[RtcDS1307.SetDateTime()| SetDateTime()]]
+
:- <font color="forestgreen">getMaxPage()</font>  -- 获取最大页数
 +
::参数:无
 +
::返回:uint32_t
  
:-[[RtcDS1307.GetDateTime()| GetDateTime()]]
+
:- <font color="forestgreen">getChipName()</font>  -- 获取芯片识别名称
 +
::参数:无
 +
::返回:uint16_t
  
:-[[RtcDS1307.SetMemory()| SetMemory()]]
 
  
:-[[RtcDS1307.GetMemory()| GetMemory()]]
+
:- <font color="forestgreen">getManID()</font>  -- 检查和启动芯片并获取16位int型制造商ID
 +
::参数:无
 +
::返回:uint16_t
  
:-[[RtcDS1307.SetSquareWavePin()| SetSquareWavePin()]]
+
:- <font color="forestgreen">getJEDECID()</font>  -- 检查和启动芯片并获取32位int型 JEDEC ID
 +
::参数:无
 +
::返回:uint32_t
  
<br><br>
 
<font color="orange" size="+2">'''DS3231'''</font><br>
 
  
'''DS3231 函数'''
+
-- 获取下一个可用地址使用:
 +
--    A.以数据的大小作为参数,并返回一个32位的地址
 +
--    B.3个参数,数据大小、页数及位置
 +
--  所有地址的素描必须获得通过该 函数 或不
 +
:- <font color="forestgreen">getAddress(uint16_t size)</font>  -- A
 +
::参数:size - 数据大小
 +
::返回:uint32_t
  
:- <font color="forestgreen">Begin()</font> -- 初始化
+
:- <font color="forestgreen">getAddress(uint16_t size, uint16_t &page_number, uint8_t &offset)</font> -- B
::参数:
+
::参数:
::返回 :无
+
:::* size -
 +
:::* &page_number -
 +
:::* &offset -
 +
::返回 :bool
  
:-<font color="forestgreen">IsDateTimeValid()</font>  --  检查日期时间是否有效
+
:- <font color="forestgreen">sizeofStr(String &inputStr)</font>  --  函数返回字符串的大小(仅用于getAddress()函数)
::参数:
+
::参数:inputStr - 字符串
 +
::返回:uint16_t
 +
 
 +
 
 +
-- 从一个页面的特定位置读一个<font color="red">字节</font>的数据
 +
--    A & B
 +
:- <font color="forestgreen">readByte(uint32_t address, bool fastRead)</font>  -- A
 +
::参数:
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回:uint8_t
 +
 
 +
:- <font color="forestgreen">readByte(uint16_t page_number, uint8_t offset, bool fastRead)</font>  -- B
 +
::参数:
 +
:::* page_number - 页数(0-最大页数)
 +
:::* offset - 页面中的地址(0-255)
 +
:::* fastRead -  默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回:uint8_t
 +
 
 +
 
 +
-- 从一个页面的特定位置读一个<font color="red">字符</font>的数据
 +
--    A & B
 +
:- <font color="forestgreen">readChar(uint32_t address, bool fastRead)</font>  -- A
 +
::参数:
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回:int8_t
 +
 
 +
:- <font color="forestgreen">readChar(uint16_t page_number, uint8_t offset, bool fastRead)</font>  -- B
 +
::参数:
 +
:::* page_number - 页数(0-最大页数)
 +
:::* offset - 页面中的地址(0-255)
 +
:::* fastRead -  默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回:int8_t
 +
 
 +
 
 +
-- 从一个页面的特定位置读一个<font color="red">字节数组</font>的数据
 +
--    A & B
 +
:- <font color="forestgreen">readByteArray(uint32_t address, uint8_t *data_buffer, uint16_t bufferSize, bool fastRead)</font>  -- A
 +
::参数:
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* data_buffer - 读取的数据
 +
:::* bufferSize - 读取数据大小
 +
:::* fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
 
::返回:bool
 
::返回:bool
  
:-[[RtcDS3231.GetIsRunning()| GetIsRunning()]]
+
:- <font color="forestgreen">readByteArray(uint16_t page_number, uint8_t offset, uint8_t *data_buffer, uint16_t bufferSize, bool fastRead)</font>  -- B
 +
::参数:
 +
:::* page_number - 页数(0-最大页数)
 +
:::* offset - 页面中的地址(0-255)
 +
:::* data_buffer - 读取的数据
 +
:::* bufferSize - 读取数据大小
 +
:::* fastRead -  默认为false( 如果设置为true将执行 _beginFastRead()
 +
::返回:bool
  
:-[[RtcDS3231.SetIsRunning()| SetIsRunning()]]
 
  
:-<font color="forestgreen">SetDateTime()</font>  -- 设置日期时间
+
-- 从一个页面的特定位置读一个<font color="red">字符数组</font>的数据
::参数 :const RtcDateTime& dt
+
--    A & B
::返回 :无
+
:- <font color="forestgreen">readCharArray(uint32_t address, uint8_t *data_buffer, uint16_t bufferSize, bool fastRead)</font>  -- A
 +
::参数
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* data_buffer - 读取的数据
 +
:::* bufferSize - 读取数据大小
 +
:::* fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回 :bool
  
:-<font color="forestgreen">GetDateTime()</font>  -- 获取日期时间
+
:- <font color="forestgreen">readCharArray(uint16_t page_number, uint8_t offset, uint8_t *data_buffer, uint16_t bufferSize, bool fastRead)</font>  -- B
::参数:
+
::参数:
::返回 :RtcDateTime
+
:::* page_number - 页数(0-最大页数)
 +
:::* offset - 页面中的地址(0-255)
 +
:::* data_buffer - 读取的数据
 +
:::* bufferSize - 读取数据大小
 +
:::* fastRead -  默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回 :bool
  
:-<font color="forestgreen">GetTemperature()</font>  -- 获取温度
 
::参数:无
 
::返回:RtcTemperature
 
  
:-<font color="forestgreen">Enable32kHzPin()</font>  -- 使能32KHZ引脚
+
-- 从一个页面的特定位置读一个<font color="red">无符号整型(unsigned int)</font>数据
::参数 :bool enable
+
--    A & B
::返回 :无
+
:- <font color="forestgreen">readWord(uint32_t address, bool fastRead)</font>  -- A
 +
::参数
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回 :uint16_t
  
:-<font color="forestgreen">SetSquareWavePin()</font>  -- 设置方波输出引脚
+
:- <font color="forestgreen">readWord(uint16_t page_number, uint8_t offset, bool fastRead)</font>  -- B
::参数 :DS3231SquareWavePinMode pinMode
+
::参数
<pre>
+
:::* page_number - 页数(0-最大页数)
    enum DS3231SquareWavePinMode{
+
:::* offset - 页面中的地址(0-255)
        DS3231SquareWavePin_ModeNone,
+
:::* fastRead -  默认为false( 如果设置为true将执行 _beginFastRead() )
        DS3231SquareWavePin_ModeBatteryBackup,
+
::返回 :uint16_t
        DS3231SquareWavePin_ModeClock,
+
        DS3231SquareWavePin_ModeAlarmOne,
+
        DS3231SquareWavePin_ModeAlarmTwo,
+
        DS3231SquareWavePin_ModeAlarmBoth
+
    }
+
</pre>
+
::返回 :无
+
  
:-<font color="forestgreen">SetSquareWavePinClockFrequency()</font>  -- 设置方波输出引脚时钟频率
 
::参数:DS3231SquareWaveClock freq
 
::返回:无
 
  
:-<font color="forestgreen">SetAlarmOne()</font>  -- 设置闹钟1
+
-- 从一个页面的特定位置读一个<font color="red">整型(int)</font>数据
::参数 :const DS3231AlarmOne& alarm
+
--    A & B
::返回 :无
+
:- <font color="forestgreen">readShort(uint32_t address, bool fastRead)</font>  -- A
 +
::参数
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回 :int16_t
  
:-<font color="forestgreen">SetAlarmTwo()</font>  -- 设置闹钟2
+
:- <font color="forestgreen">readShort(uint16_t page_number, uint8_t offset, bool fastRead)</font>  -- B
::参数 :const DS3231AlarmTwo& alarm
+
::参数
::返回 :无
+
:::* page_number - 页数(0-最大页数)
 +
:::* offset - 页面中的地址(0-255)
 +
:::* fastRead -  默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回 :int16_t
  
:-<font color="forestgreen">GetAlarmOne()</font>  -- 获取闹钟1
 
::参数:无
 
::返回:DS3231AlarmOne
 
  
:-<font color="forestgreen">GetAlarmTwo()</font>  --  获取闹钟2
+
-- 从一个页面的特定位置读一个<font color="red">无符号长整型(unsigned long)</font>数据
 +
--    A & B
 +
:- <font color="forestgreen">readULong(uint32_t address, bool fastRead)</font>  -- A
 +
::参数:
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回:uint32_t
 +
 
 +
:- <font color="forestgreen">readULong(uint16_t page_number, uint8_t offset, bool fastRead)</font>  -- B
 +
::参数:
 +
:::* page_number - 页数(0-最大页数)
 +
:::* offset - 页面中的地址(0-255)
 +
:::* fastRead -  默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回:uint32_t
 +
 
 +
 
 +
-- 从一个页面的特定位置读一个<font color="red">长整型(long)</font>数据
 +
--    A & B
 +
:- <font color="forestgreen">readLong(uint32_t address, bool fastRead)</font>  -- A
 +
::参数:
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回:int32_t
 +
 
 +
:- <font color="forestgreen">readLong(uint16_t page_number, uint8_t offset, bool fastRead)</font>  -- B
 +
::参数:
 +
:::* page_number - 页数(0-最大页数)
 +
:::* offset - 页面中的地址(0-255)
 +
:::* fastRead -  默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回:int32_t
 +
 
 +
 
 +
-- 从一个页面的特定位置读一个<font color="red">浮点(float)</font>数据 ??
 +
--    A & B
 +
:- <font color="forestgreen">readFloat(uint32_t address, bool fastRead)</font>  -- A
 +
::参数:
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回:float
 +
 
 +
:- <font color="forestgreen">readFloat(uint16_t page_number, uint8_t offset, bool fastRead)</font>  -- B
 +
::参数:
 +
:::* page_number - 页数(0-最大页数)
 +
:::* offset - 页面中的地址(0-255)
 +
:::* fastRead -  默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回:float
 +
 
 +
 
 +
-- 从一个页面的特定位置读一个<font color="red">字符串(string)</font>数据
 +
--    A & B
 +
:- <font color="forestgreen">readStr(uint32_t address, String &outStr, bool fastRead)</font>  -- A
 +
::参数:
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* outputString --> 字符串
 +
:::* fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回:bool
 +
 
 +
:- <font color="forestgreen">readStr(uint16_t page_number, uint8_t offset, String &outStr, bool fastRead)</font>  -- B
 +
::参数:
 +
:::* page_number - 页数(0-最大页数)
 +
:::* offset - 页面中的地址(0-255)
 +
:::* outputString --> 字符串
 +
:::* fastRead -  默认为false( 如果设置为true将执行 _beginFastRead() )
 +
::返回:bool
 +
 
 +
 
 +
-- 写一个<font color="red">字节(byte)</font>数据到一个页面的特定位置
 +
--    A & B
 +
--  提示:写数据之前需要清除存储位置
 +
:- <font color="forestgreen">writeByte(uint32_t address, uint8_t data, bool errorCheck)</font>  -- A
 +
::参数:
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* data - 写入的数据(0-255)
 +
:::* errorCheck - 默认true,检查是否写入
 +
::返回:bool
 +
 
 +
:- <font color="forestgreen">writeByte(uint16_t page_number, uint8_t offset, uint8_t data, bool errorCheck)</font>  -- B
 +
::参数:
 +
:::* page_number - 页数(0-最大页数)
 +
:::* offset - 页面中的地址(0-255)
 +
:::* data - 写入的数据(0-255)
 +
:::* errorCheck - 默认true,检查是否写入
 +
::返回:bool
 +
 
 +
 
 +
-- 写一个<font color="red">字符(char)</font>数据到一个页面的特定位置
 +
--    A & B
 +
--  提示:写数据之前需要清除存储位置
 +
:- <font color="forestgreen">writeChar(uint32_t address, int8_t data, bool errorCheck)</font>  -- A
 +
::参数:
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* data - 写入的数据(0-255)
 +
:::* errorCheck - 默认true,检查是否写入
 +
::返回:bool
 +
 
 +
:- <font color="forestgreen">writeChar(uint16_t page_number, uint8_t offset, int8_t data, bool errorCheck)</font>  -- B
 +
::参数:
 +
:::* page_number - 页数(0-最大页数)
 +
:::* offset - 页面中的地址(0-255)
 +
:::* data - 写入的数据(0-255)
 +
:::* errorCheck - 默认true,检查是否写入
 +
::返回:bool
 +
 
 +
-- 写一组<font color="red">字节数组</font>数据从一个页面的特定位置
 +
--    A & B
 +
--  提示:写数据之前需要清除存储位置
 +
:- <font color="forestgreen">writeByteArray(uint32_t address, uint8_t *data_buffer, uint16_t bufferSize, bool errorCheck)</font>  -- A
 +
::参数:
 +
:::* address - 地址(0 - 最大存储地址)
 +
:::* data - 写入的数据(0-255)
 +
:::* errorCheck - 默认true,检查是否写入
 +
::返回:bool
 +
 
 +
:- <font color="forestgreen">writeByteArray(uint16_t page_number, uint8_t offset, uint8_t *data_buffer, uint16_t bufferSize, bool errorCheck)</font>  -- B
 +
::参数:
 +
:::* page_number - 页数(0-最大页数)
 +
:::* offset - 页面中的地址(0-255)
 +
:::* data - 写入的数据(0-255)
 +
:::* errorCheck - 默认true,检查是否写入
 +
::返回:bool
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
:- <font color="forestgreen">getMaxPage()</font>  --  检查错误
 
::参数:无
 
::参数:无
::返回 :DS3231AlarmTwo
+
::返回 :uint32_t
  
:-<font color="forestgreen">LatchAlarmsTriggeredFlags()</font>  --  警报后必须调用,否则将不会再次触发
+
:- <font color="forestgreen">getMaxPage()</font>  --  检查错误
 
::参数:无
 
::参数:无
::返回 :DS3231AlarmFlag
+
::返回 :uint32_t
  
:-<font color="forestgreen">ForceTemperatureCompensationUpdate()</font>  -- 手动温度补偿更新
 
::参数:bool block
 
::返回:无
 
  
:-<font color="forestgreen">GetAgingOffset()</font>  --  获取老化补偿
+
 
 +
|width="50%" valign="top" align="left"|
 +
 
 +
:- <font color="forestgreen">getMaxPage()</font>  --  检查错误
 
::参数:无
 
::参数:无
::返回 :int8_t
+
::返回 :uint32_t
  
:-<font color="forestgreen">SetAgingOffset()</font>  --  设置老化补偿
+
:- <font color="forestgreen">getMaxPage()</font>  --  检查错误
::参数 :int8_t
+
::参数 :无
::返回 :无
+
::返回 :uint32_t
  
  
|width="10%" valign="top" align="left"|
 
<!-- 空白 -->
 
 
|}
 
|}
  
  
 
TIP: [[宏:__DATE__,__TIME__,__FILE__,__LINE__]]
 
  
  
 
----
 
----
  
[[RTC 1307|返 回DS1307]]
+
[[ 语音模块|返 回语音模块]]
 
+
[[RTC 3231|返回DS3231]]
+
  
 
[[Arduino库|返回Arduino库菜单]]
 
[[Arduino库|返回Arduino库菜单]]

2017年1月13日 (五) 14:08的最后版本


小编奋力编辑中....


SPIFlash库 -- SPI华邦电子闪存Flash芯片arduino库 GITHUB 工程地址:SPIFlash

该库是用于华邦串行闪存芯片的库。目前的形式支持识别闪存芯片和它的各种功能;自动地址分配管理;在不同位置读写数据类型bytes/chars/ints/longs/floats/Strings;读写页面字节;连续读写字节/字符数组;扇区,块或整个芯片的擦除,关闭低功率操作。

支持arduino IDE 版本:

  • IDE v1.5.x
  • IDE v1.6.0-v1.6.5
  • IDE v1.6.9-v1.6.11

支持控制板:

  • Arduino Uno
  • Arduino Leonardo
  • Arduino Micro
  • Arduino Fio
  • Arduino Mega
  • Arduino Due
  • ESP8266 (On the Arduino IDE)
  • ATTiny85


示例


- Diagnostics: For a full diagnostics rundown - with error codes and details of the errors./有关完整诊断程序 - 包含错误代码和错误详细信息
- Struct_writer: This program writes a struct to a random location on your flash memory chip and reads it back./这个程序写一个struct到闪存芯片的随机位置然后读取它。
- TestFlash: The Test program show all most function./测试程序演示大部分功能函数
- getAddressEx: This program shows the method to use the getAddress() function to automate the process of address allocation when using a flash memory module. Please note the special function used to get the size of the String object./这个程序演示了使用getAddress()函数自动地址配置的过程在使用闪存模块。 请注意特殊函数使用字符串对象的大小。

- readWriteString: This program shows the method of reading a string from the console and saving it to flash memory./这个程序演示了阅读一个字符串从控制台并保存到闪存

SPIFlash

SPIFlash 函数。

- begin() -- 初始化
参数:无
返回:无
- error() -- 检查错误
参数:无
返回:uint8_t
- getCapacity() -- 获取芯片容量
参数:无
返回:uint32_t
- getMaxPage() -- 获取最大页数
参数:无
返回:uint32_t
- getChipName() -- 获取芯片识别名称
参数:无
返回:uint16_t


- getManID() -- 检查和启动芯片并获取16位int型制造商ID
参数:无
返回:uint16_t
- getJEDECID() -- 检查和启动芯片并获取32位int型 JEDEC ID
参数:无
返回:uint32_t


-- 获取下一个可用地址使用: -- A.以数据的大小作为参数,并返回一个32位的地址 -- B.3个参数,数据大小、页数及位置 -- 所有地址的素描必须获得通过该函数或不

- getAddress(uint16_t size) -- A
参数:size - 数据大小
返回:uint32_t
- getAddress(uint16_t size, uint16_t &page_number, uint8_t &offset) -- B
参数:
  • size -
  • &page_number -
  • &offset -
返回:bool
- sizeofStr(String &inputStr) -- 函数返回字符串的大小(仅用于getAddress()函数)
参数:inputStr - 字符串
返回:uint16_t


-- 从一个页面的特定位置读一个字节的数据 -- A & B

- readByte(uint32_t address, bool fastRead) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:uint8_t
- readByte(uint16_t page_number, uint8_t offset, bool fastRead) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:uint8_t


-- 从一个页面的特定位置读一个字符的数据 -- A & B

- readChar(uint32_t address, bool fastRead) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:int8_t
- readChar(uint16_t page_number, uint8_t offset, bool fastRead) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:int8_t


-- 从一个页面的特定位置读一个字节数组的数据 -- A & B

- readByteArray(uint32_t address, uint8_t *data_buffer, uint16_t bufferSize, bool fastRead) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • data_buffer - 读取的数据
  • bufferSize - 读取数据大小
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:bool
- readByteArray(uint16_t page_number, uint8_t offset, uint8_t *data_buffer, uint16_t bufferSize, bool fastRead) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • data_buffer - 读取的数据
  • bufferSize - 读取数据大小
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:bool


-- 从一个页面的特定位置读一个字符数组的数据 -- A & B

- readCharArray(uint32_t address, uint8_t *data_buffer, uint16_t bufferSize, bool fastRead) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • data_buffer - 读取的数据
  • bufferSize - 读取数据大小
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:bool
- readCharArray(uint16_t page_number, uint8_t offset, uint8_t *data_buffer, uint16_t bufferSize, bool fastRead) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • data_buffer - 读取的数据
  • bufferSize - 读取数据大小
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:bool


-- 从一个页面的特定位置读一个无符号整型(unsigned int)数据 -- A & B

- readWord(uint32_t address, bool fastRead) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:uint16_t
- readWord(uint16_t page_number, uint8_t offset, bool fastRead) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:uint16_t


-- 从一个页面的特定位置读一个整型(int)数据 -- A & B

- readShort(uint32_t address, bool fastRead) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:int16_t
- readShort(uint16_t page_number, uint8_t offset, bool fastRead) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:int16_t


-- 从一个页面的特定位置读一个无符号长整型(unsigned long)数据 -- A & B

- readULong(uint32_t address, bool fastRead) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:uint32_t
- readULong(uint16_t page_number, uint8_t offset, bool fastRead) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:uint32_t


-- 从一个页面的特定位置读一个长整型(long)数据 -- A & B

- readLong(uint32_t address, bool fastRead) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:int32_t
- readLong(uint16_t page_number, uint8_t offset, bool fastRead) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:int32_t


-- 从一个页面的特定位置读一个浮点(float)数据 ?? -- A & B

- readFloat(uint32_t address, bool fastRead) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:float
- readFloat(uint16_t page_number, uint8_t offset, bool fastRead) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:float


-- 从一个页面的特定位置读一个字符串(string)数据 -- A & B

- readStr(uint32_t address, String &outStr, bool fastRead) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • outputString --> 字符串
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:bool
- readStr(uint16_t page_number, uint8_t offset, String &outStr, bool fastRead) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • outputString --> 字符串
  • fastRead - 默认为false( 如果设置为true将执行 _beginFastRead() )
返回:bool


-- 写一个字节(byte)数据到一个页面的特定位置 -- A & B -- 提示:写数据之前需要清除存储位置

- writeByte(uint32_t address, uint8_t data, bool errorCheck) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • data - 写入的数据(0-255)
  • errorCheck - 默认true,检查是否写入
返回:bool
- writeByte(uint16_t page_number, uint8_t offset, uint8_t data, bool errorCheck) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • data - 写入的数据(0-255)
  • errorCheck - 默认true,检查是否写入
返回:bool


-- 写一个字符(char)数据到一个页面的特定位置 -- A & B -- 提示:写数据之前需要清除存储位置

- writeChar(uint32_t address, int8_t data, bool errorCheck) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • data - 写入的数据(0-255)
  • errorCheck - 默认true,检查是否写入
返回:bool
- writeChar(uint16_t page_number, uint8_t offset, int8_t data, bool errorCheck) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • data - 写入的数据(0-255)
  • errorCheck - 默认true,检查是否写入
返回:bool

-- 写一组字节数组数据从一个页面的特定位置 -- A & B -- 提示:写数据之前需要清除存储位置

- writeByteArray(uint32_t address, uint8_t *data_buffer, uint16_t bufferSize, bool errorCheck) -- A
参数:
  • address - 地址(0 - 最大存储地址)
  • data - 写入的数据(0-255)
  • errorCheck - 默认true,检查是否写入
返回:bool
- writeByteArray(uint16_t page_number, uint8_t offset, uint8_t *data_buffer, uint16_t bufferSize, bool errorCheck) -- B
参数:
  • page_number - 页数(0-最大页数)
  • offset - 页面中的地址(0-255)
  • data - 写入的数据(0-255)
  • errorCheck - 默认true,检查是否写入
返回:bool












- getMaxPage() -- 检查错误
参数:无
返回:uint32_t
- getMaxPage() -- 检查错误
参数:无
返回:uint32_t


- getMaxPage() -- 检查错误
参数:无
返回:uint32_t
- getMaxPage() -- 检查错误
参数:无
返回:uint32_t





返回语音模块

返回Arduino库菜单

返回首页

更多建议和问题欢迎反馈至 YFRobot论坛