You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 line
835B

  1. #ifndef SENSOR_H
  2. #define SENSOR_H
  3. #include <stdint.h>
  4. #include <limits.h>
  5. #include "periph/adc.h"
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. typedef struct {
  10. uint8_t lower;
  11. uint8_t upper;
  12. adc_t line;
  13. adc_res_t res;
  14. } sensor_params_t;
  15. typedef struct {
  16. sensor_params_t p;
  17. } sensor_t;
  18. /**
  19. * @brief Initializes the sensor
  20. *
  21. * @param[in] dev device settings struct
  22. * @param[in] params settings for parameters
  23. */
  24. int sensor_init(sensor_t *dev, const sensor_params_t *params);
  25. /**
  26. * @brief Read data from the sensor and checks the value is between given thresholds
  27. *
  28. * @param[in] dev device settings struct
  29. * @param[out] data boolean that is true when sensor value is within thresholds.
  30. */
  31. int sensor_read(sensor_t *dev, bool *data);
  32. #ifdef __cplusplus
  33. }
  34. #endif
  35. #endif /* SENSOR_H */