refactoring

This commit is contained in:
Wolfgang Hottgenroth 2024-03-18 20:50:10 +01:00
parent 326d0f66b0
commit a68f74559f
4 changed files with 17 additions and 9 deletions

View File

@ -3,9 +3,10 @@
#include <stdint.h>
// Definition of CANVAS_WIDTH and CANVAS_HEIGHT
// imported from rgb-driver
#include "../rgb-driver/canvasSize.h"
#define CANVAS_WIDTH 10
#define CANVAS_HEIGHT 11
typedef struct {
const uint8_t width;
@ -23,6 +24,4 @@ uint8_t canvasIsPixelFree(uint8_t column, uint8_t row);
void canvasWipeRow(uint8_t row);
uint8_t canvasIsRowFilled(uint8_t row);
extern const canvas_t canvas;
#endif // _CANVAS_H_

View File

@ -38,13 +38,13 @@ void gameExec(void *handle) {
break;
case e_gameOver:
for (uint8_t c = 0; c < canvas.width; c++) {
for (uint8_t c = 0; c < CANVAS_WIDTH; c++) {
canvasSetPixel(c, 0, 0x0d);
canvasSetPixel(c, canvas.height-1, 0x0d);
canvasSetPixel(c, CANVAS_HEIGHT - 1, 0x0d);
}
for (uint8_t r = 0; r < canvas.height; r++) {
for (uint8_t r = 0; r < CANVAS_HEIGHT; r++) {
canvasSetPixel(0, r, 0x0d);
canvasSetPixel(canvas.width-1, r, 0x0d);
canvasSetPixel(CANVAS_WIDTH - 1, r, 0x0d);
}
delay = 10;
state = e_delay;

7
rgb-driver/canvasSize.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef _CANVAS_SIZE_H_
#define _CANVAS_SIZE_H_
#define CANVAS_WIDTH 10
#define CANVAS_HEIGHT 11
#endif // _CANVAS_SIZE_H_

View File

@ -1,5 +1,7 @@
#include <msp430g2553.h>
#include "colors.h"
#include "canvasSize.h"
#define PC r0
#define SP r1
@ -59,7 +61,7 @@
.section ".data"
screendata:
.rept 110 ;; number of leds in hardward
.rept CANVAS_HEIGHT*CANVAS_WIDTH ;; number of leds in hardward
.byte 0
.endr
screendataend: