Firmware/src/comms.c
void comms_handle_char(uint8_t data)
{
    static char prev = '\n';
    static bool in_urc = false;
    int rb;
#if DUMP_MODEM
    printf("%c", data);
#endif
    if (prev == '\n' && data == '+')
    {
        in_urc = true;
    }
    if (in_urc)
    {
        ring_buf_put(&urc_rb, &data, 1);
        k_sem_give(&urc_sem);
    }
    if (in_urc && data == '\r')
    {
        in_urc = false;
    }
    rb = ring_buf_put(&rx_rb, &data, 1);
    if (rb != 1)
    {
        LOG_ERR("RX buffer is full");
        return;
    }
    prev = data;
    k_sem_give(&rx_sem);
}
/**
 * @brief Callback for chars from the modem
 */
@brief Callback for chars from the modem
@brief Callback for chars from the modem
void comms_handle_char(uint8_t data)
{
    static char prev = '\n';
    static bool in_urc = false;
    int rb;
#if DUMP_MODEM
    printf("%c", data);
#endif
    if (prev == '\n' && data == '+')
    {
        in_urc = true;
    }
    if (in_urc)
    {
        ring_buf_put(&urc_rb, &data, 1);
        k_sem_give(&urc_sem);
    }
    if (in_urc && data == '\r')
    {
        in_urc = false;
    }
    rb = ring_buf_put(&rx_rb, &data, 1);
    if (rb != 1)
    {
        LOG_ERR("RX buffer is full");
        return;
    }
    prev = data;
    k_sem_give(&rx_sem);
}
void comms_handle_char ( uint8_t data ) { static char prev = ' \n ' ; static bool in_urc = false ; int rb ; #if DUMP_MODEM printf ( " " , data ) ; #endif if ( prev == ' \n ' && data == ' ' ) { in_urc = true ; } if ( in_urc ) { ring_buf_put ( & urc_rb , & data , 1 ) ; k_sem_give ( & urc_sem ) ; } if ( in_urc && data == ' \r ' ) { in_urc = false ; } rb = ring_buf_put ( & rx_rb , & data , 1 ) ; if ( rb != 1 ) { LOG_ERR ( " " ) ; return ; } prev = data ; k_sem_give ( & rx_sem ) ; }
@brief Callback for chars from the modem
@brief Callback for chars from the modem