void rc_periodic_task ( void ) { char line [FP_LINE_WIDTH]; int channel = 0; if (fgets (line, sizeof (line), fp_dev)) { char *token; /* Is there a better way to do this? */ token = strtok (line, " "); if (strcmp (token, "RC_OK")) rc_status = RC_OK; else if (strcmp (token, "RC_LOST")) rc_status = RC_LOST; else rc_status = RC_REALLY_LOST; while ((token = strtok (NULL, " ")) != NULL) { ppm_pulses[channel] = atoi(token); NormalizePpm(); channel ++; } } }
bool_t rc_event_task ( void ) { if (ppm_valid) { ppm_valid = FALSE; ppm_cpt++; time_since_last_ppm = 0; rc_status = RC_OK; /** From ppm values to normalised rc_values */ NormalizePpm(); return TRUE; } return FALSE; }