Jump to content

ballooneater

Members
  • Posts

    3
  • Joined

  • Last visited

ballooneater's Achievements

MIDIbox Newbie

MIDIbox Newbie (1/4)

0

Reputation

  1. I think I get what you mean now. Is this in line with what you were thinking? volatile u8 shift = 0x01; volatile u8 shiftCount = 0; volatile u16 din_values; void APP_SRIO_ServicePrepare(void){ MIOS32_IRQ_Disable(); mios32_srio_dout[15] = shift; MIOS32_IRQ_Enable(); } void APP_SRIO_ServiceFinish(void){ MIOS32_IRQ_Disable(); //Assign first 8 bits of din_values din_values = mios32_srio_din[0]; //Assign 9th bit din_values |= (mios32_srio_din[1] << 8); MIOS32_IRQ_Enable(); u8 j=0; for (j=0;j<9;j++) { if(din_values & (0x01 << j)) { noteOn(j,shiftCount); } else { noteOff(j,shiftCount); } } if (shift == 0x20) { shift = 0x01; shiftCount = 0; } else { shift = shift << 1; shiftCount++; } } Edit: It's worth noting that my set-up uses 6 DOUT pins and 9 DIN
  2. Thanks! I'll try using the SRIO functions and see how that goes. Edit: how does this look? void APP_Background(void){ u8 shift = 0x01; u8 i = 0; u8 j = 0; while(1){ shift = 0x01; for (i=0;i<8;i++) { mios32_srio_dout[0] = shift; for (j=0;j<8;j++) { if(mios32_srio_din[0] & (0x01 << j)) { //Note is on } else { //Note is off } } shift << 1; } } }
  3. I'm interested in creating a simple 8x8 keyboard matrix scanner and was wondering if I was heading down the right path with my code. Initializations: int m,j,i; for(m=0;m<8;m++){ MIOS32_DOUT_PinSet(m,1); } int prevState[8] = {1,1,1,1,1,1,1,1}; And this is inside of APP_Background, repeating endlessly: for (j=0; j<8; j++) { MIOS32_DOUT_PinSet(j,0); for (i=0; i<8; i++) { if(MIOS32_DIN_PinGet(i)==0 && prevState[i]==1) { //Send button on message prevState[i]=0; } if (MIOS32_DIN_PinGet(i)==1 && prevState[i]==0) { //Send button off message prevState[i]=1; } else prevState[i] = MIOS32_DIN_PinGet(i); } MIOS32_DOUT_PinSet(j,1); }
×
×
  • Create New...