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
-
参数:

SPIFlash库为Arduino平台提供华邦串行闪存芯片的支持。具备芯片识别、自动地址分配等功能,支持多种数据类型读写操作,并兼容多个ArduinoIDE版本及控制板。
1965

被折叠的 条评论
为什么被折叠?



