code beautifying
This commit is contained in:
@ -11,7 +11,7 @@ CFLAGS=-Wall -mmcu=$(MCU) -std=gnu99 -I $(TOOLCHAIN_PREFIX)/include -O1 -g0
|
|||||||
|
|
||||||
LDFLAGS=-mmcu=$(MCU) -L $(TOOLCHAIN_PREFIX)/include
|
LDFLAGS=-mmcu=$(MCU) -L $(TOOLCHAIN_PREFIX)/include
|
||||||
|
|
||||||
$(ARTIFACT).elf: main.o led.o time.o PontCoopScheduler.o displayDriver.o canvas.o shapes.o game.o buttons.o
|
$(ARTIFACT).elf: main.o led.o scheduler.o canvas.o shapes.o game.o buttons.o
|
||||||
$(CC) -o $@ $(LDFLAGS) $^
|
$(CC) -o $@ $(LDFLAGS) $^
|
||||||
$(OBJDUMP) -D $(ARTIFACT).elf > $(ARTIFACT).txt
|
$(OBJDUMP) -D $(ARTIFACT).elf > $(ARTIFACT).txt
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
|
|
||||||
#include "buttons.h"
|
#include "buttons.h"
|
||||||
#include "PontCoopScheduler.h"
|
#include "scheduler.h"
|
||||||
#include "shapes.h"
|
#include "shapes.h"
|
||||||
#include "canvas.h"
|
#include "canvas.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
|
@ -1,33 +1,76 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <msp430g2553.h>
|
||||||
|
|
||||||
#include "canvas.h"
|
#include "canvas.h"
|
||||||
#include "displayDriver.h"
|
|
||||||
|
|
||||||
|
|
||||||
static uint8_t canvasStorage[CANVAS_WIDTH * CANVAS_HEIGHT];
|
static uint8_t canvasStorage[CANVAS_WIDTH * CANVAS_HEIGHT];
|
||||||
const canvas_t canvas = {
|
const canvas_t canvas = {
|
||||||
.height = CANVAS_HEIGHT,
|
.height = CANVAS_HEIGHT,
|
||||||
.width = CANVAS_WIDTH,
|
.width = CANVAS_WIDTH,
|
||||||
.size = CANVAS_WIDTH * CANVAS_HEIGHT,
|
|
||||||
.canvas = canvasStorage
|
.canvas = canvasStorage
|
||||||
};
|
};
|
||||||
|
|
||||||
void canvasInit() {
|
|
||||||
canvasClear();
|
|
||||||
displayDriverTransferCanvas();
|
|
||||||
}
|
|
||||||
|
|
||||||
void canvasClear() {
|
inline static void spiSendOctet(uint8_t v) {
|
||||||
memset(canvas.canvas, 0x80, canvas.size);
|
// wait for TX buffer empty
|
||||||
}
|
while (!(UC0IFG & UCB0TXIFG));
|
||||||
|
// load octet into TX buffer
|
||||||
void canvasSetAll(uint8_t color) {
|
UCB0TXBUF = v;
|
||||||
memset(canvas.canvas, color + 0x80, canvas.size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void canvasShow() {
|
void canvasShow() {
|
||||||
displayDriverTransferCanvas();
|
// wait for signal waiting for data
|
||||||
|
while ((P1IN & BIT3) == 0);
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < (CANVAS_WIDTH*CANVAS_HEIGHT); i++) {
|
||||||
|
if ((*((canvas.canvas)+i) & 0x80) != 0) {
|
||||||
|
*((canvas.canvas)+i) &= ~0x80;
|
||||||
|
spiSendOctet(i);
|
||||||
|
spiSendOctet(*((canvas.canvas)+i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spiSendOctet(0xfe);
|
||||||
|
}
|
||||||
|
|
||||||
|
void canvasInit() {
|
||||||
|
// SPI in master mode
|
||||||
|
UCB0CTL0 = UCMST;
|
||||||
|
// SPI timing config
|
||||||
|
UCB0CTL1 = UCSSEL_3;
|
||||||
|
// Faster than 8 ends up in strange communication errors
|
||||||
|
// between the both MCUs.
|
||||||
|
// With 8 the transfer of a complete 110 pixel canvas takes
|
||||||
|
// about 720us.
|
||||||
|
UCB0BR0 = 8;
|
||||||
|
UCB0BR1 = 0;
|
||||||
|
|
||||||
|
// BIT5: UCB0CLK
|
||||||
|
// BIT6: UCB0SOMI
|
||||||
|
// BIT7: UCB0SIMO
|
||||||
|
P1SEL |= BIT5 | BIT6 | BIT7;
|
||||||
|
P1SEL2 |= BIT5 | BIT6 | BIT7;
|
||||||
|
P1DIR |= BIT5 | BIT7;
|
||||||
|
|
||||||
|
// P1.3 is signal line
|
||||||
|
P1DIR &= ~BIT3;
|
||||||
|
|
||||||
|
// enable SPI module
|
||||||
|
UCB0CTL1 &= ~UCSWRST;
|
||||||
|
|
||||||
|
|
||||||
|
canvasClear();
|
||||||
|
canvasShow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void canvasClear() {
|
||||||
|
memset(canvas.canvas, 0x80, CANVAS_WIDTH*CANVAS_HEIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void canvasSetAll(uint8_t color) {
|
||||||
|
memset(canvas.canvas, color + 0x80, CANVAS_WIDTH*CANVAS_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void canvasSetPixel(uint8_t column, uint8_t row, uint8_t color) {
|
void canvasSetPixel(uint8_t column, uint8_t row, uint8_t color) {
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
#include "displayDriver.h"
|
|
||||||
#include "led.h"
|
|
||||||
#include "canvas.h"
|
|
||||||
#include <msp430g2553.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline static void spiSendOctet(uint8_t v) {
|
|
||||||
// wait for TX buffer empty
|
|
||||||
while (!(UC0IFG & UCB0TXIFG));
|
|
||||||
// load octet into TX buffer
|
|
||||||
UCB0TXBUF = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
void displayDriverTransferCanvas() {
|
|
||||||
// wait for signal waiting for data
|
|
||||||
while ((P1IN & BIT3) == 0);
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < canvas.size; i++) {
|
|
||||||
if ((*((canvas.canvas)+i) & 0x80) != 0) {
|
|
||||||
*((canvas.canvas)+i) &= ~0x80;
|
|
||||||
spiSendOctet(i);
|
|
||||||
spiSendOctet(*((canvas.canvas)+i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
spiSendOctet(0xfe);
|
|
||||||
}
|
|
||||||
|
|
||||||
void displayDriverInit() {
|
|
||||||
// SPI in master mode
|
|
||||||
UCB0CTL0 = UCMST;
|
|
||||||
// SPI timing config
|
|
||||||
UCB0CTL1 = UCSSEL_3;
|
|
||||||
// Faster than 8 ends up in strange communication errors
|
|
||||||
// between the both MCUs.
|
|
||||||
// With 8 the transfer of a complete 110 pixel canvas takes
|
|
||||||
// about 720us.
|
|
||||||
UCB0BR0 = 8;
|
|
||||||
UCB0BR1 = 0;
|
|
||||||
|
|
||||||
// BIT5: UCB0CLK
|
|
||||||
// BIT6: UCB0SOMI
|
|
||||||
// BIT7: UCB0SIMO
|
|
||||||
P1SEL |= BIT5 | BIT6 | BIT7;
|
|
||||||
P1SEL2 |= BIT5 | BIT6 | BIT7;
|
|
||||||
P1DIR |= BIT5 | BIT7;
|
|
||||||
|
|
||||||
// P1.3 is signal line
|
|
||||||
P1DIR &= ~BIT3;
|
|
||||||
|
|
||||||
// enable SPI module
|
|
||||||
UCB0CTL1 &= ~UCSWRST;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
#ifndef _DISPLAY_DRIVER_H_
|
|
||||||
#define _DISPLAY_DRIVER_H_
|
|
||||||
|
|
||||||
void displayDriverInit();
|
|
||||||
void displayDriverTransferCanvas();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _DISPLAY_DRIVER_H_
|
|
@ -2,7 +2,7 @@
|
|||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
|
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "PontCoopScheduler.h"
|
#include "scheduler.h"
|
||||||
#include "shapes.h"
|
#include "shapes.h"
|
||||||
#include "canvas.h"
|
#include "canvas.h"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include <msp430g2553.h>
|
#include <msp430g2553.h>
|
||||||
#include "PontCoopScheduler.h"
|
#include "scheduler.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,9 +4,8 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "PontCoopScheduler.h"
|
#include "scheduler.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include "displayDriver.h"
|
|
||||||
#include "canvas.h"
|
#include "canvas.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "buttons.h"
|
#include "buttons.h"
|
||||||
@ -24,11 +23,9 @@ int main() {
|
|||||||
BCSCTL2 = 0;
|
BCSCTL2 = 0;
|
||||||
BCSCTL3 = 0;
|
BCSCTL3 = 0;
|
||||||
|
|
||||||
timeInit();
|
|
||||||
schInit();
|
schInit();
|
||||||
|
|
||||||
ledInit();
|
ledInit();
|
||||||
displayDriverInit();
|
|
||||||
canvasInit();
|
canvasInit();
|
||||||
|
|
||||||
shapesInit();
|
shapesInit();
|
||||||
|
@ -1,21 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* PontCoopScheduler.c
|
* PontCoopScheduler.c
|
||||||
*
|
*
|
||||||
* Created on: 29.08.2016
|
* Originally created on: 29.08.2016
|
||||||
* Author: wn
|
* Author: wn
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <msp430g2553.h>
|
#include <msp430g2553.h>
|
||||||
|
#include "scheduler.h"
|
||||||
|
|
||||||
#include "PontCoopScheduler.h"
|
|
||||||
|
|
||||||
tTask tasks[MAX_NUM_OF_TASKS];
|
tTask tasks[MAX_NUM_OF_TASKS];
|
||||||
|
|
||||||
|
|
||||||
void schInit() {
|
void schInit() {
|
||||||
|
TACCR0 = 32;
|
||||||
|
TACCTL0 = CCIE;
|
||||||
|
TACTL = MC_1 | ID_0 | TASSEL_1 | TACLR;
|
||||||
|
|
||||||
for (uint16_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
|
for (uint16_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
|
||||||
tasks[i].delay = 0;
|
tasks[i].delay = 0;
|
||||||
tasks[i].period = 0;
|
tasks[i].period = 0;
|
||||||
@ -25,6 +27,19 @@ void schInit() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __attribute__ ((interrupt (TIMER0_A0_VECTOR))) schUpdate() {
|
||||||
|
for (uint16_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
|
||||||
|
if (tasks[i].exec != NULL) {
|
||||||
|
if (tasks[i].delay == 0) {
|
||||||
|
tasks[i].delay = tasks[i].period;
|
||||||
|
tasks[i].run++;
|
||||||
|
} else {
|
||||||
|
tasks[i].delay--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void schAdd(void (*exec)(void *), void *handle, uint32_t delay, uint32_t period) {
|
void schAdd(void (*exec)(void *), void *handle, uint32_t delay, uint32_t period) {
|
||||||
for (uint16_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
|
for (uint16_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
|
||||||
if (tasks[i].exec == NULL) {
|
if (tasks[i].exec == NULL) {
|
||||||
@ -75,16 +90,3 @@ void schExec() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void schUpdate() {
|
|
||||||
for (uint16_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
|
|
||||||
if (tasks[i].exec != NULL) {
|
|
||||||
if (tasks[i].delay == 0) {
|
|
||||||
tasks[i].delay = tasks[i].period;
|
|
||||||
tasks[i].run++;
|
|
||||||
} else {
|
|
||||||
tasks[i].delay--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -203,24 +203,53 @@ uint8_t stoneIsValid() {
|
|||||||
|
|
||||||
// all of them return 1 in case of success and 0 in case of error
|
// all of them return 1 in case of success and 0 in case of error
|
||||||
static uint8_t move(direction_t direction) {
|
static uint8_t move(direction_t direction) {
|
||||||
|
// if this is a rotation and the shape is marked with nullRotation (just the O), do nothing
|
||||||
|
// and return success
|
||||||
if (motions[stone.shape].nullRotation && (direction == e_RotateLeft || direction == e_RotateRight)) {
|
if (motions[stone.shape].nullRotation && (direction == e_RotateLeft || direction == e_RotateRight)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (canvasIsPixelFree(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[0].x, stone.y + motions[stone.shape].motion[direction][stone.orientation].set[0].y) &&
|
// check whether the pixels to move to are free
|
||||||
canvasIsPixelFree(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[1].x, stone.y + motions[stone.shape].motion[direction][stone.orientation].set[1].y) &&
|
if (canvasIsPixelFree(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[0].x,
|
||||||
canvasIsPixelFree(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[2].x, stone.y + motions[stone.shape].motion[direction][stone.orientation].set[2].y) &&
|
stone.y + motions[stone.shape].motion[direction][stone.orientation].set[0].y) &&
|
||||||
canvasIsPixelFree(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[3].x, stone.y + motions[stone.shape].motion[direction][stone.orientation].set[3].y)) {
|
canvasIsPixelFree(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[1].x,
|
||||||
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].reset[0].x, stone.y + motions[stone.shape].motion[direction][stone.orientation].reset[0].y, _off);
|
stone.y + motions[stone.shape].motion[direction][stone.orientation].set[1].y) &&
|
||||||
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].reset[1].x, stone.y + motions[stone.shape].motion[direction][stone.orientation].reset[1].y, _off);
|
canvasIsPixelFree(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[2].x,
|
||||||
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].reset[2].x, stone.y + motions[stone.shape].motion[direction][stone.orientation].reset[2].y, _off);
|
stone.y + motions[stone.shape].motion[direction][stone.orientation].set[2].y) &&
|
||||||
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].reset[3].x, stone.y + motions[stone.shape].motion[direction][stone.orientation].reset[3].y, _off);
|
canvasIsPixelFree(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[3].x,
|
||||||
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[0].x, stone.y + motions[stone.shape].motion[direction][stone.orientation].set[0].y, motions[stone.shape].color);
|
stone.y + motions[stone.shape].motion[direction][stone.orientation].set[3].y)) {
|
||||||
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[1].x, stone.y + motions[stone.shape].motion[direction][stone.orientation].set[1].y, motions[stone.shape].color);
|
// if so, reset the pixels the shape moves away from
|
||||||
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[2].x, stone.y + motions[stone.shape].motion[direction][stone.orientation].set[2].y, motions[stone.shape].color);
|
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].reset[0].x,
|
||||||
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[3].x, stone.y + motions[stone.shape].motion[direction][stone.orientation].set[3].y, motions[stone.shape].color);
|
stone.y + motions[stone.shape].motion[direction][stone.orientation].reset[0].y,
|
||||||
|
_off);
|
||||||
|
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].reset[1].x,
|
||||||
|
stone.y + motions[stone.shape].motion[direction][stone.orientation].reset[1].y,
|
||||||
|
_off);
|
||||||
|
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].reset[2].x,
|
||||||
|
stone.y + motions[stone.shape].motion[direction][stone.orientation].reset[2].y,
|
||||||
|
_off);
|
||||||
|
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].reset[3].x,
|
||||||
|
stone.y + motions[stone.shape].motion[direction][stone.orientation].reset[3].y,
|
||||||
|
_off);
|
||||||
|
// and set the pixels the shape moves to to the shape's color
|
||||||
|
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[0].x,
|
||||||
|
stone.y + motions[stone.shape].motion[direction][stone.orientation].set[0].y,
|
||||||
|
motions[stone.shape].color);
|
||||||
|
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[1].x,
|
||||||
|
stone.y + motions[stone.shape].motion[direction][stone.orientation].set[1].y,
|
||||||
|
motions[stone.shape].color);
|
||||||
|
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[2].x,
|
||||||
|
stone.y + motions[stone.shape].motion[direction][stone.orientation].set[2].y,
|
||||||
|
motions[stone.shape].color);
|
||||||
|
canvasSetPixel(stone.x + motions[stone.shape].motion[direction][stone.orientation].set[3].x,
|
||||||
|
stone.y + motions[stone.shape].motion[direction][stone.orientation].set[3].y,
|
||||||
|
motions[stone.shape].color);
|
||||||
|
// set the new origin of the shape
|
||||||
stone.x += motions[stone.shape].motion[direction][stone.orientation].offset.x;
|
stone.x += motions[stone.shape].motion[direction][stone.orientation].offset.x;
|
||||||
stone.y += motions[stone.shape].motion[direction][stone.orientation].offset.y;
|
stone.y += motions[stone.shape].motion[direction][stone.orientation].offset.y;
|
||||||
stone.orientation = (nextOrientation[direction][stone.orientation] == e_Keep) ? stone.orientation : nextOrientation[direction][stone.orientation];
|
// set the new orientation of the shape, if required
|
||||||
|
stone.orientation = (nextOrientation[direction][stone.orientation] == e_Keep) ?
|
||||||
|
stone.orientation :
|
||||||
|
nextOrientation[direction][stone.orientation];
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -228,14 +257,28 @@ static uint8_t move(direction_t direction) {
|
|||||||
|
|
||||||
uint8_t stoneDraw() {
|
uint8_t stoneDraw() {
|
||||||
uint8_t res = 0;
|
uint8_t res = 0;
|
||||||
if (canvasIsPixelFree(stone.x + motions[stone.shape].draw[0].x, stone.y + motions[stone.shape].draw[0].y) &&
|
// check if the pixels the shape should be drawn at are free
|
||||||
canvasIsPixelFree(stone.x + motions[stone.shape].draw[1].x, stone.y + motions[stone.shape].draw[1].y) &&
|
if (canvasIsPixelFree(stone.x + motions[stone.shape].draw[0].x,
|
||||||
canvasIsPixelFree(stone.x + motions[stone.shape].draw[2].x, stone.y + motions[stone.shape].draw[2].y) &&
|
stone.y + motions[stone.shape].draw[0].y) &&
|
||||||
canvasIsPixelFree(stone.x + motions[stone.shape].draw[3].x, stone.y + motions[stone.shape].draw[3].y)) {
|
canvasIsPixelFree(stone.x + motions[stone.shape].draw[1].x,
|
||||||
canvasSetPixel(stone.x + motions[stone.shape].draw[0].x, stone.y + motions[stone.shape].draw[0].y, motions[stone.shape].color);
|
stone.y + motions[stone.shape].draw[1].y) &&
|
||||||
canvasSetPixel(stone.x + motions[stone.shape].draw[1].x, stone.y + motions[stone.shape].draw[1].y, motions[stone.shape].color);
|
canvasIsPixelFree(stone.x + motions[stone.shape].draw[2].x,
|
||||||
canvasSetPixel(stone.x + motions[stone.shape].draw[2].x, stone.y + motions[stone.shape].draw[2].y, motions[stone.shape].color);
|
stone.y + motions[stone.shape].draw[2].y) &&
|
||||||
canvasSetPixel(stone.x + motions[stone.shape].draw[3].x, stone.y + motions[stone.shape].draw[3].y, motions[stone.shape].color);
|
canvasIsPixelFree(stone.x + motions[stone.shape].draw[3].x,
|
||||||
|
stone.y + motions[stone.shape].draw[3].y)) {
|
||||||
|
// if so, draw the shape
|
||||||
|
canvasSetPixel(stone.x + motions[stone.shape].draw[0].x,
|
||||||
|
stone.y + motions[stone.shape].draw[0].y,
|
||||||
|
motions[stone.shape].color);
|
||||||
|
canvasSetPixel(stone.x + motions[stone.shape].draw[1].x,
|
||||||
|
stone.y + motions[stone.shape].draw[1].y,
|
||||||
|
motions[stone.shape].color);
|
||||||
|
canvasSetPixel(stone.x + motions[stone.shape].draw[2].x,
|
||||||
|
stone.y + motions[stone.shape].draw[2].y,
|
||||||
|
motions[stone.shape].color);
|
||||||
|
canvasSetPixel(stone.x + motions[stone.shape].draw[3].x,
|
||||||
|
stone.y + motions[stone.shape].draw[3].y,
|
||||||
|
motions[stone.shape].color);
|
||||||
res = 1;
|
res = 1;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
#include <msp430g2553.h>
|
|
||||||
|
|
||||||
#include "time.h"
|
|
||||||
#include "PontCoopScheduler.h"
|
|
||||||
|
|
||||||
|
|
||||||
void __attribute__ ((interrupt (TIMER0_A0_VECTOR))) ta0_isr() {
|
|
||||||
schUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void timeInit() {
|
|
||||||
TACCR0 = 32;
|
|
||||||
TACCTL0 = CCIE;
|
|
||||||
TACTL = MC_1 | ID_0 | TASSEL_1 | TACLR;
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
|||||||
#ifndef TIME_H_
|
|
||||||
#define TIME_H_
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
void timeInit();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* TIME_H_ */
|
|
Reference in New Issue
Block a user