Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
 
200 Kevin 35
#define CUBE_MAX_BRIGHTNESS 0x7F
36
 
199 Kevin 37
typedef struct {
38
    unsigned char GCS[CUBE_LAYER_COUNT][GCS_LAYER_SIZE];
39
} CUBE_DATA;
40
 
200 Kevin 41
void Cube_Init(CUBE_DATA *data, char BC);
199 Kevin 42
void Cube_Timer_Interrupt(void);
43
 
44
// Callbacks on completion of DCS/GCS writes
45
void Cube_DCS_Write_Callback(void);
46
void Cube_GCS_Write_Callback(void);
47
 
48
// Cube control functions
200 Kevin 49
void Cube_Write_DCS(char BC);
199 Kevin 50
void Cube_Clear(void);
51
void Cube_Set_All(int R, int G, int B);
52
void Cube_Set_Layer(int layer, int R, int G, int B);
53
void Cube_Set_Pixel(int layer, int row, int column, int R, int G, int B);
54
 
55
#endif	/* CUBE_H */
56