#include <stdio.h>
static int running;
static float width;
static void* __send_pulses(__attribute__ ((unused)) void *params)
{
while(running){
}
return 0;
}
int main()
{
pthread_t send_pulse_thread;
printf("\nDISCONNECT PROPELLERS FROM MOTORS\n");
printf("DISCONNECT POWER FROM ESCS\n");
printf("press enter to start sending max pulse width\n");
getchar();
width = 1;
running = 1;
if(
rc_pthread_create(&send_pulse_thread, __send_pulses, (
void*) NULL, SCHED_OTHER,0)==-1){
return -1;
}
printf("\n");
printf("Now apply power to the ESCs.\n");
printf("Press enter again after the ESCs finish chirping\n");
getchar();
printf("\n");
printf("Sending minimum width pulses\n");
printf("Press enter again after the ESCs chirp to finish calibration\n");
width = 0;
getchar();
printf("\nCalibration complete, check with rc_test_escs\n");
running =0;
return 0;
}
void rc_servo_cleanup(void)
Cleans up servo functionality and turns off the power rail.
int rc_servo_send_esc_pulse_normalized(int ch, double input)
Like rc_send_pulse_normalized but translates a desired esc throttle position from 0 to 1....
int rc_servo_init(void)
Configures the PRU to send servo pulses.
int rc_pthread_create(pthread_t *thread, void *(*func)(void *), void *arg, int policy, int priority)
starts a pthread with specified policy and priority
int rc_pthread_timed_join(pthread_t thread, void **retval, float timeout_sec)
Joins a thread with timeout given in seconds.
void rc_usleep(unsigned int us)
Sleep in microseconds.