//Not used:
//#include "nordic_common.h"
//#include "nrf.h"
//#include "nrf51_bitfields.h"
//#include "ble_nus.h"

#define TIMER_20MS_MS(x) (x/20)

#define HALF_SECOND_20_MS               50/2
#define QUARTER_SECOND_20_MS            50/4
#define ONE_SECOND_20_MS                50*1
#define TWO_SECONDS_20_MS               50*2
#define THREE_SECONDS_20_MS             50*3
#define FOUR_SECONDS_20_MS              50*4
#define FIVE_SECONDS_20_MS              50*5
#define SEVEN_SECONDS_20_MS             50*7
#define TEN_SECONDS_20_MS               50*10
#define ONE_MINUTE_20_MS                TEN_SECONDS_20_MS*6
#define SIX_SECONDS_250_MS              24  /* 250ms * 6 = 24 250ms steps to 6 secs */
//#define REGULATOR_1_8_PIN             21


enum {
	BA_ADC_FULL_SCALE,
	BA_ADC_SCALING_INPUT_TWO_THIRDS,
	BA_ADC_SCALING_INPUT_ONE_THIRD
};

enum {
	BA_AVG_MODE_SUM,
	BA_AVG_MODE_AVG,
	BA_AVG_MODE_RAW
};


void ba_init();

//void ba_set_vref_target(uint16_t mv);
//uint16_t ba_vref_target();
void ba_set_adc_mode(int mode);
//void ba_set_avg_mode(int mode);
int32_t ba_read_sensor();
int32_t ba_calc_mv(int32_t sample);
int32_t ba_read_sensor_mv();
int32_t ba_read_battery();
int32_t ba_read_battery_mv();

//float ba_calc_bac(int32_t first, int32_t min);
//void ba_print_bac(char * str, float bac);

//void ba_init_ppm();
//int16_t ba_get_ppm_sample();
//int ba_calc_ppm_bac();
//uint8_t ba_is_ppm_done();

//void ba_set_sensor_enable(uint8_t enabled);


