aboutsummaryrefslogtreecommitdiffhomepage
path: root/source/Core/Drivers/Si7210.h
blob: 2bbc46bea6d7612fbfd6bd719a3db1280c0cbd23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Si7210.h
 *
 *  Created on: 5 Oct. 2020
 *      Author: Ralim
 */

#ifndef CORE_DRIVERS_SI7210_H_
#define CORE_DRIVERS_SI7210_H_
#include "configuration.h"
#include <stdint.h>

#ifdef MAG_SLEEP_SUPPORT
class Si7210 {
public:
  // Return true if present
  static bool detect();

  static bool    init();
  static int16_t read();

private:
  static bool write_reg(const uint8_t reg, const uint8_t mask, const uint8_t val);
  static bool read_reg(const uint8_t reg, uint8_t *val);
  static bool start_periodic_measurement();
  static bool get_field_strength(int16_t *field);
  static bool set_high_range();
};
#endif // MAG_SLEEP_SUPPORT
#endif /* CORE_DRIVERS_SI7210_H_ */