94 lines
1.7 KiB
C++
94 lines
1.7 KiB
C++
#include <chrono>
|
|
#include <cmath>
|
|
#include <iostream>
|
|
#include <thread>
|
|
#include <vector>
|
|
|
|
|
|
using namespace std::chrono_literals;
|
|
|
|
#include "display/EPD_7in5_V2.hpp"
|
|
#include "render/RenderTarget.hpp"
|
|
|
|
int main()
|
|
{
|
|
constexpr double pi = 3.14159;
|
|
|
|
frame::display::EPD_7in5_V2 display{};
|
|
|
|
display.Init();
|
|
|
|
display.Clear(frame::display::Color::WHITE);
|
|
|
|
frame::render::RenderTarget target(display.getSize());
|
|
|
|
frame::Vector const center = (display.getSize() / 2);
|
|
|
|
target.DrawPixel({10, 10}, frame::BLACK);
|
|
target.DrawLine({10, 12}, {100, 12}, frame::BLACK);
|
|
|
|
for(int i = 0; i < 360; i += 15)
|
|
{
|
|
auto end = center;
|
|
|
|
double const x = std::cos(i * pi / 180.f) * 200.f;
|
|
double const y = std::sin(i * pi / 180.f) * 200.f;
|
|
|
|
end.x += (int)x;
|
|
end.y += (int)y;
|
|
|
|
target.DrawLine(center, end);
|
|
}
|
|
|
|
target.DrawCircle(center, 210);
|
|
|
|
display.Display(target.getImage());
|
|
|
|
std::this_thread::sleep_for(10s);
|
|
|
|
display.Clear(frame::display::Color::WHITE);
|
|
}
|
|
|
|
/*
|
|
#include <EPD_7in5_V2.h>
|
|
|
|
|
|
int main()
|
|
{
|
|
std::cout << "Hallo Welt" << std::endl;
|
|
|
|
EPD_7IN5_V2_Init();
|
|
|
|
EPD_7IN5_V2_ClearBlack();
|
|
|
|
std::this_thread::sleep_for(2s);
|
|
|
|
EPD_7IN5_V2_Clear();
|
|
|
|
std::this_thread::sleep_for(2s);
|
|
|
|
std::vector<uint8_t> image;
|
|
image.resize(EPD_7IN5_V2_HEIGHT * EPD_7IN5_V2_WIDTH);
|
|
|
|
uint8_t color = 0;
|
|
for(int x = 0; x < EPD_7IN5_V2_WIDTH; ++x)
|
|
{
|
|
for(int y = 0; y < EPD_7IN5_V2_HEIGHT; ++y)
|
|
{
|
|
image[EPD_7IN5_V2_WIDTH * y + x] = color;
|
|
}
|
|
|
|
color = ~color;
|
|
}
|
|
|
|
EPD_7IN5_V2_Display(image.data());
|
|
|
|
std::this_thread::sleep_for(10s);
|
|
|
|
EPD_7IN5_V2_Clear();
|
|
EPD_7IN5_V2_Sleep();
|
|
|
|
return 0;
|
|
}
|
|
*/
|