Phatline Posted January 30, 2020 Report Share Posted January 30, 2020 (edited) i have a small 25keys keyboard here (alesis proton x25), i managed to get the keys velocity sensitive to working, the connector is 1:1 to the DIO-Matrix ---lucky me! but i run into the problem that the code uses: #define MIOS32_DONT_SERVICE_SRIO_SCAN 1 which disables my normal Shiftregisters for Encoder I cant use the J10 or J5 for it, because they have to less pins, and they are already used for other stuff anyway... How can i use the Shiftregistors? ... i have 4 DIN and 4 DOUT Registor in addition to the MB-DIO-Matrix I read that in for example the MB-KB code: ///////////////////////////////////////////////////////////////////////////// // This hook is called after the shift register chain has been scanned ///////////////////////////////////////////////////////////////////////////// void APP_SRIO_ServiceFinish(void) { // -> keyboard handler KEYBOARD_SRIO_ServiceFinish(); // standard SRIO scan has been disabled in programming_models/traditional/main.c via MIOS32_DONT_SERVICE_SRIO_SCAN in mios32_config.h // start the scan here - and retrigger it whenever it's finished APP_SRIO_ServicePrepare(); MIOS32_SRIO_ScanStart(APP_SRIO_ServiceFinish); } i dont know what that mean? should it still working then? i found out, that i still can activate LEDs, and i get the DIN-States, however i dont get any ENC Values The Hardware itself is functional since i debugged it with tutorials/015_enc_absolute i am pretty sure that something in here, break the enc routine: void APP_SRIO_ServicePrepare(void){ // select next column, wrap at 16 if( ++selected_row >= MATRIX_NUM_ROWS ) { selected_row = 0; // increment timestamp for velocity delay measurements ++timestamp; } // selection pattern (active selection is 0, all other outputs 1) u16 selection_mask = ~(1 << (u16)selected_row); // transfer to DOUTs #if MATRIX_DOUT_SR1 MIOS32_DOUT_SRSet(MATRIX_DOUT_SR1-1, (selection_mask >> 0) & 0xff); #endif #if MATRIX_DOUT_SR2 MIOS32_DOUT_SRSet(MATRIX_DOUT_SR2-1, (selection_mask >> 8) & 0xff); #endif} } void APP_SRIO_ServiceFinish(void) { // check DINs #if MATRIX_DIN_SR // the DIN scan was done with previous row selection, not the current one: int prev_row = selected_row ? (selected_row - 1) : (MATRIX_NUM_ROWS - 1); u8 sr = MATRIX_DIN_SR; MIOS32_DIN_SRChangedGetAndClear(sr-1, 0xff); // ensure that change won't be propagated to normal DIN handler u8 sr_value = MIOS32_DIN_SRGet(sr-1); // determine pin changes u8 changed = sr_value ^ din_value[prev_row]; if( changed ) { // add them to existing notifications din_value_changed[prev_row] |= changed; // store new value din_value[prev_row] = sr_value; // store timestamp for changed pin on 1->0 transition u8 sr_pin; u8 mask = 0x01; for(sr_pin=0; sr_pin<8; ++sr_pin, mask <<= 1) { if( (changed & mask) && !(sr_value & mask) ) { din_activated_timestamp[prev_row*8 + sr_pin] = timestamp; } } } #endif // standard SRIO scan has been disabled in programming_models/traditional/main.c via MIOS32_DONT_SERVICE_SRIO_SCAN in mios32_config.h // start the scan here - and retrigger it whenever it's finished APP_SRIO_ServicePrepare(); MIOS32_SRIO_ScanStart(APP_SRIO_ServiceFinish); } Edited January 30, 2020 by Phatline Quote Link to comment Share on other sites More sharing options...
Phatline Posted February 2, 2020 Author Report Share Posted February 2, 2020 (edited) or could J19 (SPI2) reused, for a second "J8/J9" like SR "Chain"? (has this already some one done, which app?) J16 cant be used because of: Quote J16 is normaly connected to a SD Card Quote J19 doesn't support DMA transfers, so that MIOS32_SPI_TransferBlock() will consume CPU time (but the callback handling does work). so maybe not... && Quote MIOS32_spi.c says: //! J19 provides SPI + two RCLK lines at 5V. //! It's some kind of general purpose SPI, and used to communicate with //! various MBHP modules, such as MBHP_AOUT* and MBHP_AINSER* ....By the way this is the Keyboard Layout...: and thats the midibox stuff... its getting pretty full in there ;) Edited February 2, 2020 by Phatline Quote Link to comment Share on other sites More sharing options...
TK. Posted February 2, 2020 Report Share Posted February 2, 2020 For scanning encoders just call MIOS32_ENC_UpdateStates before APP_SRIO_Prepare() See also MBNG application, search for MIOS32_ENC_UpdateStates: https://github.com/midibox/mios32/blob/master/apps/controllers/midibox_ng_v1/src/app.c Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Phatline Posted February 2, 2020 Author Report Share Posted February 2, 2020 THX that solved it! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.