1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
/*
* Main for PC side of PC generated patterns fed to
* AVR by UART
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "cube.h"
#include "draw.h"
#include "draw_3d.h"
#include "effect.h"
#include "gameoflife.h"
#include <pthread.h>
unsigned char rs232_cube[8][8];
void cube_updater(*rs232_cube);
int main(int argc, char **argv)
{
cube_init();
pthread_t cube_thread;
int iret, i, x;
/*
extern int pthread_create (pthread_t *__restrict __newthread,
__const pthread_attr_t *__restrict __attr,
void *(*__start_routine) (void *),
void *__restrict __arg) __THROWNL __nonnull ((1, 3));
*/
iret = pthread_create(&cube_thread, NULL, cube_updater, rs232_cube);
/* Note I've modified the variable names in the code from "control" to "cube" to better reflect the current application:
This is the last change suggested from the forum:
iret = pthread_create(&control_thread, ULL, control_updater,rs232_control ) //undeclared
*/
void sidewaves(int, int);
void ripples(int, int);
void linespin(int, int);
void sinelines(int, int);
void spheremove(int, int);
void fireworks(int, int);
void gol_play(int, int);
while (1)
{
printf("Effect: sidewaves\n"); // sidewaves
sidewaves(2000,100);
printf("Effect: ripples\n"); // ripples
ripples(2000,100);
printf("Effect: linespin\n"); // Linespin
linespin(2000,100);
printf("Effect: sinelines\n"); // Sinelines
sinelines(2000,100);
printf("Effect: spheremove\n"); // Spheremove
spheremove(1500,100); // ne555
printf("Effect: fireworks\n"); // Fireworks
fireworks(7,50,1200);
printf("Effect: gol_play\n"); // Game of Life
for (i=0; i<10; i++)
{
for (x=0; x<20; x++)
setvoxel(rand()%4,rand()%4,rand()%4);
gol_play(50,1000);
}
}
}
/*void *cube_updater (void* param) //kbw
// code for recasting suggestion from the forum - kbw
{
unsigned char *rs232_cube = reinterpret_cast<unsigned char*>(param);
unsigned char pushcube[8][8];
while (1)
{
memcpy(pushcube, rs232_cube, 64);
cube_push(pushcube)
}
return NULL;
}
*/
void *cube_updater (unsigned char rs232_cube[8][8])
{
unsigned char pushcube[8][8];
while (1)
{
memcpy(pushcube, rs232_cube, 64);
cube_push(pushcube);
}
}
|