A class library for "mbeduino" + "4x4x4 LED Cube shield" demo. \\ There are two demo programs for this library available. Please find those at...\\ (1) Very simplified demo sample code : \\ http://mbed.org/users/okano/programs/LED_Cube444_mbeduino-very_simple_demo/\\ (2) More complex (fancy) demo : \\ http://mbed.org/users/okano/programs/LED_Cube444_mbeduino_demo/\\ Another application code is available for hardware test...\\ http://mbed.org/users/okano/programs/mbeduino_LED_Cube444_test/\\ About the hardware :\\ http://mbed.org/users/okini3939/notebook/mbeduino/ \\ http://www.galileo-7.com/?pid=20015630 \\ - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\\ "mbeduino" + "4x4x4 LED Cube shield"のデモ用に作成したクラスライブラリです.\\ このクラスライブラリには2つのデモ・プログラム(サンプル・コード)が用意されています.\\ (1) 単純化したデモ・サンプル\\ http://mbed.org/users/okano/programs/LED_Cube444_mbeduino-very_simple_demo/\\ (2) 点灯バリエーションを盛り込んだデモ\\ http://mbed.org/users/okano/programs/LED_Cube444_mbeduino_demo/\\ またこれとは別に,ハードウェアのテスト用のコードを公開してあります\\ http://mbed.org/users/okano/programs/mbeduino_LED_Cube444_test/\\ ハードウェアについては以下のリンクを参照下さい\\ http://mbed.org/users/okini3939/notebook/mbeduino/ \\ http://www.galileo-7.com/?pid=20015630 \\
Diff: LED_Cube444.h
- Revision:
- 0:6c57a47e2079
- Child:
- 1:86d2cad72832
diff -r 000000000000 -r 6c57a47e2079 LED_Cube444.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LED_Cube444.h Thu Oct 14 14:26:21 2010 +0000 @@ -0,0 +1,63 @@ +/** mbeduino demo code (with 4x4x4 LED Cube shield) + * + * This is a simple demo code of mbeduino + 4x4x4 LED Cube shield + * + * mbeduino = http://mbed.org/users/okini3939/notebook/mbeduino/ (Japanese) + * 4x4x4 LED Cube shield = http://www.galileo-7.com/?pid=20015630 (Japanese) + * + * Released under the MIT License: http://mbed.org/license/mit + * + * revision 0.5 14-Oct-2010 1st release + */ + +#ifndef _LED_Cube +#define _LED_Cube + +#include "mbed.h" +#include "mbeduino_shield.h" + +typedef unsigned short U16; // bit length should be same or more than SR_BIT_LENGTH + +#define CUBE_SIZE 4 // n of nodes on one edge +#define SR_BIT_LENGTH (CUBE_SIZE * CUBE_SIZE) // n of bits on one layer + +#define SR_DATA_OUT ARD_D2 // data line to the shiftregister +#define SR_CLCK_OUT ARD_D3 // clock line to the shiftregister +#define CATHODE0 ARD_D11 // cathode control line for bottom layer +#define CATHODE1 ARD_D10 // cathode control line for 2nd layer from bottom +#define CATHODE2 ARD_D9 // cathode control line for 3nd layer from bottom +#define CATHODE3 ARD_D8 // cathode control line for top layer + +#define DISPLAY_REFRESH_RETE 0.002 + +/** LED_Cube444 + * + * + */ + +class LED_Cube444 { +public: + LED_Cube444(); + void set_bits( U16 v[4] ); + void set_bits( int layer, U16 v ); + void set_bit( int x, int y, int z, U16 v ); + void clear( void ); + void all_on( void ); + void set_all_words( int v ); + void set_synchronous_draw( int v ); + +private: + DigitalOut sr_data; + DigitalOut sr_clk; + BusOut cathode; + Ticker t; + U16 main_buffer[ CUBE_SIZE ]; + U16 temp_buffer[ CUBE_SIZE ]; + int syncronous; + + void display( void ); + void set_serialregister( U16 v ); + void buffer_copy( U16 *src, U16 *trg ); +}; + +#endif // _LED_Cube