This is THE 447 FINAL PROJECT this is the frame work put your code in the spot where the it suppose to go and. Make sure you import this into your complier and work on your section, once you done just commit the changes and fork to a new folder

Dependencies:   mbed-rtos mbed draw_test EALib SWSPI

Committer:
AndyTran
Date:
Tue Dec 01 00:49:17 2015 +0000
Revision:
0:4abb197a773c
Child:
1:3f7aa28da00d
447 Final Project Frame Work

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AndyTran 0:4abb197a773c 1 #include "mbed.h"
AndyTran 0:4abb197a773c 2 #include "cmsis_os.h"
AndyTran 0:4abb197a773c 3
AndyTran 0:4abb197a773c 4 //declare your input pin and output pin here:
AndyTran 0:4abb197a773c 5 //DigitalOut led1(p25);
AndyTran 0:4abb197a773c 6 //DigitalOut led2(p26);
AndyTran 0:4abb197a773c 7 //DigitalOut led3(p28);
AndyTran 0:4abb197a773c 8 //
AndyTran 0:4abb197a773c 9 // declare you globle variable here:
AndyTran 0:4abb197a773c 10 unsigned char X_coor = 0,Y_coor = 0x0A;
AndyTran 0:4abb197a773c 11 unsigned char LEDs = ((X_coor << 8)|Y_coor);
AndyTran 0:4abb197a773c 12 //X_coor is x coordinate from 0 to 6
AndyTran 0:4abb197a773c 13 //Y_coor is y coordinate form A to F
AndyTran 0:4abb197a773c 14 //
AndyTran 0:4abb197a773c 15 //
AndyTran 0:4abb197a773c 16 //
AndyTran 0:4abb197a773c 17
AndyTran 0:4abb197a773c 18 // this thread is your SPI communication between 2 board
AndyTran 0:4abb197a773c 19 void SPI_communication(void const *args) {
AndyTran 0:4abb197a773c 20 //spi code here
AndyTran 0:4abb197a773c 21 }
AndyTran 0:4abb197a773c 22
AndyTran 0:4abb197a773c 23 // joystick update x_coor and y_coor here
AndyTran 0:4abb197a773c 24 void joy_stick_read(void const *args) { //might be an interrupt thread here for interrupt read of joystick
AndyTran 0:4abb197a773c 25 // joy stick to update global val of x_coor and y_coor;
AndyTran 0:4abb197a773c 26 // update the 8 LEDs here
AndyTran 0:4abb197a773c 27 }
AndyTran 0:4abb197a773c 28
AndyTran 0:4abb197a773c 29 // this thread use to update the game board
AndyTran 0:4abb197a773c 30 void game_view_update () {
AndyTran 0:4abb197a773c 31 // update the by led game update
AndyTran 0:4abb197a773c 32 }
AndyTran 0:4abb197a773c 33
AndyTran 0:4abb197a773c 34 // code here to check for winer and turn on the RGB
AndyTran 0:4abb197a773c 35 void winnercheck () {
AndyTran 0:4abb197a773c 36 //check for winner by some condition
AndyTran 0:4abb197a773c 37 }
AndyTran 0:4abb197a773c 38
AndyTran 0:4abb197a773c 39 //read the accele
AndyTran 0:4abb197a773c 40 void checkreset () {
AndyTran 0:4abb197a773c 41 //read the acceleron meter and compare against the previous value to
AndyTran 0:4abb197a773c 42 //determine if the board have been shake the reset the game board;
AndyTran 0:4abb197a773c 43 }
AndyTran 0:4abb197a773c 44
AndyTran 0:4abb197a773c 45
AndyTran 0:4abb197a773c 46 osThreadDef(SPI_communication, osPriorityNormal, DEFAULT_STACK_SIZE); //comm between 2 board
AndyTran 0:4abb197a773c 47 osThreadDef(joy_stick_read, osPriorityNormal, DEFAULT_STACK_SIZE);//might be an interrupt;
AndyTran 0:4abb197a773c 48 osThreadDef(game_view_update, osPriorityNormal, DEFAULT_STACK_SIZE);//update game view write to the fifo uart buffer
AndyTran 0:4abb197a773c 49 osThreadDef(winnercheck, osPriorityNormal, DEFAULT_STACK_SIZE); //check for winner
AndyTran 0:4abb197a773c 50 osThreadDef(checkreset, osPriorityNormal, DEFAULT_STACK_SIZE); //check for reset
AndyTran 0:4abb197a773c 51
AndyTran 0:4abb197a773c 52 int main() {
AndyTran 0:4abb197a773c 53 osThreadCreate(osThread(SPI_communication), NULL);
AndyTran 0:4abb197a773c 54 osThreadCreate(osThread(joy_stick_read), NULL);
AndyTran 0:4abb197a773c 55 osThreadCreate(osThread(game_view_update), NULL);
AndyTran 0:4abb197a773c 56 osThreadCreate(osThread(winnercheck), NULL);
AndyTran 0:4abb197a773c 57 osThreadCreate(osThread(checkreset), NULL);
AndyTran 0:4abb197a773c 58 // initialize all peripheral here
AndyTran 0:4abb197a773c 59 //
AndyTran 0:4abb197a773c 60 //
AndyTran 0:4abb197a773c 61 //
AndyTran 0:4abb197a773c 62
AndyTran 0:4abb197a773c 63 //Main Thread
AndyTran 0:4abb197a773c 64 while (true) {
AndyTran 0:4abb197a773c 65 //check status and update status
AndyTran 0:4abb197a773c 66 }
AndyTran 0:4abb197a773c 67 }