Example #1
0
File: lumen.c Project: lavallc/ion
void lumen_init() {
	//initialize all the ray structures
	neopixel_init(&ray1, kSunBoardPinRay1, kSunBoardNumberOfLedsPerRay);
	neopixel_init(&ray2, kSunBoardPinRay2, kSunBoardNumberOfLedsPerRay);
	neopixel_init(&ray3, kSunBoardPinRay3, kSunBoardNumberOfLedsPerRay);
	neopixel_init(&ray4, kSunBoardPinRay4, kSunBoardNumberOfLedsPerRay);
	lumen_dfu_flashed_data = 0;
  lumen_dfu_data_size = 0;
}
Example #2
0
void init_ledstrips()
{
    uint8_t *memptr = led_memory;
    for (int strip_num=0; strip_num<LEDSTRIP_COUNT; strip_num++)
    {
        strip[strip_num].leds = memptr;
        memptr = memptr + leds_per_strip[strip_num]*3;
        neopixel_init(&strip[strip_num], strip_at_pin[strip_num], leds_per_strip[strip_num]);
        // unnecessary, filled with zeroes by startup script anyways
        //neopixel_clear(&strip[strip_num]);
        strip_changed[strip_num] = true;
    }
}
Example #3
0
STATIC mp_obj_t neopixel_make_new(const mp_obj_type_t *type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
    (void)type_in;
    mp_arg_check_num(n_args, n_kw, 2, 2, false);

    PinName pin = microbit_obj_get_pin(args[0])->name;
    mp_int_t num_pixels = mp_obj_get_int(args[1]);

    if (num_pixels <= 0) {
        nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "invalid number of pixels"));
    }

    neopixel_obj_t *self = m_new_obj(neopixel_obj_t);
    self->base.type = &neopixel_type;
    neopixel_init(&self->strip, pin, num_pixels);

    return self;
}