Jump to content

Component: File (ESP32 SDMode) (File): Difference between revisions

From Flowcode Help
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..."
 
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(9 intermediate revisions by 3 users not shown)
Line 5: Line 5:
|-
|-
| width="20%" style="color:gray;" | Version
| width="20%" style="color:gray;" | Version
| 2.7
| 9.9
|-
|-
| width="20%" style="color:gray;" | Category
| width="20%" style="color:gray;" | Category
Line 15: Line 15:
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.


==Component Source Code==
==Version information==
 
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]
Library Version, Component Version, Date, Author, Info
9, 9.0, 04-03-25, MW, Changed tooltips from Not implemented on the RPI to Not implemented on the ESP32


==Detailed description==
==Detailed description==
Line 37: Line 36:
==Examples==
==Examples==


===Line Following===


Line following example using the Formula AllCode, works with objects on the simulation panel and on the real hardware.


{{Fcfile|FA-Line.fcfx|FA-Line}}


[[File:FALine.jpg]]




===Simulation with the API component===


An example showing how to use the API component to drive the robot in simulation.


{{Fcfile|FA_API_Sim_Demo.fcfx|FA API Sim Demo}}








''<span style="color:red;">No additional examples</span>''


==Macro reference==
==Macro reference==
===AppendByteArrayToFile===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''AppendByteArrayToFile'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Length
|-
| colspan="2" | &nbsp;
|-
| 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===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AppendByteToFile'''
| width="90%" class="mtx-class-macrohead" | '''AppendByteToFile'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
Line 71: Line 102:
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
|-
| 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="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''AppendFloatArrayToFile'''
|-
| colspan="2" | Adds a binary float array to the end of the file. Returns 0 for success.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Data
|-
| colspan="2" | Binary data array to append to the file&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Length
|-
| colspan="2" | Number of values to append&nbsp;
|-
| 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="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''AppendINTArrayToFile'''
|-
| colspan="2" | Adds a binary INT array to the end of the file. Returns 0 for success.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Data
|-
| colspan="2" | Binary data array to append to the file&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Length
|-
| colspan="2" | Number of values to append&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBFirst
|-
| colspan="2" | 0=LSB then MSB, 1=MSB then LSB&nbsp;
|-
| 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="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''AppendLongArrayToFile'''
|-
| colspan="2" | Adds a binary Long array to the end of the file. Returns 0 for success.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" | Data
|-
| colspan="2" | Binary data array to append to the file&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Length
|-
| colspan="2" | Number of values to append&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBFirst
|-
| colspan="2" | 0=LSB then MSB, 1=MSB then LSB&nbsp;
|-
|-
| 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 78: Line 191:


===AppendStringToFile===
===AppendStringToFile===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AppendStringToFile'''
| width="90%" class="mtx-class-macrohead" | '''AppendStringToFile'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
Line 97: Line 210:


===CloseFile===
===CloseFile===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CloseFile'''
| width="90%" class="mtx-class-macrohead" | '''CloseFile'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
Line 111: Line 224:


===CreateFile===
===CreateFile===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CreateFile'''
| width="90%" class="mtx-class-macrohead" | '''CreateFile'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
Line 130: Line 243:


===DeleteFile===
===DeleteFile===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DeleteFile'''
| width="90%" class="mtx-class-macrohead" | '''DeleteFile'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
Line 149: Line 262:


===Initialise===
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | 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&nbsp;
| colspan="2" | 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&nbsp;
Line 163: Line 276:


===MoveToNextFileSector===
===MoveToNextFileSector===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MoveToNextFileSector'''
| width="90%" class="mtx-class-macrohead" | '''MoveToNextFileSector'''
|-
|-
| colspan="2" | Not currently implemented on the RPI&nbsp;
| colspan="2" | Not implemented on the ESP32&nbsp;
|-
|-
|-
|-
Line 182: Line 295:


===OpenFile===
===OpenFile===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OpenFile'''
| width="90%" class="mtx-class-macrohead" | '''OpenFile'''
|-
|-
| colspan="2" | Searches for and opens a file for reading or writing from within the current directory on the disk. Returns 0 for success.&nbsp;
| colspan="2" | Searches for and opens a file for reading or writing from within the current directory on the disk. Returns 0 for success.&nbsp;
Line 201: Line 314:


===OpenFolder===
===OpenFolder===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OpenFolder'''
| width="90%" class="mtx-class-macrohead" | '''OpenFolder'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
Line 215: Line 328:
|-
|-
| 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="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''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.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Length
|-
| colspan="2" | &nbsp;
|-
| 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 220: Line 357:


