/*
 * sample.h
 *
 *  Created on: Jun 8, 2021
 *      Author: thomm
 */

#ifndef PHFETSOS_SAMPLE_H_
#define PHFETSOS_SAMPLE_H_

#include "system.h"

extern unsigned char prnBuf[SIZEOF_PRNBUF+4];

void print_bias_volt_iso(void);
void read_bias_bat(void);
float batt_volt_iso(void);
float batt_volt(void);

float read_vbat(void);
float read_env_sensors(void);
float controller_temp(void);


void get_sample(int printFlg, int writeFlg);

void databarf_loop(void);
void test_get_sample_loop(void);
void test_get_sample_timing(void);
void pump_and_sample_loop_test();
void pump_and_sample_timing_test();

void pump_stateMachine_init(void);
int pump_stateMachine(int pump_seq_state, int printFlg, int writeFlg);
int pump_and_sample(int printFlg, int writeFlg);
void pump_and_sample_start(void);
void pump_var_init(void);

// pump sequencer state machine defs
#define ST_SEQ_NADA             0
#define ST_SEQ_START            1
#define ST_SEQ_PUMP1            2
#define ST_SEQ_PUMP1_ONTIME     3
#define ST_SEQ_PUMP2            4
#define ST_SEQ_PUMP2_ONTIME     5
#define ST_SEQ_WAIT_TO_START    6

#endif /* PHFETSOS_SAMPLE_H_ */
