Improve bpsk test transmission timing

This commit is contained in:
Jan Hamal Dvořák 2024-06-08 17:05:56 +02:00
parent eb75e3ccc3
commit 2825e5e49d

View file

@ -947,10 +947,21 @@ static void command(const char *cmd)
actual = rx_lo_init(actual - step_hz);
printf("Frequency: %.0f\n", actual);
} else if ((c >= '1') && (c <= '9')) {
for (int i = 0; i < 1000; i++) {
phase = !phase;
uint32_t t0 = time_us_32();
uint32_t tmax = 1000000 / (c - '0');
uint32_t step = 1000 / (c - '0') / 2;
while (true) {
uint32_t t1 = time_us_32();
uint32_t te = t1 - t0;
if (te >= tmax)
break;
phase = (te / step) & 1;
gpio_set_outover(n, phase);
sleep_us(1000 / (c - '0'));
sleep_us(1);
}
}
}