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

#ifndef OCR_H_
#define OCR_H_

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

void ocr_init(void);

unsigned char ocr_getc(void);
void ocr_putc(unsigned char c);
int ocr_rxBytesAvail(void);
void ocr_flushRx(void);
void ocr_flushTx(bool bDiscard);
int ocr_write(const char *pcBuf, uint32_t ui32Len);
int ocr_rx_str(char *pcBuf, uint32_t ui32Len);

void ocr_comm_test(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_ */
