mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 17:47:21 +02:00
27 lines
553 B
C++
27 lines
553 B
C++
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include "driver/i2c_master.h"
|
|
|
|
#ifndef OLED_H
|
|
#define OLED_H
|
|
|
|
class Oled {
|
|
public:
|
|
Oled(uint8_t sda_pin, uint8_t scl_pin) {
|
|
init(sda_pin, scl_pin);
|
|
};
|
|
void clear_display();
|
|
void set_contrast(uint8_t contrast);
|
|
void display_text(const std::string& text);
|
|
|
|
private:
|
|
void init(uint8_t sda_pin, uint8_t scl_pin);
|
|
void rotate8x8(uint8_t in[8], uint8_t out[8]);
|
|
|
|
i2c_master_bus_handle_t bus_handle = nullptr;
|
|
i2c_master_dev_handle_t dev_handle = nullptr;
|
|
};
|
|
|
|
#endif // OLED_H
|