 /*
 * Thom Maughan: MBARI, tm@mbari.org  from 11/2022
 */

#ifndef PHFETSOS_NANOFET_H_
#define PHFETSOS_NANOFET_H_

#define NANOFET_BAUD     115200   //9600       // Keystroke does not wake at 115200 (that's not the problem, r11 was fixed with a 10.2k

/*
 * NanoFET.c function prototypes:
 */




void nanofet_init(void);
void nanofet_open(void);
void nanofet_close(void);

unsigned char nanofet_getc(void);
void nanofet_putc(unsigned char c);
int nanofet_rxBytesAvail(void);
uint32_t nanofet_waitRx(uint32_t maxWait_10msTick);

void nanofet_flushRx(void);
void nanofet_flushTx(bool bDiscard);
int nanofet_write(const char *pcBuf, uint32_t ui32Len);

void nanofet_buf_print(void);
int nanofet_buf_size(void);
void nanofet_buf_flush(void);

int nanofet_stateMachine(int nanofetState);
uint32_t nanofet_qa_test(void);
void nanofet_comm_test(void);

int nanofet_parseData(void);

void nanofet_serial_analyzer(void);




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


#endif /* SEAPHOX_MFET_NANOFET_H_ */
