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.
Dependents: blink_led_threading
Revision 2:b8dc9a84801c, committed 2015-03-11
- Comitter:
- rosienej
- Date:
- Wed Mar 11 14:25:18 2015 +0000
- Parent:
- 1:ce2f23241f88
- Commit message:
- Formatting and docs
Changed in this revision
| APA102.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/APA102.h Wed Mar 11 14:13:13 2015 +0000
+++ b/APA102.h Wed Mar 11 14:25:18 2015 +0000
@@ -4,16 +4,10 @@
#include "mbed.h"
-/** Create an APA102_IRGB helper macro to construct a 4 byte LED Frame
- *
- * @param I : 5 bits of intensity (0,1,2,...,31)
- * @param R : 8 bits of Red (0,1,...,255)
- * @param G : 8 bits of Green (0,1,...,255)
- * @param B : 8 bits of Blue (0,1,...,255)
- */
-
- #define APA102_IRGB(I,R,G,B) ((0xE0 + 0x1F&I)<<24)|((0xFF&R)<<16)|((0xFF&G)<<8)|(0xFF&B)
-
+
+
+/** Create an APA102 Object
+ */
class APA102{
public:
/** Create an APA102 object connected to the specified mosi,miso,sclk pins
@@ -43,8 +37,19 @@
*/
void Repaint();
+/** Create an IRGB helper function to construct a 4 byte LED Frame
+ *
+ * @param I : 5 bits of intensity (0,1,2,...,31)
+ * @param R : 8 bits of Red (0,1,...,255)
+ * @param G : 8 bits of Green (0,1,...,255)
+ * @param B : 8 bits of Blue (0,1,...,255)
+ */
+
+int IRGB(unsigned char I,unsigned char R,unsigned char G,unsigned char B) {
+ return ((0xE0 + 0x1F&I)<<24)|((0xFF&R)<<16)|((0xFF&G)<<8)|(0xFF&B);}
+
protected:
- // SPI _spi(PTA16, PTA17, PTA15); // mosi, miso, sclk
+
SPI _spi;
private:
int NR;