/*
 * ph_sender.h
 * Library for front-end sender of pH data, e.g. front-end mFET collecting data to be sent to back end mpHox
 *
 *  Created on: Nov 19, 2021
 *      Author: Irene Hu
 */

#ifndef PH_FRONT_H_
#define PH_FRONT_H_

#include "ph_base.h"
#include "uart3.h" // uart driver for rs232 comms - steal optode's
#include "ads1248_iso.h" // read adc
#include "config.h" // menu to change main mode

// this is in ads1248_iso.c (not .h) so that's prob why it's not included
#if BOARD_MFET >= 1 || BOARD_MPHOX == 1
#define iso_DRDY()          ROM_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_3)
#endif

// initialize and uart wrapper functions
void phf_init(void);
int phf_rxBytesAvail(void);
unsigned char _phf_getc(void);
void _phf_putc(unsigned char c);
void _phf_flushRx(void);
void _phf_flushTx(bool bDiscard);
int _phf_write(const char *pcBuf, uint32_t ui32Len);

// 'public' functions
int phf_measOnce(void);
int phf_measCont(void);
void phf_sortInstructions(void);

// 'private'
void _phf_sendAck(void);
void _phf_sendNack(void);
void _phf_sendpHThermData(struct pH_ptdata *pHDatStruct);


#endif /* PH_FRONT_H_ */
