Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Shiftbrite.cpp
00001 #include "mbed.h" 00002 #include "Shiftbrite.h" 00003 00004 00005 00006 00007 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) 00008 { 00009 SPI _spi(pin_do, pin_di, pin_clk); 00010 _pin_l=0; 00011 _pin_e=0; 00012 _spi.format(16,0); 00013 _spi.frequency(500000); 00014 } 00015 00016 00017 void Shiftbrite::RGB(int red, int green, int blue){ 00018 00019 unsigned int low_color=0; 00020 unsigned int high_color=0; 00021 high_color=(blue<<4)|((red&0x3C0)>>6); 00022 low_color=(((red&0x3F)<<10)|(green)); 00023 _spi.write(high_color); 00024 _spi.write(low_color); 00025 _pin_l=1; 00026 _pin_l=0; 00027 00028 } 00029 00030
Generated on Wed Jul 13 2022 13:31:10 by
1.7.2