8x8x8 Led Cube driven by 4x PCF8575 for the columns and 1x PCF8574 for the layers
led_cube.h
- Committer:
- Bas
- Date:
- 2012-09-08
- Revision:
- 0:920c5ed65a45
- Child:
- 1:e08a4d27f534
File content as of revision 0:920c5ed65a45:
#ifndef __LED_CUBE_H #define __LED_CUBE_H #define VERSION 1.0 #include <mbed.h> #include "pcf8574.h" #include "pcf8575.h" #define PI 3.14159 #define Xd 8 #define Yd 8 #define Zd 8 #define centre 3.5 #define Vd Xd*Yd*Zd #define SB(x,n) (x|=(1<<n)) #define CB(x,n) (x&=~(1<<n)) #define TB(x,n) (x^=(1<<n)) #define PB(x,n) do{SB(x,n);CB(x,n);}while(0) class LED_CUBE { public: LED_CUBE(I2C* _interface); ~LED_CUBE(void); void clear_cube(void); void setVoxel(unsigned char x, unsigned char y, unsigned char z); void clearVoxel(unsigned char x, unsigned char y, unsigned char z); unsigned char getVoxel(unsigned char x, unsigned char y, unsigned char z); void copyColumn(unsigned char x, unsigned char y, unsigned char col); void clearVoxels(void); private: PCF8574 row; PCF8575 colums_0_1; PCF8575 colums_2_3; PCF8575 colums_4_5; PCF8575 colums_6_7; unsigned char cubeData[64]; Ticker duty; void UpdateRow(void); }; #endif