This is a remake of tetris game for mbed. Please see detail here http://developer.mbed.org/users/sucrelv/notebook/tetris-game-on-mbed
Dependencies: 4DGL-uLCD-SE PinDetect SDFileSystem mbed-rtos mbed wave_player
Shiftbrite/Shiftbrite.cpp
- Committer:
- sucrelv
- Date:
- 2014-10-21
- Revision:
- 0:3b5e97ab5884
File content as of revision 0:3b5e97ab5884:
#include "mbed.h" #include "Shiftbrite.h" Shiftbrite::Shiftbrite(PinName pin_e, PinName pin_l, PinName pin_do,PinName pin_di, PinName pin_clk): _pin_e(pin_e), _pin_l(pin_l), _spi(pin_do, pin_di, pin_clk) { SPI _spi(pin_do, pin_di, pin_clk); _pin_l=0; _pin_e=0; _spi.format(16,0); _spi.frequency(500000); } void Shiftbrite::RGB(int red, int green, int blue){ unsigned int low_color=0; unsigned int high_color=0; high_color=(blue<<4)|((red&0x3C0)>>6); low_color=(((red&0x3F)<<10)|(green)); _spi.write(high_color); _spi.write(low_color); _pin_l=1; _pin_l=0; }