Skip to content

Commit

Permalink
Set neopixel functions inside the codal namespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-carlos committed Jul 23, 2024
1 parent bdfa1ec commit 660ee5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions inc/neopixel.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#include "NRF52PWM.h"
#include "WS2812B.h"

void neopixel_send_buffer(Pin &pin, const uint8_t *ptr, int numBytes);
void neopixel_send_buffer(Pin &pin, ManagedBuffer buffer);
namespace codal {
void neopixel_send_buffer(Pin &pin, const uint8_t *ptr, int numBytes);
void neopixel_send_buffer(Pin &pin, ManagedBuffer buffer);
}

#endif // CODAL_NEOPIXEL_H
6 changes: 3 additions & 3 deletions source/neopixel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace codal;

#if CONFIG_ENABLED(HARDWARE_NEOPIXEL)

void neopixel_send_buffer(Pin &pin, const uint8_t *ptr, int numBytes)
void codal::neopixel_send_buffer(Pin &pin, const uint8_t *ptr, int numBytes)
{
static NRF52PWM *pwm = NULL;
static WS2812B *ws = NULL;
Expand All @@ -29,7 +29,7 @@ void neopixel_send_buffer(Pin &pin, const uint8_t *ptr, int numBytes)

#else

__attribute__((noinline)) void neopixel_send_buffer(Pin &pin, const uint8_t *ptr, int numBytes)
__attribute__((noinline)) void codal::neopixel_send_buffer(Pin &pin, const uint8_t *ptr, int numBytes)
{
pin.setDigitalValue(0);

Expand Down Expand Up @@ -88,7 +88,7 @@ __attribute__((noinline)) void neopixel_send_buffer(Pin &pin, const uint8_t *ptr
}
#endif

void neopixel_send_buffer(Pin &pin, ManagedBuffer buffer)
void codal::neopixel_send_buffer(Pin &pin, ManagedBuffer buffer)
{
codal::neopixel_send_buffer(pin, &buffer[0], buffer.length());
}

0 comments on commit 660ee5a

Please sign in to comment.