leds

each inlet controls one of euxo's leds.
Author: Paul
License: BSD
Github: euxo/1 2/midi/leds.axo

Inlets

frac32.positive led1

frac32.positive led2

frac32.positive led3

frac32.positive led4

Outlets

None

Declaration
int32_t led1, led2, led3, led4;

msg_t ThreadX2() {
#if CH_USE_REGISTRY
  chRegSetThreadName("euxo led"); // define thread name
#endif

  while (!chThdShouldTerminate()) {
    // while(!sdPutWouldBlock(&SD2)){

    sdPut(&SD2, 0xb0);
    sdPut(&SD2, 0);
    sdPut(&SD2, led1 >> 20);

    sdPut(&SD2, 0xb0);
    sdPut(&SD2, 1);
    sdPut(&SD2, led2 >> 20);

    sdPut(&SD2, 0xb0);
    sdPut(&SD2, 2);
    sdPut(&SD2, led3 >> 20);

    sdPut(&SD2, 0xb0);
    sdPut(&SD2, 3);
    sdPut(&SD2, led4 >> 20);

    //}
    chThdSleepMilliseconds(1);
  }
  chThdExit((msg_t)0);
}
static msg_t EuxoLED(void *arg) { ((attr_parent *)arg)->ThreadX2(); }
WORKING_AREA(waEuxoLED, 128);
Thread *Thd;
Init
led1 = 0;
led2 = 0;
led3 = 0;
led4 = 0;

Thd = chThdCreateStatic(waEuxoLED, sizeof(waEuxoLED), NORMALPRIO, EuxoLED,
                        (void *)this);
Dispose
chThdTerminate(Thd);
chThdWait(Thd);

Privacy

© 2024 Zrna Research