 /*
 * David Muller; Germán Alfaro
 * davehmuller@gmail.com; alfaro.germanevera@gmail.com
 *
 * Thom Maughan: MBARI, tm@mbari.org  from 2/2018
 */

#ifndef MPHOX_OPTODE_H_
#define MPHOX_OPTODE_H_

#define CONDO_BAUD     9600

void condo_init(void);
void condo_open(void);
void condo_poll(void);
void condo_close(void);
void condo_print_buf(void);

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

/*
 * Optode.c function prototypes:
 */
//void Init_Optode(void);
//void optode_init(void);
//void optode_open(void);
//void optode_close(void);
//int optode_stateMachine(int optodeState);
//void optode_print_buf(void);
//void optode_comm_test(void);
//void optode_IntHandler(void);  //isr
//
//void optode_poll(void);
//void parseOptodeData(void);


// Serial Connection
extern void condo_config(uint32_t ui32Port, uint32_t ui32Baud,
                            uint32_t ui32SrcClock);
extern int condo_gets(char *pcBuf, uint32_t ui32Len);
extern unsigned char condo_getc(void);
extern int condo_write(const char *pcBuf, uint32_t ui32Len);
extern int condo_peek(unsigned char ucChar);
extern void condo_flushTx(bool bDiscard);
extern void condo_flushRx(void);
extern int condo_rxBytesAvail(void);
extern int condo_txBytesFree(void);
extern void condo_echoSet(bool bEnable);
extern int condo_putc(const char c);

//extern void condo_IntHandler(void);




#endif /* SEAPHOX_MFET_OPTODE_H_ */
