| 199 |
Kevin |
1 |
#ifndef CUBE_H
|
|
|
2 |
#define CUBE_H
|
|
|
3 |
|
|
|
4 |
#define CUBE_ROW_COUNT 8
|
|
|
5 |
#define CUBE_COLUMN_COUNT 8
|
|
|
6 |
#define CUBE_LAYER_COUNT 8
|
|
|
7 |
|
|
|
8 |
#define GCS_REG_SIZE 36
|
|
|
9 |
#define GCS_LAYER_SIZE (GCS_REG_SIZE*CUBE_ROW_COUNT)
|
|
|
10 |
|
|
|
11 |
#define RED 0x0FF,0x000,0x000
|
|
|
12 |
#define ORANGE 0x0FF,0x020,0x000
|
|
|
13 |
#define YELLOW 0x0FF,0x0FF,0x000
|
|
|
14 |
#define GREEN 0x000,0x0FF,0x000
|
|
|
15 |
#define TEAL 0x000,0x0FF,0x0FF
|
|
|
16 |
#define BLUE 0x000,0x000,0x0FF
|
|
|
17 |
#define PURPLE 0x0FF,0x000,0x0FF
|
|
|
18 |
|
|
|
19 |
#define SFT_D_TRIS TRISBbits.TRISB15
|
|
|
20 |
#define SFT_S_TRIS TRISDbits.TRISD5
|
|
|
21 |
#define SFT_K_TRIS TRISDbits.TRISD4
|
|
|
22 |
#define SFT_R_TRIS TRISBbits.TRISB14
|
|
|
23 |
|
|
|
24 |
#define SFT_D PORTBbits.RB15
|
|
|
25 |
#define SFT_S PORTDbits.RD5
|
|
|
26 |
#define SFT_K PORTDbits.RD4
|
|
|
27 |
#define SFT_R PORTBbits.RB14
|
|
|
28 |
|
|
|
29 |
#define GSLAT_TRIS TRISDbits.TRISD9
|
|
|
30 |
#define XBLNK_TRIS TRISDbits.TRISD2
|
|
|
31 |
|
|
|
32 |
#define GSLAT PORTDbits.RD9
|
|
|
33 |
#define XBLNK PORTDbits.RD2
|
|
|
34 |
|
|
|
35 |
typedef struct {
|
|
|
36 |
unsigned char GCS[CUBE_LAYER_COUNT][GCS_LAYER_SIZE];
|
|
|
37 |
} CUBE_DATA;
|
|
|
38 |
|
|
|
39 |
void Cube_Init(CUBE_DATA *data);
|
|
|
40 |
void Cube_Timer_Interrupt(void);
|
|
|
41 |
|
|
|
42 |
// Callbacks on completion of DCS/GCS writes
|
|
|
43 |
void Cube_DCS_Write_Callback(void);
|
|
|
44 |
void Cube_GCS_Write_Callback(void);
|
|
|
45 |
|
|
|
46 |
// Cube control functions
|
|
|
47 |
void Cube_Clear(void);
|
|
|
48 |
void Cube_Set_All(int R, int G, int B);
|
|
|
49 |
void Cube_Set_Layer(int layer, int R, int G, int B);
|
|
|
50 |
void Cube_Set_Pixel(int layer, int row, int column, int R, int G, int B);
|
|
|
51 |
|
|
|
52 |
#endif /* CUBE_H */
|
|
|
53 |
|