/** * \brief PARC input signal generating through GPIO port. * * \param risingedge PARC sampling edge, rising edge(true),fall edge (false) * \param data Data to send */ static void parc_port_input_simulation(bool risingedge, uint32_t data) { /* PCCK signal simulation */ if (risingedge) { ioport_set_pin_level(PIN_PCCK, IOPORT_PIN_LEVEL_LOW); } else { ioport_set_pin_level(PIN_PCCK, IOPORT_PIN_LEVEL_HIGH); } /* Place the data on port */ place_data_to_port(data); /* PCCK signal simulation */ if (risingedge) { ioport_set_pin_level(PIN_PCCK, IOPORT_PIN_LEVEL_HIGH); } else { ioport_set_pin_level(PIN_PCCK, IOPORT_PIN_LEVEL_LOW); } }
/** * \brief Interrupt handler for TC00. Record the number of bytes received, * and then restart a read transfer on the USART if the transfer was stopped. */ void TC00_Handler(void) { static int32_t input_data = 0; static int32_t cnt = 0; /* Read TC0 Status. */ tc_get_status(TC0, 0); /* Toggel I/O pin to simulate the PCCK */ ioport_toggle_pin_level(PIN_PCCK_INPUT); /* PCDATA changes every two PCCK level change*/ cnt++; if (cnt == 1) { /* Simulate PCD data */ place_data_to_port(input_data++); if (input_data == BUFFER_SIZE ) { input_data = 0; } } else if (cnt == 2) { cnt =0; } }