cs-midi-docs/docs/examples/01-output/21-borrowed-cc-rotary-encod...

564 B

BorrowedCCRotaryEncoder

Shared encoder reference for CC output, allowing multiple elements to read the same physical encoder.

#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
#include <cs_midi.h>

using namespace cs;

BluetoothMIDI_Interface midi;

AHEncoder encoder {0, 2};

BorrowedCCRotaryEncoder enc {
    encoder,
    {16, Channel_1},
    1,
    4,
};

int main() {
    stdio_init_all();
    if (cyw43_arch_init()) return 1;
    Control_Surface.begin();
    while (true) {
        Control_Surface.loop();
        sleep_ms(1);
    }
}