コード例 #1
0
ファイル: app.c プロジェクト: JKcompute/395_midi_controller
/////////////////////////////////////////////////////////////////////////////
//! This hook is called after the shift register chain has been scanned
/////////////////////////////////////////////////////////////////////////////
void APP_SRIO_ServiceFinish(void)
{
  u8 skip_scs = 0;
#if MBNG_PATCH_NUM_DIO > 0
  {
    u8 sr;
    skip_scs = mbng_patch_dio_cfg[0].mode != MBNG_PATCH_DIO_CFG_MODE_Off && (sr=mbng_patch_dio_cfg[0].emu_sr) > 0 && sr <= MIOS32_SRIO_NUM_SR;
  }
#endif

  if( !skip_scs ) {
    // pass current pin state of J10
    // only available for LPC17xx, all others (like STM32) default to SRIO
    SCS_AllPinsSet(0xff00 | MIOS32_BOARD_J10_Get());

    // update encoders/buttons of SCS
    SCS_EncButtonUpdate_Tick();
  }

  // Matrix handler
  MBNG_MATRIX_GetRow();

  // keyboard handler
  KEYBOARD_SRIO_ServiceFinish();

#if MIOS32_DONT_SERVICE_SRIO_SCAN
  // update encoder states
  MIOS32_ENC_UpdateStates();

  // 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);
#endif
}
コード例 #2
0
////////////////////////////////////////////////////////////////////////////////////////////////
//! This function gets the button values of the selected row.
//! It should be called from the APP_SRIO_ServiceFinish() hook
//! \return < 0 on errors
/////////////////////////////////////////////////////////////////////////////
s32 BLM_CHEAPO_GetRow(void)
{
#if 0
  // determine the scanned row (selected_row driver has already been incremented, decrement it again)
  u8 row = (selected_row-1) & 0x7;
#else
  // no shift registers, value immediately available
  u8 row = selected_row;
#endif

  // decrememt debounce counter if > 0
  if( button_debounce_ctr )
    --button_debounce_ctr;

  u8 sr_value = MIOS32_BOARD_J10_Get();

  // determine pin changes
  u8 changed = sr_value ^ button_row[row];

  // ignore as long as debounce counter running
  if( !button_debounce_ctr ) {

    // add them to existing notifications
    button_row_changed[row] |= changed;

    // store new value
    button_row[row] = sr_value;

    // reload debounce counter if any pin has changed
    if( changed )
      button_debounce_ctr = button_debounce_reload;
  }

  return 0; // no error
}
コード例 #3
0
ファイル: mbng_dio.c プロジェクト: glocklueng/MIOS32
/////////////////////////////////////////////////////////////////////////////
//! Returns the 8bit value of a DIO port
/////////////////////////////////////////////////////////////////////////////
u8 MBNG_DIO_PortGet(u8 port)
{
#if MBNG_PATCH_NUM_DIO == 0
  return -1; // not supported
#else
  switch( port ) {
  case 0: {
#if defined(MIOS32_FAMILY_STM32F4xx)
    return MIOS32_BOARD_J10A_Get();
#elif defined(MIOS32_FAMILY_LPC17xx)
    return MIOS32_BOARD_J10_Get();
#else
# error "Please adapt J10 port assignments here"
#endif
  } break;

  case 1: {
#if defined(MIOS32_FAMILY_STM32F4xx)
    return MIOS32_BOARD_J10B_Get();
#elif defined(MIOS32_FAMILY_LPC17xx)
    return MIOS32_BOARD_J28_Get();
#else
# error "Please adapt J10 port assignments here"
#endif
  } break;

#if MBNG_PATCH_NUM_DIO > 2
# error "Add pin get function here"
#endif
  }

  return 0xff; // invalid port
#endif
}
コード例 #4
0
ファイル: app.c プロジェクト: JKcompute/395_midi_controller
/////////////////////////////////////////////////////////////////////////////
// This hook is called before the shift register chain is scanned
/////////////////////////////////////////////////////////////////////////////
void APP_SRIO_ServicePrepare(void)
{
#ifdef MIOS32_FAMILY_LPC17xx
  // pass current pin state of J10
  // only available for LPC17xx, all others (like STM32) default to SRIO
  SCS_AllPinsSet(0xff00 | MIOS32_BOARD_J10_Get());
#endif

  // update encoders/buttons of SCS
  SCS_EncButtonUpdate_Tick();
}