Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of el17ajf by
Graphics/Graphics.cpp
- Committer:
- el17ajf
- Date:
- 2019-03-15
- Revision:
- 8:5066ce13a430
- Parent:
- 5:3efbdcb3efaf
- Child:
- 9:3a7776a29a11
File content as of revision 8:5066ce13a430:
#include "Graphics.h" void Graphics::init() { lcd = new N5110(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); lcd.init(); lcd.setContrast(0.4); } void Graphics::deinit() { delete lcd; } void Graphics::update() { // TODO } void Graphics::clear() { // TODO lcd.clear(); } void Graphics::render() { // TODO } void Graphics::drawPoint(int x, int y) { lcd->setPixel(x, y, true); } void Graphics::drawLine(int x1, int y1, int x2, int y2) { lcd->drawLine(x1, y1, x2, y2, 1); } void Graphics::drawDottedLine(int x1, int y1, int x2, int y2) { lcd->drawLine(x1, y1, x2, y2, 2); } void Graphics::drawBox(int x1, int y1, int x2, int y2) { Graphics::drawLine(x1, y1, x2, y1); Graphics::drawLine(x2, y1, x2, y2); Graphics::drawLine(x2, y2, x1, y2); Graphics::drawLine(x1, y2, x1, y1); } void Graphics::drawBlock(int grid_x, int grid_y) { // TODO int x = grid_x; Graphics::drawBox(x, y, x + 3, y + 3); Graphics::drawPoint(x + 2, y + 2); } void Graphics::drawBorder() { Graphics::drawDottedLine(0, 0, 0, HEIGHT - 1); Graphics::drawDottedLine(1, 1, 1, HEIGHT - 2); Graphics::drawDottedLine(0, HEIGHT - 1, WIDTH - 1, HEIGHT - 1); Graphics::drawDottedLine(1, HEIGHT - 2, WIDTH - 2, HEIGHT - 2); Graphics::drawDottedLine(WIDTH - 1, HEIGHT - 1, WIDTH - 1, 0); Graphics::drawDottedLine(WIDTH - 2, HEIGHT - 2, WIDTH - 2, 1); }