This is an example program for the PololuLedStrip library. It generates a simple moving gradient pattern.
Dependencies: PololuLedStrip mbed LedStripGradient
Dependents: LedStripGradient led_phare_crf
For more information, see the PololuLedStrip library.
Diff: main.cpp
- Revision:
- 3:f566eea13f49
- Parent:
- 2:bd6fe6d2948d
- Child:
- 4:27b5c9cafe92
--- a/main.cpp Tue Feb 26 02:08:39 2013 +0000 +++ b/main.cpp Tue Feb 26 02:16:59 2013 +0000 @@ -1,9 +1,6 @@ #include "mbed.h" #include "gpio_api.h" -//extern "C" int my_asm(volatile uint32_t * set, int value); -extern "C" int my_asm(int x, int value); - namespace Pololu { #ifndef _POLOLU_RGB_COLOR @@ -14,13 +11,15 @@ } rgb_color; #endif + extern "C" int led_strip_write(rgb_color *, volatile uint32_t * set, volatile uint32_t * clear, uint32_t mask); + class PololuLedStrip { static bool interruptFriendly; public: gpio_t gpio; PololuLedStrip(PinName pin); - void write(rgb_color *, unsigned int count); + void write(rgb_color * colors, unsigned int count); }; bool PololuLedStrip::interruptFriendly; @@ -109,9 +108,9 @@ while(1) { myled2 = 1; - my_asm(0, 1); + led_strip_write(NULL, gpio.reg_set, gpio.reg_clr, 1); wait(0.2); - my_asm(1, 0); + led_strip_write(NULL, gpio.reg_set, gpio.reg_clr, 0); myled2 = 0; wait(1); }