APM:Libraries
AP_IRLock_I2C.h
Go to the documentation of this file.
1 /*
2  * AP_IRLock_I2C.h
3  *
4  */
5 #pragma once
6 
7 #include "IRLock.h"
8 
9 class AP_IRLock_I2C : public IRLock
10 {
11 public:
12  // init - initialize sensor library
13  void init(int8_t bus) override;
14 
15  // retrieve latest sensor data - returns true if new data is available
16  bool update() override;
17 
18 private:
20 
21  struct PACKED frame {
22  uint16_t checksum;
23  uint16_t signature;
24  uint16_t pixel_x;
25  uint16_t pixel_y;
26  uint16_t pixel_size_x;
27  uint16_t pixel_size_y;
28  };
29 
30  bool timer(void);
31 
32  bool sync_frame_start(void);
33  bool read_block(struct frame &irframe);
34  void read_frames(void);
35 
36  void pixel_to_1M_plane(float pix_x, float pix_y, float &ret_x, float &ret_y);
37 
39  uint32_t _last_read_ms;
40 };
bool timer(void)
bool update() override
uint32_t _last_read_ms
Definition: AP_IRLock_I2C.h:39
AP_HAL::Semaphore * sem
Definition: AP_IRLock_I2C.h:38
void init(int8_t bus) override
void pixel_to_1M_plane(float pix_x, float pix_y, float &ret_x, float &ret_y)
bool read_block(struct frame &irframe)
Definition: IRLock.h:26
void read_frames(void)
#define PACKED
Definition: AP_Common.h:28
AP_HAL::OwnPtr< AP_HAL::Device > dev
Definition: AP_IRLock_I2C.h:19
bool sync_frame_start(void)