I’m trying to use a rotary encoder connected to pin 6 and 7 of my second din register…
I’ve tried to use this encoder with this line in init():
// set encoder speed mode of datawheel
MIOS_ENC_SpeedSet(14, DATAWHEEL_SPEED_MODE, DATAWHEEL_SPEED_DIVIDER);
and this code in ENC_NotifyChange(…)
if (encoder == 14) {
unsigned int value;
if (cs_layer == CS_LAYER_SFB) {
CS_GetSFB(cs_sfb_mode);
value = SFB_val;
SFB_val = (MIOS_HLP_16bitAddSaturate(incrementer, &value, SFB_max))&0xFF;
} else {
//if no special function is selected the encoder changes the current bpm
value = MCLOCK_BPMGet();
MCLOCK_BPMSet(MIOS_HLP_16bitAddSaturate(incrementer, &value, 255)&0xFF);
}
app_flags.DISPLAY_UPDATE_REQ = 1;
}