Blame |
Last modification |
View Log
| RSS feed
#include "main.h"
u8 FileExists;
serial_data_struct data_package_camera_control; //Data Package for controlling the Camera
serial_data_struct data_package_camera_control_gier; //Data Package for controlling the Gier-Axis of the MikroKopter
serial_data_struct data_package_kopter_control; //Data Package for controlling the MikroKopter
int main(void){
frame_init();
FileExists = file_init();
gamepad_init();
gpio_init();
calibration_init();
uart_init();
buzzer_short(3);
for (;;)
{
check_program_switch();
if(ProgramSelect == 1){
read_gamepad_data();
create_data_camera(&data_package_camera_control, &data_package_camera_control_gier);
create_serial_frame(1, 'y', 12, &data_package_camera_control); //address, Command ID, Serial Command Length, data
create_serial_frame(1, 'b', sizeof(struct str_ExternControl), &data_package_camera_control_gier); //Gier
transmit_data(&data_package_camera_control);
transmit_data(&data_package_camera_control_gier);
}
if(ProgramSelect == 2){
check_if_controls_active();
if(IsActive){
get_sensitivity();
read_gamepad_data();
create_data_kopter(&data_package_kopter_control);
create_serial_frame(1, 'b', sizeof(struct str_ExternControl), &data_package_kopter_control);
transmit_data(&data_package_kopter_control);
}
}
usleep(5000); //200hz
}
}