#ifndef PROX_CONTROL_H_ #define PROX_CONTROL_H_ #define MIN_PROX_VALUE (100u) // most likely below this value is incorrect, prox usually returns non-zero values for real data #define MAX_PROX_VALUE (16383u) // 2^14 - 1 typedef struct prox_ { uint16_t current_prox_data; uint16_t offset; uint16_t proximity_threshold; uint16_t proximity_hysteresis; uint16_t programmed_cal; int16_t user_trim; bool connected; bool calibrated; bool person_detected; // true when proximity value above detection threshold (plus hysteresis) } Proximity_T; bool prox_init(void); bool prox_is_connected(void); void prox_update(void); bool prox_hmd_on_person(void); uint16_t prox_get_distance(void); void prox_set_threshold(uint16_t newthresh); void prox_set_hysteresis(uint16_t newhyst); bool prox_set_offset(uint16_t newoffset); void prox_set_user_trim(int16_t newtrim); Prox_Settings* prox_get_settings(void); bool prox_apply_settings(void); // **** Debugging **** // check if a disconnection occurred after being connected // periodic report can show the disconnection status bool prox_was_connected(void); void prox_clear_was_connected(void); #endif // PROX_CONTROL_H_