Skip to content

File oled_sh1106.h

File List > dev > oled_sh1106.h

Go to the documentation of this file

Source Code

#ifndef __OLED_SH1106_H__
#define __OLED_SH1106_H__

#include "dev/oled_ssd130x.h"

namespace daisy
{
template <size_t width, size_t height, typename Transport>
class SH1106Driver : public SSD130xDriver<width, height, Transport>
{
  public:
    void Update()
    {
        uint8_t i;
        uint8_t high_column_addr;
        switch(height)
        {
            case 32: high_column_addr = 0x12; break;

            default: high_column_addr = 0x10; break;
        }
        for(i = 0; i < (height / 8); i++)
        {
            this->transport_.SendCommand(0xB0 + i);
            this->transport_.SendCommand(0x02);
            this->transport_.SendCommand(high_column_addr);
            this->transport_.SendData(&this->buffer_[width * i], width);
        }
    };
};

using SH11064WireSpi128x64Driver
    = SH1106Driver<128, 64, SSD130x4WireSpiTransport>;

using SH1106I2c128x64Driver = SH1106Driver<128, 64, SSD130xI2CTransport>;

}; // namespace daisy

#endif