#include "pixelstream.h"

#include "display.h"

using namespace lib;

PixelStream::PixelStream(Display& display) :
  display(display)
{
  display.send_command_and_begin_data_stream(0x2C);
}

void PixelStream::write(uint8_t data) { display.send_data(data); }

void PixelStream::write(uint8_t red, uint8_t green, uint8_t blue)
{
  const uint8_t data[3] = { red, green, blue };
  display.send_data(data, 3);
}

void PixelStream::write(const uint8_t* data, size_t datalen)
{
  display.send_data(data, datalen);
}

PixelStream::~PixelStream() { display.end_data_stream(); }
