/*
 * user_io.h
 *
 * Input/Output functions used mostly by console port.
 *
 *  Created on: Jan 23, 2014
 *      Author: rob
 */

#ifndef PHFETSOS_USER_IO_H_
#define PHFETSOS_USER_IO_H_

#define YES				  		1
#define NO				  		0
#define TIMELIMITPASSED  		-1

void ConfigureUART(void);
void print_newline(int mode);  // print_newline(sys_data.newline_mode), 0=cr-lf, 1=cr
void prn_nl(void);              // shorthand for print_newline(sys_data.newline_mode)
void newline_test(void);
uint32_t sprintf_newline(char *bufPtr, uint32_t bufIndx, int mode);
uint32_t sprn_nl(char *bufPtr, uint32_t bufIndx);

time_t getDateAndTime();
void printCurrentTime(void);
void printCurrentEpochTime(void);
void print_time_t_Time(time_t time);

int yesOrNoMenuChoice(char *prompt, int default_response);
int yesOrNoMenuChoiceEcho(char *prompt, int default_response);
int yesOrNoMenuChoiceTimeLimit(char *prompt, int timeLimit);

int getUserInput(char *userInputBuffer,  int userInputBufferSize);
int getUserInputTimeLimit(char *userInputBuffer, int userInputBufferSize, int timeLimit);

void printSysDataParameters();

int32_t getLong(char *prompt);
uint32_t getUnsignedLong (char* prompt);
float getFloat(char *prompt);
void ftoa(long double f,char *buf,int dplaces);

bool kbhit(void);
int getchar_timed(int timeout);
int getChar(void);
char get_key(void);

uint8_t get_key_m2m(void);

int uprintf(const char *format, ...);
int dbg_printf(const char *format, ...);




#endif /* PHFETSOS_USER_IO_H_ */
