VAS Product Release 2.0 - Task #3381: Software Readiness - Synchronous RPM

Mohan Kashyap
2026-03-25T14:05:43Z

struct _pin sync_in_pins = {PIO_GROUP_C, PIO_PC30, PIO_INPUT, PIO_DEFAULT};
struct _pin sync_out_pins = {PIO_GROUP_E, PIO_PE27, PIO_OUTPUT_1, PIO_DEFAULT};

// pin configuration
pio_configure(&sync_in_pins, 1);
pio_configure(&sync_out_pins, 1);

pulse_count = 0;
uint32_t start_time = timer_get_tick();
while(1)
{
	while(pio_get(&sync_in_pins));
	pulse_count++;
	while(!pio_get(&sync_in_pins));
	if(timer_get_tick() - start_time >= 1000)
	{
		printf("Pulse Count = %d\n\r", pulse_count);
		pulse_count = 0;
		start_time = timer_get_tick();
	}
}