Jump to content

MIOS32_DONT_SERVICE_SRIO_SCAN & Shiftregistors


Phatline

Recommended Posts

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 by Phatline
Link to comment
Share on other sites

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

Core32-J19.png.f6a6dea65a1843b875bfb849a

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...:

Key-board.thumb.jpg.d79b8b20881f037164ce

 

and thats the midibox stuff... its getting pretty full in there ;)

phton.thumb.jpg.424dd115bc05930dd565ddee

 

Edited by Phatline
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...