2016-11-26 01:22:18 -04:00
|
|
|
/*
|
|
|
|
* AP_IRLock_I2C.h
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "IRLock.h"
|
|
|
|
|
|
|
|
class AP_IRLock_I2C : public IRLock
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// init - initialize sensor library
|
2017-04-11 21:18:51 -03:00
|
|
|
void init(int8_t bus) override;
|
2016-11-26 01:22:18 -04:00
|
|
|
|
|
|
|
// retrieve latest sensor data - returns true if new data is available
|
2017-04-13 17:40:41 -03:00
|
|
|
bool update() override;
|
2016-11-26 01:22:18 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
AP_HAL::OwnPtr<AP_HAL::Device> dev;
|
|
|
|
|
|
|
|
struct PACKED frame {
|
|
|
|
uint16_t checksum;
|
|
|
|
uint16_t signature;
|
|
|
|
uint16_t pixel_x;
|
|
|
|
uint16_t pixel_y;
|
|
|
|
uint16_t pixel_size_x;
|
|
|
|
uint16_t pixel_size_y;
|
|
|
|
};
|
|
|
|
|
|
|
|
bool timer(void);
|
|
|
|
|
|
|
|
bool sync_frame_start(void);
|
2016-11-26 01:22:18 -04:00
|
|
|
bool read_block(struct frame &irframe);
|
2017-01-13 15:26:14 -04:00
|
|
|
void read_frames(void);
|
2016-11-26 01:22:18 -04:00
|
|
|
|
2016-11-26 01:22:18 -04:00
|
|
|
void pixel_to_1M_plane(float pix_x, float pix_y, float &ret_x, float &ret_y);
|
2016-11-26 01:22:18 -04:00
|
|
|
|
2018-10-11 20:35:04 -03:00
|
|
|
HAL_Semaphore sem;
|
2016-11-27 23:08:17 -04:00
|
|
|
uint32_t _last_read_ms;
|
2016-11-26 01:22:18 -04:00
|
|
|
};
|