/*********************************************************************************************************************
* TC364 Opensourec Library TC364 Դ⣩һڹٷ SDK ӿڵĵԴ
* Copyright (c) 2022 SEEKFREE ɿƼ
*
* ļ TC364 Դһ
*
* TC364 Դ 
* Ըᷢ GPLGNU General Public License GNUͨù֤
*  GPL ĵ3棨 GPL3.0ѡģκκİ汾·/޸
*
* Դķϣܷãδκεı֤
* ûԻʺض;ı֤
* ϸμ GPL
*
* ӦյԴͬʱյһ GPL ĸ
* ûУ<https://www.gnu.org/licenses/>
*
* ע
* Դʹ GPL3.0 Դ֤Э Ϊİ汾
* Ӣİ libraries/doc ļµ GPL3_permission_statement.txt ļ
* ֤ libraries ļ ļµ LICENSE ļ
* ӭλʹò ޸ʱ뱣ɿƼİȨ
*
* ļ          cpu0_main
* ˾          ɶɿƼ޹˾
* 汾Ϣ          鿴 libraries/doc ļ version ļ 汾˵
*           ADS v1.9.20
* ƽ̨          TC364DP
*           https://seekfree.taobao.com/
*
* ޸ļ¼
*                               ע
* 2022-11-02       pudding            first version
********************************************************************************************************************/
#include "zf_common_headfile.h"
#pragma section all "cpu0_dsram"
// #pragma section all restore֮ȫֱCPU0RAM

// ǿԴչ ֲ߲Ը
// ǿԴչ ֲ߲Ը
// ǿԴչ ֲ߲Ը

// ****************************  ****************************

int core0_main(void)
{
    clock_init();                   // ȡʱƵ<ر>
    debug_init();                   // ʼĬϵԴ
    // ˴дû ʼ

    system_delay_ms(500);
    CPU0_Init();
    LED(1);

    // ˴дû ʼ
    cpu_wait_event_ready();         // ȴкĳʼ
    while (TRUE)
    {
        // ˴дҪѭִеĴ

        if(image_send_flag)
        {
            image_send_flag=0;
            point_index_display=point_index;
            point_index=MT9V03X_H;
#if USE_UPPER_COMPUTER
#if UPPER_COMPUTER_IMAGE
            seekfree_assistant_camera_information_config(SEEKFREE_ASSISTANT_MT9V03X,
                    binary_image_display[0],
                    MT9V03X_W, MT9V03X_H);
            seekfree_assistant_camera_boundary_config(XY_BOUNDARY,
                    point_index_display,
                    boundary_l_display.col,
                    boundary_m_display.col,
                    boundary_r_display.col,
                    boundary_l_display.row,
                    boundary_m_display.row,
                    boundary_r_display.row);
            seekfree_assistant_camera_send();

#endif
//            seekfree_assistant_oscilloscope_data.data[0]=dir.p;
//            seekfree_assistant_oscilloscope_data.data[1]=motor_r.out;
//            seekfree_assistant_oscilloscope_data.data[2]=target_speed_L;
//            seekfree_assistant_oscilloscope_data.data[3]=target_speed_R;
//            seekfree_assistant_oscilloscope_data.data[4]=speed_L;
//            seekfree_assistant_oscilloscope_data.data[5]=speed_R;
//            seekfree_assistant_oscilloscope_send(&seekfree_assistant_oscilloscope_data);
#endif


#if USE_LCD
//            LCD_display();
//            tft180_show_float(80,40,target_speed_set,3,1);
//            tft180_show_float(80,50,dir_error_k,1,3);
//            tft180_show_float(80,60,dir_error_b,1,3);
//            tft180_show_float(80,70,R2_left_display,1,2);
//            tft180_show_float(80,80,R2_right_display,1,2);
//            tft180_show_float(80,150,dir.error0,3,1);

//            tft180_show_int(0,0,menu,1);
//            tft180_show_int(0,10,menu_para,1);
//            tft180_show_int(0,20,menu_pid,1);
//            tft180_show_float(0,30,menu_offset,2,3);
//            if(!start_flag)
            {
                Menu_Display();
                tft180_show_uint(90,0,round_size,1);
//                tft180_show_uint(90,0,Max(longest_col_left.highest_row,longest_col_right.highest_row),3);
//                tft180_show_float(90,0,dir.error0,3,1);
//                tft180_show_float(90,10,dir.p,1,3);

            }


#endif
        }

#if USE_UPPER_COMPUTER
        Receive_msg();
#endif

        // ˴дҪѭִеĴ
    }
}

/*ȡʱ亯

    Time_Record_Start();
    Time_Record_End();

*/

#pragma section all restore
// ****************************  ****************************
