refactoring
This commit is contained in:
@ -3,9 +3,10 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#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 {
|
typedef struct {
|
||||||
const uint8_t width;
|
const uint8_t width;
|
||||||
@ -23,6 +24,4 @@ uint8_t canvasIsPixelFree(uint8_t column, uint8_t row);
|
|||||||
void canvasWipeRow(uint8_t row);
|
void canvasWipeRow(uint8_t row);
|
||||||
uint8_t canvasIsRowFilled(uint8_t row);
|
uint8_t canvasIsRowFilled(uint8_t row);
|
||||||
|
|
||||||
extern const canvas_t canvas;
|
|
||||||
|
|
||||||
#endif // _CANVAS_H_
|
#endif // _CANVAS_H_
|
||||||
|
@ -38,13 +38,13 @@ void gameExec(void *handle) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case e_gameOver:
|
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, 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(0, r, 0x0d);
|
||||||
canvasSetPixel(canvas.width-1, r, 0x0d);
|
canvasSetPixel(CANVAS_WIDTH - 1, r, 0x0d);
|
||||||
}
|
}
|
||||||
delay = 10;
|
delay = 10;
|
||||||
state = e_delay;
|
state = e_delay;
|
||||||
|
7
rgb-driver/canvasSize.h
Normal file
7
rgb-driver/canvasSize.h
Normal 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_
|
@ -1,5 +1,7 @@
|
|||||||
#include <msp430g2553.h>
|
#include <msp430g2553.h>
|
||||||
#include "colors.h"
|
#include "colors.h"
|
||||||
|
#include "canvasSize.h"
|
||||||
|
|
||||||
|
|
||||||
#define PC r0
|
#define PC r0
|
||||||
#define SP r1
|
#define SP r1
|
||||||
@ -59,7 +61,7 @@
|
|||||||
|
|
||||||
.section ".data"
|
.section ".data"
|
||||||
screendata:
|
screendata:
|
||||||
.rept 110 ;; number of leds in hardward
|
.rept CANVAS_HEIGHT*CANVAS_WIDTH ;; number of leds in hardward
|
||||||
.byte 0
|
.byte 0
|
||||||
.endr
|
.endr
|
||||||
screendataend:
|
screendataend:
|
||||||
|
Reference in New Issue
Block a user