2016-09-30 04:21:28 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Display.h"
|
2017-01-19 03:15:24 -04:00
|
|
|
#include "Display_Backend.h"
|
2016-09-30 04:21:28 -03:00
|
|
|
#include <AP_HAL/I2CDevice.h>
|
|
|
|
|
|
|
|
#define SH1106_COLUMNS 132 // display columns
|
|
|
|
#define SH1106_ROWS 64 // display rows
|
|
|
|
#define SH1106_ROWS_PER_PAGE 8
|
|
|
|
|
2017-01-19 03:15:24 -04:00
|
|
|
class Display_SH1106_I2C: public Display_Backend {
|
2016-09-30 04:21:28 -03:00
|
|
|
|
2017-01-19 03:15:24 -04:00
|
|
|
public:
|
2017-01-20 02:42:53 -04:00
|
|
|
|
2017-03-10 21:16:55 -04:00
|
|
|
static Display_SH1106_I2C *probe(AP_HAL::OwnPtr<AP_HAL::Device> dev);
|
|
|
|
|
2017-01-21 00:59:00 -04:00
|
|
|
void hw_update() override;
|
|
|
|
void set_pixel(uint16_t x, uint16_t y) override;
|
|
|
|
void clear_pixel(uint16_t x, uint16_t y) override;
|
|
|
|
void clear_screen() override;
|
2016-09-30 04:21:28 -03:00
|
|
|
|
2017-03-10 21:16:55 -04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
Display_SH1106_I2C(AP_HAL::OwnPtr<AP_HAL::Device> dev);
|
|
|
|
~Display_SH1106_I2C() override;
|
|
|
|
|
2016-09-30 04:21:28 -03:00
|
|
|
private:
|
2017-03-10 21:16:55 -04:00
|
|
|
|
|
|
|
bool hw_init() override;
|
|
|
|
|
2017-01-19 03:15:24 -04:00
|
|
|
void _timer();
|
|
|
|
|
2017-01-20 02:42:53 -04:00
|
|
|
AP_HAL::OwnPtr<AP_HAL::Device> _dev;
|
2016-09-30 04:21:28 -03:00
|
|
|
uint8_t _displaybuffer[SH1106_COLUMNS * SH1106_ROWS_PER_PAGE];
|
|
|
|
bool _need_hw_update;
|
2017-03-10 21:16:55 -04:00
|
|
|
|
2016-09-30 04:21:28 -03:00
|
|
|
};
|