/*
 *
 */

#ifndef __UI_UI_H_
#define __UI_UI_H_


#include <Arduino.h>
#include <DNSServer.h>



typedef struct BtnCb {
	void (*push_cb)();
	void (*held_cb)();
	void (*release_cb)();
	uint16_t held_cb_count;
} BtnCb;



#define BTN_TOUCH_1_PIN				12
#define BTN_TOUCH_2_PIN				13
#define BTN_TOUCH_SFONE_PIN			14
#define BTN_TOUCH_ERECTUS_PIN		27

#define BTN_TOUCH_COUNT 			4	// amount of touch buttons

#define BTN_PUSH_DEBOUNCE_COUNTS 	16	// debounce / false reject counts, currently ~80ms
#define BTN_HELD_ONE_SEC_COUNTS		200	// should equal counts to be one second



extern String conf_name;
extern String conf_psk2;
extern String conf_titl;
extern String conf_yoff;

extern DNSServer dns;



void btn_init();
void btn_tick();

uint16_t btn_read_raw(uint8_t btn);
uint16_t btn_read_counts(uint8_t btn);
uint16_t btn_read_baseline(uint8_t btn);

void btn_set_cb(uint8_t btn, void (*push)(), void (*held)(), void (*release)());
void btn_cb_process();

uint8_t btn_get_calibrated();


void httpd_init();
void httpd_start();
void httpd_stop();


#endif // __UI_UI_H_
