lavallc / nrf51-neopixel

WS2812(Neopixel) library for the Nordic Semiconductor 51822 Bluetooth Low Energy ARM SoC.
MIT License
60 stars 22 forks source link

Not working with OSHChip #3

Open morganrallen opened 6 years ago

morganrallen commented 6 years ago

Board reference: http://oshchip.org/

I'm attempting to get a single LED working on the OSHChip board with no Soft Device.

Code

#include "nrf_delay.h"
#include "nrf_gpio.h"
#include "boards.h"
#include "neopixel.h"

int leds[] = { LED_RED, LED_GREEN, LED_BLUE };

neopixel_strip_t m_strip;
uint8_t dig_pin_num = OSHChip_Pin_3;
uint8_t leds_per_strip = 1;
uint8_t error;
uint8_t led_to_enable = 0;
uint8_t red = 0;
uint8_t green = 255;
uint8_t blue = 0;

int main(void)
{
  int i = 0;

  for(; i < 3; i++) {
    nrf_gpio_cfg_output(leds[i]);
    nrf_gpio_pin_set(leds[i]);
  }

  i = 1;

  neopixel_init(&m_strip, dig_pin_num, leds_per_strip);
  neopixel_clear(&m_strip);

  while(i++) {

    error = neopixel_set_color_and_show(&m_strip, led_to_enable, red, i % 255, blue);

    if(error) {
        nrf_gpio_pin_clear(LED_RED);
    } else {
        nrf_gpio_pin_set(LED_RED);
    }

    nrf_delay_ms(500);
  }
}

The result is a solid blue/red mix without any changes.

OSHChip_Pin_3 expands to 16 and I've verified signal on the pin.

Not sure what else to provide but I have noticed something interesting compared to the Adafruit NeoPixel library. Using that my scope shows a constant stream of ~8 bits in a span of about 30us where as this library shows (I assume) ~24 over an 80us period.

morganrallen commented 6 years ago

Adafruit NeoPixel on WeMos D1 Mini dsc_1232

nrf51-neopixel on OSHChip dsc_1233