Beispiel #1
0
void nmea_process_character(char c) {
    switch (c) {
    case '$': /* a new sentence is starting */
        sentence_started();
        /* reset and enable checksum calculation */
        checksum = 0;
        checksum_state = CS_CALC;
        break;
    case ',':
        token_finished();
        break;
    case '*': /* checksum is following */
        token_finished();
        checksum_state = CS_READ;
        break;
    case '\r':
        /* \n is following soon, we ignore this */
        break;
    case '\n':
        token_finished();
        ATOMIC(ATOMIC_FORCEON) {
            sentence_finished();
        }
        checksum_state = CS_UNKNOWN;
        break;
    default:
        append_to_token(c);
    }
    if (checksum_state == CS_CALC && c != '$') {
        add_to_checksum(c);
    }
}
Beispiel #2
0
static void
add_buf_to_checksum(unsigned char *buf, int len) {
    unsigned char *c;
    int i;

    for (i = 0, c = buf; i < len; i++, c++) {
	add_to_checksum(*c);
    }
}
Beispiel #3
0
int
casio_qv_send_byte(sdcInfo info, unsigned char c) {
    add_to_checksum(c);
    return(sdcSendByte(info, c));
}