I need to poll a NMEA data stream and it's easiest getting a byte at a time, but it's dropping to 30ms between individual reads in this loop:
uint8_t next = 0;
uint8_t ref = 6;
uint8_t readbuf[2] = {0};
while(next != '\n')
{
nrf_gpio_pin_set(RED_LED);
if(twi_master_transfer(PAM7Q_ADDRESS | TWI_READ_BIT, readbuf, 1, TWI_DONT_ISSUE_STOP))
{
next = readbuf[0];
if((next != 0xFF))
{
ubxMsg.B[ref] = next;
ref++;
}
}
nrf_gpio_pin_clear(RED_LED);
}
twi_master_transfer(PAM7Q_ADDRESS | TWI_READ_BIT, NULL, 1, TWI_ISSUE_STOP);
Is there anything I am doing blatantly wrong?