ardupilot/libraries/AP_IRLock/AP_IRLock_I2C.h
Randy Mackay bac5deed43 AP_IRLock: health reporting based on successful I2C transfer
This change is required because sync messages are only sent if a target is visible
2016-11-28 12:08:36 +09:00

41 lines
787 B
C++

/*
* AP_IRLock_I2C.h
*
*/
#pragma once
#include "IRLock.h"
class AP_IRLock_I2C : public IRLock
{
public:
// init - initialize sensor library
void init();
// retrieve latest sensor data - returns true if new data is available
bool update();
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);
bool read_block(struct frame &irframe);
bool read_frames(void);
void pixel_to_1M_plane(float pix_x, float pix_y, float &ret_x, float &ret_y);
AP_HAL::Semaphore *sem;
uint32_t _last_read_ms;
};