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

From Flowcode Help
Jump to navigationJump to search
 
Line 31: Line 31:
 
==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}}
 
  
  
Line 51: Line 44:
  
  
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
''<span style="color:red;">No additional examples</span>''
  
 
==Macro reference==
 
==Macro reference==

Latest revision as of 14:26, 18 July 2024

Author Matrix Ltd.
Version 2.7
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.

Detailed description

No detailed description exists yet for this component

Examples

No additional examples

Macro reference

AppendByteArrayToFile

Fc9-comp-macro.png AppendByteArrayToFile
 
Fc9-u8-icon.png - BYTE Data
 
Fc9-u16-icon.png - UINT Length
 
Fc9-u8-icon.png - BYTE Return


AppendByteToFile

Fc9-comp-macro.png AppendByteToFile
 
Fc9-u8-icon.png - BYTE Data
 
Fc9-u8-icon.png - BYTE Return


AppendFloatArrayToFile

Fc9-comp-macro.png AppendFloatArrayToFile
Adds a binary float array to the end of the file. Returns 0 for success. 
Fc9-f32-icon.png - FLOAT Data
Binary data array to append to the file 
Fc9-u16-icon.png - UINT Length
Number of values to append 
Fc9-u8-icon.png - BYTE Return


AppendINTArrayToFile

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


AppendLongArrayToFile

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


AppendStringToFile

Fc9-comp-macro.png AppendStringToFile
 
Fc9-string-icon.png - STRING Data_String
 
Fc9-u8-icon.png - BYTE Return


CloseFile

Fc9-comp-macro.png CloseFile
 
Fc9-void-icon.png - VOID Return


CreateFile

Fc9-comp-macro.png CreateFile
 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


DeleteFile

Fc9-comp-macro.png DeleteFile
 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


Initialise

Fc9-comp-macro.png 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 
Fc9-u8-icon.png - BYTE Return


MoveToNextFileSector

Fc9-comp-macro.png MoveToNextFileSector
Not currently implemented on the RPI 
Fc9-u8-icon.png - BYTE ForceNextSector
 
Fc9-u8-icon.png - BYTE Return


OpenFile

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


OpenFolder

Fc9-comp-macro.png OpenFolder
 
Fc9-string-icon.png - STRING Folder_Name
 
Fc9-u8-icon.png - BYTE Return


ReadByteArrayFromFile

Fc9-comp-macro.png ReadByteArrayFromFile
Reads a binary byte array from the currently open file. Auto increments the position in the file. Returns the number of values read. 
Fc9-u8-icon.png - BYTE Data
 
Fc9-u16-icon.png - UINT Length
 
Fc9-u16-icon.png - UINT Return


ReadByteFromFile

Fc9-comp-macro.png 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). 
Fc9-u8-icon.png - BYTE Return


ReadByteFromIndex

Fc9-comp-macro.png ReadByteFromIndex
Reads a byte of data from the local sector buffer. Return = Data byte read from the local sector buffer.  
Fc9-u32-icon.png - ULONG Address
 
Fc9-u8-icon.png - BYTE Return


ReadFileLength

Fc9-comp-macro.png ReadFileLength
Not currently implemented on the RPI 
Fc9-s16-icon.png - INT Return


ReadFileSize

Fc9-comp-macro.png ReadFileSize
Reads the entire size of the current file in bytes. 
Fc9-u32-icon.png - ULONG Return


ReadFloatArrayFromFile

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


ReadINTArrayFromFile

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


ReadLongArrayFromFile

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


ReadStringFromFile

Fc9-comp-macro.png 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. 
Fc9-u16-icon.png - UINT NumBytes
Maximum number of bytes to attempt to read 
Fc9-u8-icon.png - BYTE EndChar
Ends the string if the value specified is found, default is 0 
Fc9-string-icon.png - STRING Return


SetFileIndex

Fc9-comp-macro.png SetFileIndex
 
Fc9-u8-icon.png - BYTE File_Index
Range: 0 to 4 
Fc9-void-icon.png - VOID Return


Uninitialise

Fc9-comp-macro.png Uninitialise
Terminates connection to the SD card, unmounts the SD card and disabled the SD peripheral. 
Fc9-void-icon.png - VOID Return


WriteByteToBuffer

Fc9-comp-macro.png WriteByteToBuffer
Not currently implemented on the RPI 
Fc9-u16-icon.png - UINT Address
 
Fc9-u8-icon.png - BYTE Data
 
Fc9-void-icon.png - VOID Return


WriteFileSector

Fc9-comp-macro.png WriteFileSector
Not currently implemented on the RPI 
Fc9-u8-icon.png - BYTE Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png Frequency
 
Fc9-type-21-icon.png File Count
Number of simultaneous files we want to access. 
Fc9-type-16-icon.png SD Mode
 
Fc9-type-21-icon.png Buffer Size
Number of bytes to use as a read buffer to speed up file access. 
Fc9-type-21-icon.png Directory Size
Number of bytes to use as a directory buffer to track the current directory. 
Fc9-conn-icon.png Pins
Fc9-type-5-icon.png CLK
 
Fc9-type-5-icon.png CMD
 
Fc9-type-5-icon.png D0
 
Fc9-type-5-icon.png D1
 
Fc9-type-5-icon.png D2
 
Fc9-type-5-icon.png D3
 
Fc9-conn-icon.png Simulation
Fc9-type-20-icon.png Sim Root Folder
 

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