===ReadByteFromFile===
===ReadByteFromFile===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadByteFromFile'''
| width="90%" class="mtx-class-macrohead" | '''ReadByteFromFile'''
|-
|-
| colspan="2" | Reads a byte from the currently open file. Auto increments the position in the file. A return value of 0 may signify the end of the file has been reached (depending on the contents of the file).&nbsp;
| colspan="2" | Reads a byte from the currently open file. Auto increments the position in the file. A return value of 0 may signify the end of the file has been reached (depending on the contents of the file).&nbsp;
Line 234: Line 371:


===ReadByteFromIndex===
===ReadByteFromIndex===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadByteFromIndex'''
| width="90%" class="mtx-class-macrohead" | '''ReadByteFromIndex'''
|-
|-
| colspan="2" | Reads a byte of data from the local sector buffer. Return = Data byte read from the local sector buffer. &nbsp;
| colspan="2" | Reads a byte of data from the local sector buffer. Return = Data byte read from the local sector buffer. &nbsp;
Line 253: Line 390:


===ReadFileLength===
===ReadFileLength===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadFileLength'''
| width="90%" class="mtx-class-macrohead" | '''ReadFileLength'''
|-
|-
| colspan="2" | Not currently implemented on the RPI&nbsp;
| colspan="2" | Not implemented on the ESP32&nbsp;
|-
|-
|-
|-
Line 267: Line 404:


===ReadFileSize===
===ReadFileSize===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadFileSize'''
| width="90%" class="mtx-class-macrohead" | '''ReadFileSize'''
|-
|-
| colspan="2" | Reads the entire size of the current file in bytes.&nbsp;
| colspan="2" | Reads the entire size of the current file in bytes.&nbsp;
Line 276: Line 413:
|-
|-
| 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="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''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.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Data
|-
| colspan="2" | Data variable to populate with data&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Length
|-
| colspan="2" | Number of values to read&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBFirst
|-
| colspan="2" | 0=LSB then MSB, 1=MSB then LSB&nbsp;
|-
| 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="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''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.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Data
|-
| colspan="2" | Data variable to populate with data&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Length
|-
| colspan="2" | Number of values to read&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBFirst
|-
| colspan="2" | 0=LSB then MSB, 1=MSB then LSB&nbsp;
|-
| 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="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''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.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" | Data
|-
| colspan="2" | Data variable to populate with data&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Length
|-
| colspan="2" | Number of values to read&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBFirst
|-
| colspan="2" | 0=LSB then MSB, 1=MSB then LSB&nbsp;
|-
| 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 281: Line 505:


===ReadStringFromFile===
===ReadStringFromFile===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadStringFromFile'''
| width="90%" class="mtx-class-macrohead" | '''ReadStringFromFile'''
|-
|-
| colspan="2" | Reads a string from the currently open file. Auto increments the position in the file. An empty string signifies the end of the file has been reached.&nbsp;
| colspan="2" | Reads a string from the currently open file. Auto increments the position in the file. An empty string signifies the end of the file has been reached.&nbsp;
Line 305: Line 529:


===SetFileIndex===
===SetFileIndex===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetFileIndex'''
| width="90%" class="mtx-class-macrohead" | '''SetFileIndex'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
Line 324: Line 548:


===Uninitialise===
===Uninitialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Uninitialise'''
| width="90%" class="mtx-class-macrohead" | '''Uninitialise'''
|-
|-
| colspan="2" | Terminates connection to the SD card, unmounts the SD card and disabled the SD peripheral.&nbsp;
| colspan="2" | Terminates connection to the SD card, unmounts the SD card and disabled the SD peripheral.&nbsp;
Line 338: Line 562:


===WriteByteToBuffer===
===WriteByteToBuffer===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteByteToBuffer'''
| width="90%" class="mtx-class-macrohead" | '''WriteByteToBuffer'''
|-
|-
| colspan="2" | Not currently implemented on the RPI&nbsp;
| colspan="2" | Not implemented on the ESP32&nbsp;
|-
|-
|-
|-
Line 362: Line 586:


===WriteFileSector===
===WriteFileSector===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteFileSector'''
| width="90%" class="mtx-class-macrohead" | '''WriteFileSector'''
|-
|-
| colspan="2" | Not currently implemented on the RPI&nbsp;
| colspan="2" | Not implemented on the ESP32&nbsp;
|-
|-
|-
|-
Line 377: Line 601:
==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
Line 408: Line 632:
| colspan="2" | Number of bytes to use as a directory buffer to track the current directory.&nbsp;
| colspan="2" | Number of bytes to use as a directory buffer to track the current directory.&nbsp;
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
| width="90%" class="mtx-class-propfolder" | Pins
|-
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | CLK
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | CMD
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | D0
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | D1
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | D2
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | D3
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" class="mtx-class-propfolder" | Simulation
|-
|-
|-
|-
Line 415: Line 673:
| width="90%" | Sim Root Folder
| width="90%" | Sim Root Folder
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | The directory used by the simulation to look for files.&nbsp;
|}
|}
==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]

Latest revision as of 14:36, 13 July 2026

Author Matrix Ltd.
Version 9.9
Category File


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.

Version information

Library Version, Component Version, Date, Author, Info
9, 9.0, 04-03-25, MW, Changed tooltips from Not implemented on the RPI to Not implemented on the ESP32

