/*
 * Aux_port.h
 *
 *  Created on: Feb 4, 2014
 *      Author: rob
 */

#ifndef MPHOX_AUX1_H_
#define MPHOX_AUX1_H_

// Macros
#if BOARD_SEAPHOX == 1
#define AUX1_on() 	MAP_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xff);	// Power on
#define AUX1_off() 	MAP_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);	// Power off
#endif

#if BOARD_MFET >= 1 || BOARD_MPHOX == 1
#define AUX1_on()   MAP_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_1, 0xff);    // Power on
#define AUX1_off()  MAP_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_1, 0x00);    // Power off
#endif

#if BOARD_NANOFET
#define AUX1_on()   MAP_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1, 0xff);    // Power on
#define AUX1_off()  MAP_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1, 0x00);    // Power off
#endif

//*****************************************************************************
//
// Prototypes for the APIs.
//
//*****************************************************************************
/*
 * Optode.c function prototypes:
 */

#ifdef OLDCODE
#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
};

#endif


extern void Init_AUX1(void);
extern void Open_AUX1(void);
extern void Close_AUX1(void);



extern void uart2_Config(uint32_t ui32Port, uint32_t ui32Baud,
                            uint32_t ui32SrcClock);
extern int uart2_gets(char *pcBuf, uint32_t ui32Len);
extern unsigned char uart2_getc(void);
extern int uart2_write(const char *pcBuf, uint32_t ui32Len);
extern int uart2_peek(unsigned char ucChar);
extern void uart2_flushTx(bool bDiscard);
extern void uart2_flushRx(void);
extern int uart2_rxBytesAvail(void);
extern int uart2_txBytesFree(void);
extern void uart2_echoSet(bool bEnable);





#endif /* AUX1_PORT_H_ */
