SSL_GFX
This commit is contained in:
98
Core/Src/Components/BMplain_font.h
Normal file
98
Core/Src/Components/BMplain_font.h
Normal file
@@ -0,0 +1,98 @@
|
||||
const unsigned char font[96][6] = {
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00}, //
|
||||
{0x2e,0x00,0x00,0x00,0x00,0x00}, // !
|
||||
{0x03,0x00,0x03,0x00,0x00,0x00}, // "
|
||||
{0x0a,0x1f,0x0a,0x1f,0x0a,0x00}, // #
|
||||
{0x2e,0x2a,0x6b,0x2a,0x3a,0x00}, // $
|
||||
{0x0e,0x2a,0x1e,0x08,0x3c,0x2a}, // %
|
||||
{0x3e,0x2a,0x2a,0x22,0x38,0x08}, // &
|
||||
{0x03,0x00,0x00,0x00,0x00,0x00}, // '
|
||||
{0x1c,0x22,0x00,0x00,0x00,0x00}, // (
|
||||
{0x22,0x1c,0x00,0x00,0x00,0x00}, // )
|
||||
{0x15,0x0e,0x04,0x0e,0x15,0x00}, // *
|
||||
{0x08,0x08,0x3e,0x08,0x08,0x00}, // +
|
||||
{0x60,0x00,0x00,0x00,0x00,0x00}, // ,
|
||||
{0x08,0x08,0x08,0x08,0x08,0x00}, // -
|
||||
{0x20,0x00,0x00,0x00,0x00,0x00}, // .
|
||||
{0x20,0x10,0x08,0x04,0x02,0x00}, // /
|
||||
{0x3e,0x22,0x2a,0x22,0x3e,0x00}, // 0
|
||||
{0x04,0x3e,0x00,0x00,0x00,0x00}, // 1
|
||||
{0x3a,0x2a,0x2a,0x2a,0x2e,0x00}, // 2
|
||||
{0x2a,0x2a,0x2a,0x2a,0x3e,0x00}, // 3
|
||||
{0x0e,0x08,0x08,0x08,0x3e,0x00}, // 4
|
||||
{0x2e,0x2a,0x2a,0x2a,0x3a,0x00}, // 5
|
||||
{0x3e,0x2a,0x2a,0x2a,0x3a,0x00}, // 6
|
||||
{0x02,0x02,0x02,0x02,0x3e,0x00}, // 7
|
||||
{0x3e,0x2a,0x2a,0x2a,0x3e,0x00}, // 8
|
||||
{0x2e,0x2a,0x2a,0x2a,0x3e,0x00}, // 9
|
||||
{0x14,0x00,0x00,0x00,0x00,0x00}, // :
|
||||
{0x34,0x00,0x00,0x00,0x00,0x00}, // ;
|
||||
{0x08,0x14,0x22,0x00,0x00,0x00}, // <
|
||||
{0x14,0x14,0x14,0x14,0x14,0x00}, // =
|
||||
{0x22,0x14,0x08,0x00,0x00,0x00}, // >
|
||||
{0x06,0x02,0x2a,0x0a,0x0e,0x00}, // ?
|
||||
{0x3e,0x02,0x3a,0x2a,0x3e,0x00}, // @
|
||||
{0x3e,0x12,0x12,0x12,0x3e,0x00}, // A
|
||||
{0x3e,0x2a,0x2a,0x2a,0x36,0x00}, // B
|
||||
{0x3e,0x22,0x22,0x22,0x22,0x00}, // C
|
||||
{0x3e,0x22,0x22,0x22,0x1c,0x00}, // D
|
||||
{0x3e,0x2a,0x2a,0x2a,0x22,0x00}, // E
|
||||
{0x3e,0x0a,0x0a,0x0a,0x02,0x00}, // F
|
||||
{0x3e,0x22,0x2a,0x2a,0x3a,0x00}, // G
|
||||
{0x3e,0x08,0x08,0x08,0x3e,0x00}, // H
|
||||
{0x22,0x3e,0x22,0x00,0x00,0x00}, // I
|
||||
{0x38,0x20,0x20,0x20,0x3e,0x00}, // J
|
||||
{0x3e,0x08,0x08,0x14,0x22,0x00}, // K
|
||||
{0x3e,0x20,0x20,0x20,0x20,0x00}, // L
|
||||
{0x3e,0x04,0x38,0x04,0x3e,0x00}, // M
|
||||
{0x3e,0x04,0x08,0x10,0x3e,0x00}, // N
|
||||
{0x3e,0x22,0x22,0x22,0x3e,0x00}, // O
|
||||
{0x3e,0x0a,0x0a,0x0a,0x0e,0x00}, // P
|
||||
{0x3e,0x22,0x72,0x22,0x3e,0x00}, // Q
|
||||
{0x3e,0x0a,0x0a,0x1a,0x2e,0x00}, // R
|
||||
{0x2e,0x2a,0x2a,0x2a,0x3a,0x00}, // S
|
||||
{0x02,0x02,0x3e,0x02,0x02,0x00}, // T
|
||||
{0x1e,0x20,0x20,0x20,0x1e,0x00}, // U
|
||||
{0x0e,0x10,0x20,0x10,0x0e,0x00}, // V
|
||||
{0x3e,0x10,0x0e,0x10,0x3e,0x00}, // W
|
||||
{0x22,0x14,0x08,0x14,0x22,0x00}, // X
|
||||
{0x02,0x04,0x38,0x04,0x02,0x00}, // Y
|
||||
{0x3a,0x2a,0x2a,0x2a,0x2e,0x00}, // Z
|
||||
{0x3e,0x22,0x00,0x00,0x00,0x00}, // [
|
||||
{0x3f,0x21,0x3f,0x00,0x00,0x00}, // "\"
|
||||
{0x22,0x3e,0x00,0x00,0x00,0x00}, // ]
|
||||
{0x0c,0x1e,0x3c,0x1e,0x0c,0x00}, // ^
|
||||
{0x20,0x20,0x20,0x20,0x20,0x00}, // _
|
||||
{0x1c,0x3e,0x3e,0x3e,0x1c,0x00}, // `
|
||||
{0x3c,0x24,0x24,0x24,0x3c,0x20}, // a
|
||||
{0x3e,0x24,0x24,0x24,0x3c,0x00}, // b
|
||||
{0x3c,0x24,0x24,0x24,0x24,0x00}, // c
|
||||
{0x3c,0x24,0x24,0x24,0x3e,0x00}, // d
|
||||
{0x3c,0x24,0x34,0x2c,0x24,0x00}, // e
|
||||
{0x08,0x3e,0x0a,0x0a,0x00,0x00}, // f
|
||||
{0x1c,0x54,0x54,0x54,0x7c,0x00}, // g
|
||||
{0x3e,0x04,0x04,0x04,0x3c,0x00}, // h
|
||||
{0x3a,0x00,0x00,0x00,0x00,0x00}, // i
|
||||
{0x7a,0x00,0x00,0x00,0x00,0x00}, // j
|
||||
{0x3e,0x08,0x14,0x22,0x00,0x00}, // k
|
||||
{0x02,0x3e,0x00,0x00,0x00,0x00}, // l
|
||||
{0x3c,0x04,0x3c,0x04,0x3c,0x00}, // m
|
||||
{0x3c,0x04,0x04,0x04,0x3c,0x00}, // n
|
||||
{0x3c,0x24,0x24,0x24,0x3c,0x00}, // o
|
||||
{0x7c,0x24,0x24,0x24,0x3c,0x00}, // p
|
||||
{0x3c,0x24,0x24,0x24,0x7c,0x00}, // q
|
||||
{0x3c,0x04,0x04,0x04,0x00,0x00}, // r
|
||||
{0x24,0x2c,0x34,0x24,0x00,0x00}, // s
|
||||
{0x04,0x3e,0x24,0x24,0x00,0x00}, // t
|
||||
{0x3c,0x20,0x20,0x20,0x3c,0x00}, // u
|
||||
{0x0c,0x10,0x20,0x10,0x0c,0x00}, // v
|
||||
{0x3c,0x20,0x3c,0x20,0x3c,0x00}, // w
|
||||
{0x24,0x24,0x18,0x24,0x24,0x00}, // x
|
||||
{0x1c,0x50,0x50,0x50,0x7c,0x00}, // y
|
||||
{0x24,0x34,0x2c,0x24,0x00,0x00}, // z
|
||||
{0x08,0x3e,0x22,0x00,0x00,0x00}, // {
|
||||
{0x1c,0x22,0x22,0x22,0x1c,0x00}, // |
|
||||
{0x22,0x3e,0x08,0x00,0x00,0x00}, // }
|
||||
{0x01,0x01,0x01,0x00,0x00,0x00}, // ~
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00}
|
||||
};
|
||||
@@ -131,16 +131,13 @@ int32_t ILI9341::readReg32(uint8_t command, uint32_t* reg) {
|
||||
int32_t ILI9341::writeBuffer(uint8_t command, uint8_t* buffer, uint32_t length) {
|
||||
int32_t errors = 0;
|
||||
txBuffer[0] = command;
|
||||
if(length>0){
|
||||
memcpy(txBuffer+1, buffer, length);
|
||||
}
|
||||
errors += hSpi->take(100);
|
||||
errors += hDcrsPin->reset();
|
||||
errors += hNssPin->reset();
|
||||
errors += hSpi->transmit(txBuffer, 1);
|
||||
if(length>0){
|
||||
errors += hDcrsPin->set();
|
||||
errors += hSpi->transmit(txBuffer+1, length);
|
||||
errors += hSpi->transmit(buffer, length);
|
||||
errors += hDcrsPin->reset();
|
||||
}
|
||||
errors += hNssPin->set();
|
||||
|
||||
38
Core/Src/Components/SSL_Display.cpp
Normal file
38
Core/Src/Components/SSL_Display.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* SSL_Display.cpp
|
||||
*
|
||||
* Created on: Feb 11, 2024
|
||||
* Author: Gabriel
|
||||
*/
|
||||
|
||||
#include "SSL_Display.hpp"
|
||||
#include "SSL_GFX.hpp"
|
||||
|
||||
SSL_Display::SSL_Display(ILI9341* hDisplay) :
|
||||
hDisplay(hDisplay){
|
||||
|
||||
}
|
||||
|
||||
SSL_Display::~SSL_Display() {
|
||||
|
||||
}
|
||||
|
||||
int32_t SSL_Display::init() {
|
||||
int32_t errors = 0;
|
||||
errors += hDisplay->init();
|
||||
errors += hDisplay->setBacklight(1);
|
||||
RobotStatus status0;
|
||||
for(uint32_t i = 0; i<12; i++){
|
||||
status0.batteryLevel = ((float)i)/12;
|
||||
status0.connected = true;
|
||||
status0.robotId = i;
|
||||
status0.status = 0;
|
||||
status0.team = 0;
|
||||
robots[i].setRobotStatus(status0);
|
||||
}
|
||||
|
||||
for(uint32_t i = 0; i<12; i++){
|
||||
robots[i].draw();
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
40
Core/Src/Components/SSL_Display.hpp
Normal file
40
Core/Src/Components/SSL_Display.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* SSL_Display.hpp
|
||||
*
|
||||
* Created on: Feb 11, 2024
|
||||
* Author: Gabriel
|
||||
*/
|
||||
|
||||
#ifndef SRC_COMPONENTS_SSL_DISPLAY_HPP_
|
||||
#define SRC_COMPONENTS_SSL_DISPLAY_HPP_
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include "ILI9341.hpp"
|
||||
#include "SSL_GFX.hpp"
|
||||
|
||||
class SSL_Display {
|
||||
public:
|
||||
SSL_Display(ILI9341* hDisplay);
|
||||
virtual ~SSL_Display();
|
||||
int32_t init();
|
||||
private:
|
||||
ILI9341* hDisplay;
|
||||
SSL_GFX robots[12] = {
|
||||
SSL_GFX(hDisplay, 0, 0, buffer, 19200),
|
||||
SSL_GFX(hDisplay, 80, 0, buffer, 19200),
|
||||
SSL_GFX(hDisplay, 160, 0, buffer, 19200),
|
||||
SSL_GFX(hDisplay, 0, 80, buffer, 19200),
|
||||
SSL_GFX(hDisplay, 80, 80, buffer, 19200),
|
||||
SSL_GFX(hDisplay, 160, 80, buffer, 19200),
|
||||
SSL_GFX(hDisplay, 0, 160, buffer, 19200),
|
||||
SSL_GFX(hDisplay, 80, 160, buffer, 19200),
|
||||
SSL_GFX(hDisplay, 160, 160, buffer, 19200),
|
||||
SSL_GFX(hDisplay, 0, 240, buffer, 19200),
|
||||
SSL_GFX(hDisplay, 80, 240, buffer, 19200),
|
||||
SSL_GFX(hDisplay, 160, 240, buffer, 19200),
|
||||
};
|
||||
uint8_t buffer[80][80][3];
|
||||
|
||||
};
|
||||
|
||||
#endif /* SRC_COMPONENTS_SSL_DISPLAY_HPP_ */
|
||||
198
Core/Src/Components/SSL_GFX.cpp
Normal file
198
Core/Src/Components/SSL_GFX.cpp
Normal file
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* SSL_GFX.cpp
|
||||
*
|
||||
* Created on: Feb 11, 2024
|
||||
* Author: Gabriel
|
||||
*/
|
||||
|
||||
#include "SSL_GFX.hpp"
|
||||
#include "BMplain_font.h"
|
||||
|
||||
SSL_GFX::SSL_GFX(ILI9341* hDisplay, uint16_t posX, uint16_t posY, uint8_t hBuffer[][sizeX][3], uint32_t size) :
|
||||
hDisplay(hDisplay), posX(posX), posY(posY), hBuffer(hBuffer), size(size){
|
||||
|
||||
}
|
||||
|
||||
SSL_GFX::~SSL_GFX() {
|
||||
|
||||
}
|
||||
|
||||
int32_t SSL_GFX::init() {
|
||||
int32_t errors = 0;
|
||||
return errors;
|
||||
}
|
||||
|
||||
int32_t SSL_GFX::draw() {
|
||||
if(size != sizeY*sizeX*3){
|
||||
// Invalid parameter
|
||||
return -1;
|
||||
}
|
||||
int32_t errors = 0;
|
||||
uint8_t colorBoundingBox[3];
|
||||
if(robotStatus.connected){
|
||||
colorBoundingBox[0] = 0;
|
||||
colorBoundingBox[1] = 0b11111100;
|
||||
colorBoundingBox[2] = 0;
|
||||
}else{
|
||||
colorBoundingBox[0] = 0b11111100;
|
||||
colorBoundingBox[1] = 0;
|
||||
colorBoundingBox[2] = 0;
|
||||
}
|
||||
errors += drawBoundingBox(colorBoundingBox);
|
||||
uint8_t colorRobot[3] = {0b11111100, 0b11111100, 0b11111100};
|
||||
errors += drawRobotSilhouette(colorRobot);
|
||||
errors += drawId(colorRobot);
|
||||
errors += drawBatteryBar();
|
||||
errors += hDisplay->setPosition(posX, posY, sizeX, sizeY);
|
||||
errors += hDisplay->write((uint8_t*)hBuffer, 19200);
|
||||
return errors;
|
||||
}
|
||||
|
||||
int32_t SSL_GFX::setRobotStatus(RobotStatus status) {
|
||||
robotStatus = status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Private methods
|
||||
|
||||
int32_t SSL_GFX::drawText(uint8_t color[3], uint16_t posX, uint16_t posY, uint8_t* string, uint32_t size) {
|
||||
if(posX+6*size > sizeX){
|
||||
// Out of bounds
|
||||
return -1;
|
||||
}
|
||||
if(posY+6 > sizeY){
|
||||
// Out of bounds
|
||||
return -1;
|
||||
}
|
||||
for(uint32_t i = 0; i<size; i++){
|
||||
for(uint32_t j = 0; j<6; j++){
|
||||
for(uint32_t k = 0; k<6; k++){
|
||||
if((font[string[i]-32][k]>>(j))&1){
|
||||
hBuffer[j+posY][k+posX][0] = color[0];
|
||||
hBuffer[j+posY][k+posX][1] = color[1];
|
||||
hBuffer[j+posY][k+posX][2] = color[2];
|
||||
}else{
|
||||
hBuffer[j+posY][k+posX][0] = 0;
|
||||
hBuffer[j+posY][k+posX][1] = 0;
|
||||
hBuffer[j+posY][k+posX][2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
posX += 6;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t SSL_GFX::drawBoundingBox(uint8_t color[3]) {
|
||||
for(uint32_t i=0; i<sizeX; i++){
|
||||
for(uint32_t j=0; j<3; j++){
|
||||
hBuffer[0][i][j] = color[j];
|
||||
}
|
||||
}
|
||||
for(uint32_t i=0; i<sizeX; i++){
|
||||
for(uint32_t j=0; j<3; j++){
|
||||
hBuffer[sizeY-1][i][j] = color[j];
|
||||
}
|
||||
}
|
||||
for(uint32_t i=0; i<sizeX; i++){
|
||||
for(uint32_t j=0; j<3; j++){
|
||||
hBuffer[i][0][j] = color[j];
|
||||
}
|
||||
}
|
||||
for(uint32_t i=0; i<sizeX; i++){
|
||||
for(uint32_t j=0; j<3; j++){
|
||||
hBuffer[i][sizeX-1][j] = color[j];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t SSL_GFX::drawRobotSilhouette(uint8_t color[3]) {
|
||||
uint16_t x0 = 40;
|
||||
uint16_t y0 = 40;
|
||||
uint16_t r = 20;
|
||||
int16_t f = 1 - r;
|
||||
int16_t ddF_x = 1;
|
||||
int16_t ddF_y = -2 * r;
|
||||
int16_t x = 0;
|
||||
int16_t y = r;
|
||||
|
||||
for(uint32_t i=0; i<3; i++){
|
||||
hBuffer[y0 + r][x0][i] = color[i];
|
||||
//hBuffer[y0 - r][x0][i] = color[i];
|
||||
hBuffer[y0][x0 + r][i] = color[i];
|
||||
hBuffer[y0][x0 - r][i] = color[i];
|
||||
}
|
||||
|
||||
while (x < y) {
|
||||
if (f >= 0) {
|
||||
y--;
|
||||
ddF_y += 2;
|
||||
f += ddF_y;
|
||||
}
|
||||
x++;
|
||||
ddF_x += 2;
|
||||
f += ddF_x;
|
||||
|
||||
for(uint32_t i=0; i<3; i++){
|
||||
hBuffer[y0 + y][x0 + x][i] = color[i];
|
||||
hBuffer[y0 + y][x0 - x][i] = color[i];
|
||||
//hBuffer[y0 - y][x0 + x][i] = color[i];
|
||||
//hBuffer[y0 - y][x0 - x][i] = color[i];
|
||||
hBuffer[y0 + x][x0 + y][i] = color[i];
|
||||
hBuffer[y0 + x][x0 - y][i] = color[i];
|
||||
hBuffer[y0 - x][x0 + y][i] = color[i];
|
||||
hBuffer[y0 - x][x0 - y][i] = color[i];
|
||||
}
|
||||
}
|
||||
while(x>=0){
|
||||
for(uint32_t i=0; i<3; i++){
|
||||
hBuffer[y0 - y][x0 + x][i] = color[i];
|
||||
hBuffer[y0 - y][x0 - x][i] = color[i];
|
||||
}
|
||||
x--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t SSL_GFX::drawRobotLid() {
|
||||
uint32_t errors = 0;
|
||||
return errors;
|
||||
}
|
||||
|
||||
int32_t SSL_GFX::drawId(uint8_t color[3]) {
|
||||
uint32_t errors = 0;
|
||||
errors += drawText(color, 2, 72, (uint8_t*)"ID = ", 5);
|
||||
if(robotStatus.robotId<10){
|
||||
uint8_t robotIdChar = robotStatus.robotId+48;
|
||||
errors += drawText(color, 32, 72, &robotIdChar, 1);
|
||||
}else{
|
||||
uint8_t robotIdChar[2] = {49, robotStatus.robotId+(uint8_t)38};
|
||||
errors += drawText(color, 32, 72, robotIdChar, 2);
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
|
||||
int32_t SSL_GFX::drawBatteryBar() {
|
||||
uint32_t errors = 0;
|
||||
for(uint32_t j = 2; j<6; j++){
|
||||
for(uint32_t k = 2; k<78; k++){
|
||||
if(robotStatus.batteryLevel*76 > k){
|
||||
if(robotStatus.batteryLevel>0.5){
|
||||
hBuffer[j][k][0] = ((uint8_t)(512-robotStatus.batteryLevel*512))&0xFC;
|
||||
hBuffer[j][k][1] = 255&0xFC;
|
||||
hBuffer[j][k][2] = 0;
|
||||
}else{
|
||||
hBuffer[j][k][0] = 255&0xFC;
|
||||
hBuffer[j][k][1] = ((uint8_t)(robotStatus.batteryLevel*511))&0xFC;
|
||||
hBuffer[j][k][2] = 0;
|
||||
}
|
||||
}else{
|
||||
hBuffer[j][k][0] = 0;
|
||||
hBuffer[j][k][1] = 0;
|
||||
hBuffer[j][k][2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
48
Core/Src/Components/SSL_GFX.hpp
Normal file
48
Core/Src/Components/SSL_GFX.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* SSL_GFX.hpp
|
||||
*
|
||||
* Created on: Feb 11, 2024
|
||||
* Author: Gabriel
|
||||
*/
|
||||
|
||||
#ifndef SRC_COMPONENTS_SSL_GFX_HPP_
|
||||
#define SRC_COMPONENTS_SSL_GFX_HPP_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "ILI9341.hpp"
|
||||
|
||||
class RobotStatus {
|
||||
public:
|
||||
uint8_t robotId;
|
||||
uint8_t team;
|
||||
uint32_t status;
|
||||
bool connected;
|
||||
float batteryLevel;
|
||||
};
|
||||
|
||||
class SSL_GFX {
|
||||
private:
|
||||
static const uint16_t sizeX = 80;
|
||||
static const uint16_t sizeY = 80;
|
||||
public:
|
||||
SSL_GFX(ILI9341* hDisplay, uint16_t posX, uint16_t posY, uint8_t hBuffer[][sizeX][3], uint32_t size);
|
||||
virtual ~SSL_GFX();
|
||||
int32_t init();
|
||||
int32_t draw();
|
||||
int32_t setRobotStatus(RobotStatus status);
|
||||
private:
|
||||
RobotStatus robotStatus;
|
||||
ILI9341* hDisplay;
|
||||
uint16_t posX;
|
||||
uint16_t posY;
|
||||
uint8_t (*hBuffer)[sizeX][3];
|
||||
uint32_t size;
|
||||
int32_t drawText(uint8_t color[3], uint16_t posX, uint16_t posY, uint8_t* string, uint32_t size);
|
||||
int32_t drawBoundingBox(uint8_t color[3]);
|
||||
int32_t drawRobotSilhouette(uint8_t color[3]);
|
||||
int32_t drawRobotLid();
|
||||
int32_t drawId(uint8_t color[3]);
|
||||
int32_t drawBatteryBar();
|
||||
};
|
||||
|
||||
#endif /* SRC_COMPONENTS_SSL_GFX_HPP_ */
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "PWM_Pin_STM32.hpp"
|
||||
#include "BinLeds.hpp"
|
||||
#include "ILI9341.hpp"
|
||||
#include "SSL_Display.hpp"
|
||||
|
||||
extern SPI_HandleTypeDef hspi5;
|
||||
extern TIM_HandleTypeDef htim10;
|
||||
@@ -27,21 +28,12 @@ GPIO_Pin_STM32 displayNss(DISPLAY_NSS_GPIO_Port, DISPLAY_NSS_Pin);
|
||||
GPIO_Pin_STM32 displayReset(DISPLAY_RESET_GPIO_Port, DISPLAY_RESET_Pin);
|
||||
GPIO_Pin_STM32 displayDcrs(DISPLAY_DCRS_GPIO_Port, DISPLAY_DCRS_Pin);
|
||||
PWM_Pin_STM32 displayLed(&htim10, TIM_CHANNEL_1);
|
||||
ILI9341 display(&spi_a, &displayNss, &displayReset, &displayDcrs, &displayLed);
|
||||
|
||||
uint8_t buffer[19200];
|
||||
ILI9341 ili9341(&spi_a, &displayNss, &displayReset, &displayDcrs, &displayLed);
|
||||
SSL_Display sslDisplay(&ili9341);
|
||||
|
||||
void start(){
|
||||
spi_a.init();
|
||||
display.init();
|
||||
display.setBacklight(1);
|
||||
for(uint32_t i = 0; i<19200; i++){
|
||||
buffer[i] = 32<<2;
|
||||
}
|
||||
display.setPosition(0, 0, 80, 80);
|
||||
display.write(buffer, 19200);
|
||||
display.setPosition(0, 80, 80, 80);
|
||||
display.write(buffer, 19200);
|
||||
sslDisplay.init();
|
||||
for(uint32_t i=0; i<16; i++){
|
||||
discoveryLeds.set(i);
|
||||
vTaskDelay(1000);
|
||||
|
||||
Reference in New Issue
Block a user