Detailed description

No detailed description exists yet for this component

Examples

No additional examples

Macro reference

AppendByteArrayToFile

AppendByteArrayToFile
 
- BYTE Data
 
- UINT Length
 
- BYTE Return


AppendByteToFile

AppendByteToFile
 
- BYTE Data
 
- BYTE Return


AppendFloatArrayToFile

AppendFloatArrayToFile
Adds a binary float array to the end of the file. Returns 0 for success. 
- FLOAT Data
Binary data array to append to the file 
- UINT Length
Number of values to append 
- BYTE Return


AppendINTArrayToFile

AppendINTArrayToFile
Adds a binary INT array to the end of the file. Returns 0 for success. 
- UINT Data
Binary data array to append to the file 
- UINT Length
Number of values to append 
- BOOL MSBFirst
0=LSB then MSB, 1=MSB then LSB 
- BYTE Return


AppendLongArrayToFile

AppendLongArrayToFile
Adds a binary Long array to the end of the file. Returns 0 for success. 
- ULONG Data
Binary data array to append to the file 
- UINT Length
Number of values to append 
- BOOL MSBFirst
0=LSB then MSB, 1=MSB then LSB 
- BYTE Return


AppendStringToFile

AppendStringToFile
 
- STRING Data_String
 
- BYTE Return


CloseFile

CloseFile
 
- VOID Return


CreateFile

CreateFile
 
- STRING Filename
 
- BYTE Return


DeleteFile

DeleteFile
 
- STRING Filename
 
- BYTE 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 
- BYTE Return


MoveToNextFileSector

MoveToNextFileSector
Not implemented on the ESP32 
- BYTE ForceNextSector
 
- BYTE Return


OpenFile

OpenFile
Searches for and opens a file for reading or writing from within the current directory on the disk. Returns 0 for success. 
- STRING Filename
8.3 filename of the file we are trying to open e.g. "file.txt" 
- BYTE Return


OpenFolder

OpenFolder
 
- STRING Folder_Name
 
- BYTE 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. 
- BYTE Data
 
- UINT Length
 
- UINT Return


ReadByteFromFile

ReadByteFromFile
Reads a byte from the currently open file. Auto increments the position in the file. A return value of 0 may signify the end of the file has been reached (depending on the contents of the file). 
- BYTE Return


ReadByteFromIndex

ReadByteFromIndex
Reads a byte of data from the local sector buffer. Return = Data byte read from the local sector buffer.  
- ULONG Address
 
- BYTE Return


ReadFileLength

ReadFileLength
Not implemented on the ESP32 
- INT Return


ReadFileSize

ReadFileSize
Reads the entire size of the current file in bytes. 
- ULONG Return


ReadFloatArrayFromFile

ReadFloatArrayFromFile
Reads a binary Float array from the currently open file. Auto increments the position in the file. Returns the number of values read. 
- FLOAT Data
Data variable to populate with data 
- UINT Length
Number of values to read 
- BOOL MSBFirst
0=LSB then MSB, 1=MSB then LSB 
- UINT Return


ReadINTArrayFromFile

ReadINTArrayFromFile
Reads a binary INT array from the currently open file. Auto increments the position in the file. Returns the number of values read. 
- UINT Data
Data variable to populate with data 
- UINT Length
Number of values to read 
- BOOL MSBFirst
0=LSB then MSB, 1=MSB then LSB 
- UINT Return


ReadLongArrayFromFile

ReadLongArrayFromFile
Reads a binary Long array from the currently open file. Auto increments the position in the file. Returns the number of values read. 
- ULONG Data
Data variable to populate with data 
- UINT Length
Number of values to read 
- BOOL MSBFirst
0=LSB then MSB, 1=MSB then LSB 
- UINT Return


ReadStringFromFile

ReadStringFromFile
Reads a string from the currently open file. Auto increments the position in the file. An empty string signifies the end of the file has been reached. 
- UINT NumBytes
Maximum number of bytes to attempt to read 
- BYTE EndChar
Ends the string if the value specified is found, default is 0 
- STRING Return


SetFileIndex

SetFileIndex
 
- BYTE File_Index
Range: 0 to 4 
- VOID Return


Uninitialise

Uninitialise
Terminates connection to the SD card, unmounts the SD card and disabled the SD peripheral. 
- VOID Return


WriteByteToBuffer

WriteByteToBuffer
Not implemented on the ESP32 
- UINT Address
 
- BYTE Data
 
- VOID Return


WriteFileSector

WriteFileSector
Not implemented on the ESP32 
- BYTE Return


Property reference

Properties
Frequency
 
File Count
Number of simultaneous files we want to access. 
SD Mode
 
Buffer Size
Number of bytes to use as a read buffer to speed up file access. 
Directory Size
Number of bytes to use as a directory buffer to track the current directory. 
Pins
CLK
 
CMD
 
D0
 
D1
 
D2
 
D3
 
Simulation
Sim Root Folder
The directory used by the simulation to look for files. 

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