CSV File Format
CSV Overview
The RAPIDSEA CSV APIs provide functionalities to initialize, configure, and log data into CSV files. These APIs enable efficient management of CSV files within embedded systems, offering flexibility in file creation, header configuration, and data logging.
Usage
Create a CSV file using the structure described above.
Ensure all required fields are populated correctly.
Load the CSV file into the application layer using the appropriate API or configuration loader.
Any errors in the file will be reported with corresponding error codes.
Application Interface
The following APIs are provided to manage CSV files:
Function |
Description |
---|---|
rs_csv_init |
Initializes the CSV logging system using the provided configuration. |
rs_csv_set_file_info |
Sets the file path and name for the CSV file. |
rs_csv_log_data |
Logs a chunk of data into the CSV file in CSV format. |
Error Code
Every API’s for the csv returns some success or failure values. Please refer below section,
CSV Header Details
Documentation from the relevant header as follows:
CSV Specific APIs.
Defines macros and functions specific to CSV functionality
- Author
Embien RAPIDSEA Team
- Copyright
Embien Technologies India Pvt. Ltd.
Defines
-
RS_CSV_MAX_FILE_NAME_SIZE
Max csv file name length.
-
RS_CSV_MAX_FILE_PATH_SIZE
Max csv file path length.
-
RS_CSV_MAX_BUFFER_SIZE
Max csv file size.
Typedefs
-
typedef struct tag_rs_csv_header_config rs_csv_header_config_t
Contains information about csv header configuration.
-
typedef struct tag_rs_csv_config rs_csv_config_t
Contains information about csv configuration.
Functions
-
rs_ret_val_t rs_csv_init(rs_csv_config_t *ptr_csv_config, rs_csv_header_config_t *ptr_header, uint8_t u8_header_count, uint32_t u32_file_size)
-
rs_ret_val_t rs_csv_set_file_info(rs_csv_config_t *ptr_csv_config, uint8_t *ptr_file_path, uint8_t *ptr_file_name)
Sets the file path and name for the CSV file.
This function allows the user to set the file path and file name where the CSV data will be saved.
- Parameters:
ptr_csv_config – [in] - Pointer to the CSV configuration structure.
ptr_file_path – [in] - Pointer to a string containing the file path.
ptr_file_name – [in] - Pointer to a string containing the file name.
- Returns:
0 on success or error code on failure
-
rs_ret_val_t rs_csv_log_data(rs_csv_config_t *ptr_csv_config, uint8_t *ptr_data, uint32_t u32_data_len)
Logs data into the CSV file.
This function logs a chunk of data into the CSV file. The data will be appended to the file in CSV format.
- Parameters:
ptr_csv_config – [in] - Pointer to the CSV configuration structure.
ptr_data – [in] - Pointer to the data buffer to log.
u32_data_len – [in] - The length of the data to log (in bytes).
- Returns:
0 on success or error code on failure
-
struct tag_rs_csv_header_config
- #include <rs_csv.h>
Contains information about csv header configuration.
-
struct tag_rs_csv_config
- #include <rs_csv.h>
Contains information about csv configuration.
Public Members
-
rs_fatfs_t file
File system object.
-
rs_csv_header_config_t *ptr_header
Pointer to the header configuration.
-
uint8_t header_count
Number of headers.
-
uint8_t create_new_file
Flag to create a new file.
-
uint8_t *ptr_file_name
Pointer to the file name.
-
uint8_t file_name[RS_CSV_MAX_FILE_NAME_SIZE]
File name of the csv.
-
uint8_t file_path[RS_CSV_MAX_FILE_PATH_SIZE]
File path of the csv.
-
uint8_t log_buffer[RS_CSV_MAX_BUFFER_SIZE]
Pointer to the log buffer of the csv.
-
uint32_t write_file_count
Log buffer.
-
uint32_t file_size
File size of the csv.
-
uint32_t buff_size
Buffer of the csv.
-
uint32_t write_index
Write index of the input array.
-
rs_fatfs_t file