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 \\

Committer:
okano
Date:
Thu Oct 14 14:26:21 2010 +0000
Revision:
0:6c57a47e2079
Child:
1:86d2cad72832
tentative release (rev 0.5)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okano 0:6c57a47e2079 1 /** mbeduino demo code (with 4x4x4 LED Cube shield)
okano 0:6c57a47e2079 2 *
okano 0:6c57a47e2079 3 * This is a simple demo code of mbeduino + 4x4x4 LED Cube shield
okano 0:6c57a47e2079 4 *
okano 0:6c57a47e2079 5 * mbeduino = http://mbed.org/users/okini3939/notebook/mbeduino/ (Japanese)
okano 0:6c57a47e2079 6 * 4x4x4 LED Cube shield = http://www.galileo-7.com/?pid=20015630 (Japanese)
okano 0:6c57a47e2079 7 *
okano 0:6c57a47e2079 8 * Released under the MIT License: http://mbed.org/license/mit
okano 0:6c57a47e2079 9 *
okano 0:6c57a47e2079 10 * revision 0.5 14-Oct-2010 1st release
okano 0:6c57a47e2079 11 */
okano 0:6c57a47e2079 12
okano 0:6c57a47e2079 13 #ifndef _LED_Cube
okano 0:6c57a47e2079 14 #define _LED_Cube
okano 0:6c57a47e2079 15
okano 0:6c57a47e2079 16 #include "mbed.h"
okano 0:6c57a47e2079 17 #include "mbeduino_shield.h"
okano 0:6c57a47e2079 18
okano 0:6c57a47e2079 19 typedef unsigned short U16; // bit length should be same or more than SR_BIT_LENGTH
okano 0:6c57a47e2079 20
okano 0:6c57a47e2079 21 #define CUBE_SIZE 4 // n of nodes on one edge
okano 0:6c57a47e2079 22 #define SR_BIT_LENGTH (CUBE_SIZE * CUBE_SIZE) // n of bits on one layer
okano 0:6c57a47e2079 23
okano 0:6c57a47e2079 24 #define SR_DATA_OUT ARD_D2 // data line to the shiftregister
okano 0:6c57a47e2079 25 #define SR_CLCK_OUT ARD_D3 // clock line to the shiftregister
okano 0:6c57a47e2079 26 #define CATHODE0 ARD_D11 // cathode control line for bottom layer
okano 0:6c57a47e2079 27 #define CATHODE1 ARD_D10 // cathode control line for 2nd layer from bottom
okano 0:6c57a47e2079 28 #define CATHODE2 ARD_D9 // cathode control line for 3nd layer from bottom
okano 0:6c57a47e2079 29 #define CATHODE3 ARD_D8 // cathode control line for top layer
okano 0:6c57a47e2079 30
okano 0:6c57a47e2079 31 #define DISPLAY_REFRESH_RETE 0.002
okano 0:6c57a47e2079 32
okano 0:6c57a47e2079 33 /** LED_Cube444
okano 0:6c57a47e2079 34 *
okano 0:6c57a47e2079 35 *
okano 0:6c57a47e2079 36 */
okano 0:6c57a47e2079 37
okano 0:6c57a47e2079 38 class LED_Cube444 {
okano 0:6c57a47e2079 39 public:
okano 0:6c57a47e2079 40 LED_Cube444();
okano 0:6c57a47e2079 41 void set_bits( U16 v[4] );
okano 0:6c57a47e2079 42 void set_bits( int layer, U16 v );
okano 0:6c57a47e2079 43 void set_bit( int x, int y, int z, U16 v );
okano 0:6c57a47e2079 44 void clear( void );
okano 0:6c57a47e2079 45 void all_on( void );
okano 0:6c57a47e2079 46 void set_all_words( int v );
okano 0:6c57a47e2079 47 void set_synchronous_draw( int v );
okano 0:6c57a47e2079 48
okano 0:6c57a47e2079 49 private:
okano 0:6c57a47e2079 50 DigitalOut sr_data;
okano 0:6c57a47e2079 51 DigitalOut sr_clk;
okano 0:6c57a47e2079 52 BusOut cathode;
okano 0:6c57a47e2079 53 Ticker t;
okano 0:6c57a47e2079 54 U16 main_buffer[ CUBE_SIZE ];
okano 0:6c57a47e2079 55 U16 temp_buffer[ CUBE_SIZE ];
okano 0:6c57a47e2079 56 int syncronous;
okano 0:6c57a47e2079 57
okano 0:6c57a47e2079 58 void display( void );
okano 0:6c57a47e2079 59 void set_serialregister( U16 v );
okano 0:6c57a47e2079 60 void buffer_copy( U16 *src, U16 *trg );
okano 0:6c57a47e2079 61 };
okano 0:6c57a47e2079 62
okano 0:6c57a47e2079 63 #endif // _LED_Cube