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: ArchPro_LWM2M_LED_Client
Fork of PololuLedStrip by
PololuLedStrip.cpp
- Committer:
- DavidEGrayson
- Date:
- 2013-02-27
- Revision:
- 1:102307d9b701
- Child:
- 4:d3b60bd43811
File content as of revision 1:102307d9b701:
#include "PololuLedStrip.h"
bool PololuLedStrip::interruptFriendly = false;
PololuLedStrip::PololuLedStrip(PinName pinName)
{
gpio_init(&gpio, pinName, PIN_OUTPUT);
}
void PololuLedStrip::write(rgb_color * colors, unsigned int count)
{
__disable_irq(); // Disable interrupts temporarily because we don't want our pulse timing to be messed up.
while(count--)
{
led_strip_write_color(colors++, gpio.reg_set, gpio.reg_clr, gpio.mask);
if (interruptFriendly)
{
__enable_irq();
__nop();
__nop();
__nop();
__disable_irq();
}
}
__enable_irq(); // Re-enable interrupts now that we are done.
wait_us(24); // Hold the line low for 24 microseconds to send the reset signal.
}
