Header file for the barcode driver. More...
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | barcode_line_buffer |
Struct that holds the 9 most recent barcode lines. More... | |
Macros | |
#define | BARCODE_DEBUG_VERBOSE 0 |
Verbosity level for debug print. | |
#define | BARCODE_DEBUG_VERBOSE 0 |
Verbosity level for debug print. | |
#define | BARCODE_MAX_LINES 9 |
Maximum number of barcode lines. | |
#define | DEBUG_PRINT(...) printf(__VA_ARGS__) |
Enables debug print. More... | |
#define | PICO_DEBUG_MALLOC 1 |
Enables malloc debugging. | |
Typedefs | |
typedef struct barcode_line_buffer | barcode_line_buffer_t |
Struct that holds the 9 most recent barcode lines. | |
Enumerations | |
enum | barcode_char_t { BARCODE_CHAR_0 = 0b000110100 , BARCODE_CHAR_1 = 0b100100001 , BARCODE_CHAR_2 = 0b001100001 , BARCODE_CHAR_3 = 0b101100000 , BARCODE_CHAR_4 = 0b000110001 , BARCODE_CHAR_5 = 0b100110000 , BARCODE_CHAR_6 = 0b001110000 , BARCODE_CHAR_7 = 0b000100101 , BARCODE_CHAR_8 = 0b100100100 , BARCODE_CHAR_9 = 0b001100100 , BARCODE_CHAR_A = 0b100001001 , BARCODE_CHAR_B = 0b001001001 , BARCODE_CHAR_C = 0b101001000 , BARCODE_CHAR_D = 0b000011001 , BARCODE_CHAR_E = 0b100011000 , BARCODE_CHAR_F = 0b001011000 , BARCODE_CHAR_G = 0b000001101 , BARCODE_CHAR_H = 0b100001100 , BARCODE_CHAR_I = 0b001001100 , BARCODE_CHAR_J = 0b000011100 , BARCODE_CHAR_K = 0b100000011 , BARCODE_CHAR_L = 0b001000011 , BARCODE_CHAR_M = 0b101000010 , BARCODE_CHAR_N = 0b000010011 , BARCODE_CHAR_O = 0b100010010 , BARCODE_CHAR_P = 0b001010010 , BARCODE_CHAR_Q = 0b000000111 , BARCODE_CHAR_R = 0b100000110 , BARCODE_CHAR_S = 0b001000110 , BARCODE_CHAR_T = 0b000010110 , BARCODE_CHAR_U = 0b110000001 , BARCODE_CHAR_V = 0b011000001 , BARCODE_CHAR_W = 0b111000000 , BARCODE_CHAR_X = 0b010010001 , BARCODE_CHAR_Y = 0b110010000 , BARCODE_CHAR_Z = 0b011010000 , BARCODE_CHAR_DASH = 0b010000101 , BARCODE_CHAR_PERIOD = 0b110000100 , BARCODE_CHAR_SPACE = 0b011000100 , BARCODE_CHAR_DOLLAR = 0b010101000 , BARCODE_CHAR_SLASH = 0b010100010 , BARCODE_CHAR_PLUS = 0b010001010 , BARCODE_CHAR_PERCENT = 0b000101010 , BARCODE_CHAR_ASTERISK = 0b010010100 } |
Enum for the barcode characters. A 0 bit represents a thin line (white or black), while a 1 bit represents a thick line. More... | |
enum | barcode_line_type_t { BARCODE_LINE_NONE = 0 , BARCODE_LINE_BLACK_THIN = 0b0001 , BARCODE_LINE_BLACK_THICK = 0b0011 , BARCODE_LINE_WHITE_THIN = 0b0100 , BARCODE_LINE_WHITE_THICK = 0b1100 } |
Enum for the barcode line types (black or white, thin or thick). None for error handling. More... | |
enum | barcode_read_response_t { BARCODE_READ_ERROR = -1 , BARCODE_READ_SUCCESS = 0 , BARCODE_READ_CONTINUE = 1 , BARCODE_READ_NO_OP = 2 } |
Enum for the barcode read response. Success or error. More... | |
Functions | |
char * | barcode_buffer_to_binary_string (barcode_line_buffer_t *p_line_buffer) |
Returns a binary string representation of the barcode line buffer. More... | |
void | barcode_clear_line_buffer (barcode_line_buffer_t *p_line_buffer) |
Initialises or clears the barcode line buffer. More... | |
barcode_char_t | barcode_decode_barcode_char (barcode_line_buffer_t *p_line_buffer) |
Decodes the barcode character enum from the line buffer. More... | |
char | barcode_get_char (barcode_char_t barcode_char) |
Gets the character from the barcode character enum. More... | |
char * | barcode_line_to_string (barcode_line_type_t line_type) |
Helper function to get the barcode line type as a string. More... | |
int8_t | barcode_update_line_buffer (barcode_line_buffer_t *p_line_buffer, barcode_line_type_t line_type) |
Updates the line buffer with the line type detected. More... | |
Header file for the barcode driver.
#define DEBUG_PRINT | ( | ... | ) | printf(__VA_ARGS__) |
Enables debug print.
... | Variable arguments. |
enum barcode_char_t |
Enum for the barcode characters. A 0 bit represents a thin line (white or black), while a 1 bit represents a thick line.
enum barcode_line_type_t |
Enum for the barcode line types (black or white, thin or thick). None for error handling.
char * barcode_buffer_to_binary_string | ( | barcode_line_buffer_t * | p_line_buffer | ) |
Returns a binary string representation of the barcode line buffer.
p_line_buffer | Pointer to the barcode line buffer. |
References BARCODE_LINE_BLACK_THICK, BARCODE_LINE_BLACK_THIN, BARCODE_LINE_WHITE_THICK, BARCODE_LINE_WHITE_THIN, DEBUG_PRINT, barcode_line_buffer::line_buffer, and barcode_line_buffer::line_buffer_index.
void barcode_clear_line_buffer | ( | barcode_line_buffer_t * | p_line_buffer | ) |
Initialises or clears the barcode line buffer.
p_line_buffer | Pointer to the barcode line buffer. |
References barcode_line_buffer::line_buffer_index.
barcode_char_t barcode_decode_barcode_char | ( | barcode_line_buffer_t * | p_line_buffer | ) |
Decodes the barcode character enum from the line buffer.
p_line_buffer | Pointer to the barcode line buffer. |
References BARCODE_LINE_BLACK_THICK, BARCODE_LINE_WHITE_THICK, barcode_line_buffer::line_buffer, and barcode_line_buffer::line_buffer_index.
char barcode_get_char | ( | barcode_char_t | barcode_char | ) |
Gets the character from the barcode character enum.
barcode_char | Barcode character enum. |
References BARCODE_CHAR_0, BARCODE_CHAR_1, BARCODE_CHAR_2, BARCODE_CHAR_3, BARCODE_CHAR_4, BARCODE_CHAR_5, BARCODE_CHAR_6, BARCODE_CHAR_7, BARCODE_CHAR_8, BARCODE_CHAR_9, BARCODE_CHAR_A, BARCODE_CHAR_ASTERISK, BARCODE_CHAR_B, BARCODE_CHAR_C, BARCODE_CHAR_D, BARCODE_CHAR_DASH, BARCODE_CHAR_DOLLAR, BARCODE_CHAR_E, BARCODE_CHAR_F, BARCODE_CHAR_G, BARCODE_CHAR_H, BARCODE_CHAR_I, BARCODE_CHAR_J, BARCODE_CHAR_K, BARCODE_CHAR_L, BARCODE_CHAR_M, BARCODE_CHAR_N, BARCODE_CHAR_O, BARCODE_CHAR_P, BARCODE_CHAR_PERCENT, BARCODE_CHAR_PERIOD, BARCODE_CHAR_PLUS, BARCODE_CHAR_Q, BARCODE_CHAR_R, BARCODE_CHAR_S, BARCODE_CHAR_SLASH, BARCODE_CHAR_SPACE, BARCODE_CHAR_T, BARCODE_CHAR_U, BARCODE_CHAR_V, BARCODE_CHAR_W, BARCODE_CHAR_X, BARCODE_CHAR_Y, and BARCODE_CHAR_Z.
char * barcode_line_to_string | ( | barcode_line_type_t | line_type | ) |
Helper function to get the barcode line type as a string.
line_type | Barcode line type. |
References BARCODE_LINE_BLACK_THICK, BARCODE_LINE_BLACK_THIN, BARCODE_LINE_WHITE_THICK, and BARCODE_LINE_WHITE_THIN.
int8_t barcode_update_line_buffer | ( | barcode_line_buffer_t * | p_line_buffer, |
barcode_line_type_t | line_type | ||
) |
Updates the line buffer with the line type detected.
p_line_buffer | Pointer to the line type buffer. |
line_type | The line type detected. |
References BARCODE_LINE_NONE, BARCODE_LINE_WHITE_THICK, BARCODE_LINE_WHITE_THIN, BARCODE_MAX_LINES, BARCODE_READ_CONTINUE, BARCODE_READ_ERROR, BARCODE_READ_NO_OP, BARCODE_READ_SUCCESS, barcode_line_buffer::line_buffer, and barcode_line_buffer::line_buffer_index.