prepare display

This commit is contained in:
2024-03-22 18:38:30 +01:00
parent 10a09e3ad3
commit a32ef8fa5b
7 changed files with 73 additions and 5 deletions

50
game-ctrl/display.c Normal file
View File

@ -0,0 +1,50 @@
#include <stdint.h>
#include "display.h"
#include "spi.h"
uint16_t score;
void displayInit() {
score = 0;
spiSendBegin(e_SPI_DISPLAY);
// display test off
spiSendOctet(0x0f);
spiSendOctet(0x01);
// BCD decode for all digits
spiSendOctet(0x09);
spiSendOctet(0xff);
// scan limit to digits 0-3
spiSendOctet(0x0b);
spiSendOctet(0x03);
// intensity
spiSendOctet(0x0a);
spiSendOctet(0x0f);
// normal operation
spiSendOctet(0x0C);
spiSendOctet(0x01);
spiSendEnd(e_SPI_DISPLAY);
}
void displaySetScore(uint16_t v) {
score = v;
spiSendBegin(e_SPI_DISPLAY);
spiSendOctet(0x01);
spiSendOctet(0x07);
spiSendEnd(e_SPI_DISPLAY);
}