Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2105 | - | 1 | #include "main.h" |
2 | |||
3 | |||
4 | u8 FileExists; |
||
5 | serial_data_struct data_package_camera_control; //Data Package for controlling the Camera |
||
6 | serial_data_struct data_package_camera_control_gier; //Data Package for controlling the Gier-Axis of the MikroKopter |
||
7 | serial_data_struct data_package_kopter_control; //Data Package for controlling the MikroKopter |
||
8 | |||
9 | int main(void){ |
||
10 | frame_init(); |
||
11 | FileExists = file_init(); |
||
12 | gamepad_init(); |
||
13 | gpio_init(); |
||
14 | calibration_init(); |
||
15 | uart_init(); |
||
16 | buzzer_short(3); |
||
17 | |||
18 | for (;;) |
||
19 | { |
||
20 | check_program_switch(); |
||
21 | if(ProgramSelect == 1){ |
||
22 | read_gamepad_data(); |
||
23 | create_data_camera(&data_package_camera_control, &data_package_camera_control_gier); |
||
24 | create_serial_frame(1, 'y', 12, &data_package_camera_control); //address, Command ID, Serial Command Length, data |
||
25 | create_serial_frame(1, 'b', sizeof(struct str_ExternControl), &data_package_camera_control_gier); //Gier |
||
26 | transmit_data(&data_package_camera_control); |
||
27 | transmit_data(&data_package_camera_control_gier); |
||
28 | } |
||
29 | if(ProgramSelect == 2){ |
||
30 | check_if_controls_active(); |
||
31 | if(IsActive){ |
||
32 | get_sensitivity(); |
||
33 | read_gamepad_data(); |
||
34 | create_data_kopter(&data_package_kopter_control); |
||
35 | create_serial_frame(1, 'b', sizeof(struct str_ExternControl), &data_package_kopter_control); |
||
36 | transmit_data(&data_package_kopter_control); |
||
37 | } |
||
38 | } |
||
39 | usleep(5000); //200hz |
||
40 | } |
||
41 | } |