Difference between revisions of "Component: File (ESP32 SDMode) (File)"
From Flowcode Help
Jump to navigationJump to search (Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | Matrix Ltd. |- | width="20%" style="color:gray;" | Version | 2.7 |- | width="20%" style="color:gra...") |
|||
Line 14: | Line 14: | ||
==File (ESP32 SDMode) component== | ==File (ESP32 SDMode) component== | ||
File component allowing access to read and write files on an SD card using the ESP32 SD Mode IO allowing for high speed data transfer using 1-bit or 4-bit SD access. | File component allowing access to read and write files on an SD card using the ESP32 SD Mode IO allowing for high speed data transfer using 1-bit or 4-bit SD access. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Detailed description== | ==Detailed description== | ||
Line 51: | Line 45: | ||
{{Fcfile|FA_API_Sim_Demo.fcfx|FA API Sim Demo}} | {{Fcfile|FA_API_Sim_Demo.fcfx|FA API Sim Demo}} | ||
+ | |||
+ | |||
Line 57: | Line 53: | ||
==Macro reference== | ==Macro reference== | ||
+ | |||
+ | ===AppendByteArrayToFile=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AppendByteArrayToFile''' | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Data | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Length | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
===AppendByteToFile=== | ===AppendByteToFile=== | ||
Line 71: | Line 91: | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===AppendFloatArrayToFile=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AppendFloatArrayToFile''' | ||
+ | |- | ||
+ | | colspan="2" | Adds a binary float array to the end of the file. Returns 0 for success. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT | ||
+ | | width="90%" | Data | ||
+ | |- | ||
+ | | colspan="2" | Binary data array to append to the file | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Length | ||
+ | |- | ||
+ | | colspan="2" | Number of values to append | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===AppendINTArrayToFile=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AppendINTArrayToFile''' | ||
+ | |- | ||
+ | | colspan="2" | Adds a binary INT array to the end of the file. Returns 0 for success. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Data | ||
+ | |- | ||
+ | | colspan="2" | Binary data array to append to the file | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Length | ||
+ | |- | ||
+ | | colspan="2" | Number of values to append | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" | MSBFirst | ||
+ | |- | ||
+ | | colspan="2" | 0=LSB then MSB, 1=MSB then LSB | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===AppendLongArrayToFile=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AppendLongArrayToFile''' | ||
+ | |- | ||
+ | | colspan="2" | Adds a binary Long array to the end of the file. Returns 0 for success. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG | ||
+ | | width="90%" | Data | ||
+ | |- | ||
+ | | colspan="2" | Binary data array to append to the file | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Length | ||
+ | |- | ||
+ | | colspan="2" | Number of values to append | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" | MSBFirst | ||
+ | |- | ||
+ | | colspan="2" | 0=LSB then MSB, 1=MSB then LSB | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
Line 215: | Line 317: | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===ReadByteArrayFromFile=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadByteArrayFromFile''' | ||
+ | |- | ||
+ | | colspan="2" | Reads a binary byte array from the currently open file. Auto increments the position in the file. Returns the number of values read. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Data | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Length | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
Line 276: | Line 402: | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===ReadFloatArrayFromFile=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadFloatArrayFromFile''' | ||
+ | |- | ||
+ | | colspan="2" | Reads a binary Float array from the currently open file. Auto increments the position in the file. Returns the number of values read. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT | ||
+ | | width="90%" | Data | ||
+ | |- | ||
+ | | colspan="2" | Data variable to populate with data | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Length | ||
+ | |- | ||
+ | | colspan="2" | Number of values to read | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" | MSBFirst | ||
+ | |- | ||
+ | | colspan="2" | 0=LSB then MSB, 1=MSB then LSB | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===ReadINTArrayFromFile=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadINTArrayFromFile''' | ||
+ | |- | ||
+ | | colspan="2" | Reads a binary INT array from the currently open file. Auto increments the position in the file. Returns the number of values read. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Data | ||
+ | |- | ||
+ | | colspan="2" | Data variable to populate with data | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Length | ||
+ | |- | ||
+ | | colspan="2" | Number of values to read | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" | MSBFirst | ||
+ | |- | ||
+ | | colspan="2" | 0=LSB then MSB, 1=MSB then LSB | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===ReadLongArrayFromFile=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadLongArrayFromFile''' | ||
+ | |- | ||
+ | | colspan="2" | Reads a binary Long array from the currently open file. Auto increments the position in the file. Returns the number of values read. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG | ||
+ | | width="90%" | Data | ||
+ | |- | ||
+ | | colspan="2" | Data variable to populate with data | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Length | ||
+ | |- | ||
+ | | colspan="2" | Number of values to read | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" | MSBFirst | ||
+ | |- | ||
+ | | colspan="2" | 0=LSB then MSB, 1=MSB then LSB | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
Line 407: | Line 620: | ||
|- | |- | ||
| colspan="2" | Number of bytes to use as a directory buffer to track the current directory. | | colspan="2" | Number of bytes to use as a directory buffer to track the current directory. | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Pins | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | ||
+ | | width="90%" | CLK | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | ||
+ | | width="90%" | CMD | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | ||
+ | | width="90%" | D0 | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | ||
+ | | width="90%" | D1 | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | ||
+ | | width="90%" | D2 | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | ||
+ | | width="90%" | D3 | ||
+ | |- | ||
+ | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
Line 417: | Line 664: | ||
| colspan="2" | | | colspan="2" | | ||
|} | |} | ||
+ | |||
+ | ==Component Source Code== | ||
+ | |||
+ | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_File_ESP32_SDMode.fcfx FC_Comp_Source_File_ESP32_SDMode.fcfx] | ||
+ | |||
+ | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_File_ESP32_SDMode.fcfx FC_Comp_Source_File_ESP32_SDMode.fcfx] |
Revision as of 14:32, 13 May 2024
Author | Matrix Ltd. |
Version | 2.7 |
Category | File |
Contents
- 1 File (ESP32 SDMode) component
- 2 Detailed description
- 3 Examples
- 4 Macro reference
- 4.1 AppendByteArrayToFile
- 4.2 AppendByteToFile
- 4.3 AppendFloatArrayToFile
- 4.4 AppendINTArrayToFile
- 4.5 AppendLongArrayToFile
- 4.6 AppendStringToFile
- 4.7 CloseFile
- 4.8 CreateFile
- 4.9 DeleteFile
- 4.10 Initialise
- 4.11 MoveToNextFileSector
- 4.12 OpenFile
- 4.13 OpenFolder
- 4.14 ReadByteArrayFromFile
- 4.15 ReadByteFromFile
- 4.16 ReadByteFromIndex
- 4.17 ReadFileLength
- 4.18 ReadFileSize
- 4.19 ReadFloatArrayFromFile
- 4.20 ReadINTArrayFromFile
- 4.21 ReadLongArrayFromFile
- 4.22 ReadStringFromFile
- 4.23 SetFileIndex
- 4.24 Uninitialise
- 4.25 WriteByteToBuffer
- 4.26 WriteFileSector
- 5 Property reference
- 6 Component Source Code
File (ESP32 SDMode) component
File component allowing access to read and write files on an SD card using the ESP32 SD Mode IO allowing for high speed data transfer using 1-bit or 4-bit SD access.
Detailed description
No detailed description exists yet for this component
Examples
Line Following
Line following example using the Formula AllCode, works with objects on the simulation panel and on the real hardware.
Simulation with the API component
An example showing how to use the API component to drive the robot in simulation.
Macro reference
AppendByteArrayToFile
![]() |
AppendByteArrayToFile |
![]() |
Data |
![]() |
Length |
![]() |
Return |
AppendByteToFile
![]() |
AppendByteToFile |
![]() |
Data |
![]() |
Return |
AppendFloatArrayToFile
AppendINTArrayToFile
AppendLongArrayToFile
AppendStringToFile
![]() |
AppendStringToFile |
![]() |
Data_String |
![]() |
Return |
CloseFile
![]() |
CloseFile |
![]() |
Return |
CreateFile
![]() |
CreateFile |
![]() |
Filename |
![]() |
Return |
DeleteFile
![]() |
DeleteFile |
![]() |
Filename |
![]() |
Return |
Initialise
![]() |
Initialise |
Starts up the SD card interface and checks to see if a card is compatible. Returns: 0=OK, 255=No Card, 254=File System Fail | |
![]() |
Return |
MoveToNextFileSector
![]() |
MoveToNextFileSector |
Not currently implemented on the RPI | |
![]() |
ForceNextSector |
![]() |
Return |
OpenFile
OpenFolder
![]() |
OpenFolder |
![]() |
Folder_Name |
![]() |
Return |
ReadByteArrayFromFile
![]() |
ReadByteArrayFromFile |
Reads a binary byte array from the currently open file. Auto increments the position in the file. Returns the number of values read. | |
![]() |
Data |
![]() |
Length |
![]() |
Return |
ReadByteFromFile
ReadByteFromIndex
![]() |
ReadByteFromIndex |
Reads a byte of data from the local sector buffer. Return = Data byte read from the local sector buffer. | |
![]() |
Address |
![]() |
Return |
ReadFileLength
![]() |
ReadFileLength |
Not currently implemented on the RPI | |
![]() |
Return |
ReadFileSize
![]() |
ReadFileSize |
Reads the entire size of the current file in bytes. | |
![]() |
Return |
ReadFloatArrayFromFile
ReadINTArrayFromFile
ReadLongArrayFromFile
ReadStringFromFile
SetFileIndex
![]() |
SetFileIndex |
![]() |
File_Index |
Range: 0 to 4 | |
![]() |
Return |
Uninitialise
![]() |
Uninitialise |
Terminates connection to the SD card, unmounts the SD card and disabled the SD peripheral. | |
![]() |
Return |
WriteByteToBuffer
![]() |
WriteByteToBuffer |
Not currently implemented on the RPI | |
![]() |
Address |
![]() |
Data |
![]() |
Return |
WriteFileSector
![]() |
WriteFileSector |
Not currently implemented on the RPI | |
![]() |
Return |
Property reference
Component Source Code
Please click here to download the component source project: FC_Comp_Source_File_ESP32_SDMode.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_File_ESP32_SDMode.fcfx