/*
 * ocr.h
 *
 *  Created on: Nov 15, 2021
 *      Author: tm
 */

#ifndef PHFETSOS_OCR_H_
#define PHFETSOS_OCR_H_

#define OCR_BAUD    57600       // satlantic riduculousness on default baud rate

void ocr_init(void);
void ocr_open(void);
void ocr_close(void);

unsigned char ocr_getc(void);
void ocr_putc(unsigned char c);
int ocr_rxBytesAvail(void);
int ocr_rx_str(char *pcBuf, uint32_t ui32Len);

void ocr_flushRx(void);
void ocr_flushTx(bool bDiscard);
int ocr_write(const char *pcBuf, uint32_t ui32Len);

void ocr_buf_print(void);
int ocr_buf_size(void);
int ocr_buf_write(unsigned char inChar);

int ocr_stateMachine(int ocrState);
uint32_t ocr_qa_test(void);
void ocr_comm_test(void);


int ocr_parseData(void);

struct ocrDriver
{
             int state;
    unsigned int old_tick10ms;      // for timeout
    unsigned int new_tick10ms;
    unsigned int bufIndx;
             int dataCnt;
    //unsigned char buf[OCR_BUFFER_SIZE];      // defd in system.h
};

#endif /* OCR_H_ */
