#ifndef _HEX_PARSER_H_
#define _HEX_PARSER_H_

#include <stdint.h>
#include <fatfs/ff.h>
#include <stddef.h>

enum hex_parser_ret {
    HEX_PARSER_OK,
    HEX_PARSER_DATA_OK,
    HEX_PARSER_ERROR,
    HEX_PARSER_FILE_END,
};

struct hex_parser {
    FIL file;
    uint32_t current_address_offset;
};

enum hex_parser_ret hex_parser_open(struct hex_parser *parser, const char *file_name);

enum hex_parser_ret hex_parser_parse(struct hex_parser *parser, uint32_t *address, char *data, size_t data_len);

enum hex_parser_ret hex_parser_close(struct hex_parser *parser);

#endif /* _HEX_PARSER_H_ */
