Esempio n. 1
0
void ins_periodic_task( void ) {
  if (!SpiCheckAvailable()) {
    SpiOverRun();
    return;
  }

  if (!ins_configure()) return;

  // Fill request for QMR
  last_send_packet.CmdID = VN100_CmdID_ReadRegister;
  last_send_packet.RegID = VN100_REG_YMR;

  spi_buffer_input = (uint8_t*)&last_received_packet;
  spi_buffer_output = (uint8_t*)&last_send_packet;
  spi_buffer_length = 4+VN100_REG_YMR_SIZE;
  SpiSelectSlave0();
  SpiStart();

}
Esempio n. 2
0
void vn100_periodic_task(void)
{

  // only send config or request when last transaction is done
  if (vn100_trans.status != SPITransDone) { return; }

  // send request when configuration is done
  if (ins_configure() == TRUE) {
    // Fill request for QMR
    last_send_packet.CmdID = VN100_CmdID_ReadRegister;
    last_send_packet.RegID = VN100_REG_YMR;
    // Set IO length
    vn100_trans.output_length = 2; // Only 2 ?
    vn100_trans.input_length = 4 + VN100_REG_YMR_SIZE;
    // submit
    spi_submit(&(VN100_SPI_DEV), &vn100_trans);
  }

}