/*********************************************************************************************************************
* RT1064DVL6A Opensourec Library RT1064DVL6A Դ⣩һڹٷ SDK ӿڵĵԴ
* Copyright (c) 2022 SEEKFREE ɿƼ
* 
* ļ RT1064DVL6A Դһ
* 
* RT1064DVL6A Դ 
* Ըᷢ 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 ļ
* ӭλʹò ޸ʱ뱣ɿƼİȨ
* 
* ļ          zf_device_type
* ˾          ɶɿƼ޹˾
* 汾Ϣ          鿴 libraries/doc ļ version ļ 汾˵
*           IAR 8.32.4 or MDK 5.33
* ƽ̨          RT1064DVL6A
*           https://seekfree.taobao.com/
* 
* ޸ļ¼
*                               ע
* 2022-09-21        SeekFree            first version
********************************************************************************************************************/

#include "zf_device_bluetooth_ch9141.h"

#include "zf_device_type.h"


camera_type_enum    camera_type                     = NO_CAMERE;                    // ͷͱ
callback_function   camera_uart_handler             = type_default_callback;        // ͨѶжϺָ룬ݳʼʱõĺת

camera_type_enum    flexio_camera_type              = NO_CAMERE;                    // FLEXIOӿͷͱ
callback_function   flexio_camera_vsync_handler     = type_default_callback;        // жϺָ룬ݳʼʱõĺת
callback_function   flexio_camera_uart_handler      = type_default_callback;        // ͨѶжϺָ룬ݳʼʱõĺת

wireless_type_enum  wireless_type                   = NO_WIRELESS;
callback_function   wireless_module_uart_handler    = type_default_callback;        // ߴڽжϺָ룬ݳʼʱõĺת
callback_function   wireless_module_spi_handler     = type_default_callback;        // WIFI SPI GPIOжϺָ룬ݳʼʱõĺת

tof_type_enum       tof_type                        = NO_TOF;
callback_function   tof_module_exti_handler         = type_default_callback;        // ToF ģ INT ж
//-------------------------------------------------------------------------------------------------------------------
//      ջص
// ˵     void        
// ز     void
// ʹʾ     set_camera_type(CAMERA_GRAYSCALE);
// עϢ     һɸͷʼڲ
//-------------------------------------------------------------------------------------------------------------------
void type_default_callback(void)
{
}

//-------------------------------------------------------------------------------------------------------------------
//      ͷ
// ˵     type_set        ѡͷ
// ˵     vsync_callback  豸ĳжϻص
// ˵     dma_callback    豸 DMA жϻص
// ˵     uart_callback   豸Ĵڻص
// ز     void
// ʹʾ     set_camera_type(CAMERA_GRAYSCALE);
// עϢ     һɸͷʼڲ
//-------------------------------------------------------------------------------------------------------------------
void  set_camera_type (camera_type_enum type_set, callback_function vsync_callback, callback_function dma_callback, callback_function uart_callback)
{
    camera_type = type_set;
    camera_uart_handler = ((uart_callback == NULL) ? (type_default_callback) : (uart_callback));
}

//-------------------------------------------------------------------------------------------------------------------
//      ͷ
// ˵     type_set        ѡͷ
// ز     void
// ʹʾ     set_camera_type(CAMERA_GRAYSCALE);
// עϢ     һɸͷʼڲ
//-------------------------------------------------------------------------------------------------------------------
void set_flexio_camera_type (camera_type_enum type_set, callback_function vsync_callback, callback_function dma_callback, callback_function uart_callback)
{
    flexio_camera_type = type_set;
    flexio_camera_uart_handler = ((uart_callback == NULL) ? (type_default_callback) : (uart_callback));
    flexio_camera_vsync_handler = ((vsync_callback == NULL) ? (type_default_callback) : (vsync_callback));
}

//-------------------------------------------------------------------------------------------------------------------
//      ģ
// ˵     type_set        	ѡģ
// ˵     wireless_callback   豸Ĵڻص
// ز     void
// ʹʾ     set_wireless_type(WIRELESS_UART);
// עϢ     һɸģʼڲ
//-------------------------------------------------------------------------------------------------------------------
void set_wireless_type (wireless_type_enum type_set, callback_function wireless_callback)
{
    wireless_type = type_set;
    if(WIFI_SPI == wireless_type)
    {
        wireless_module_spi_handler = ((wireless_callback == NULL) ? (type_default_callback) : (wireless_callback));
    }
    else
    {
        wireless_module_uart_handler = ((wireless_callback == NULL) ? (type_default_callback) : (wireless_callback));
    }
}

//-------------------------------------------------------------------------------------------------------------------
//       ToF ģ
// ˵     type_set        ѡ ToF ģ
// ˵     exti_callback   豸ⲿжϻص
// ز     void
// ʹʾ     set_tof_type(TOF_DL1A, dl1a_int_handler);
// עϢ     һɸͷʼڲ
//-------------------------------------------------------------------------------------------------------------------
void set_tof_type (tof_type_enum type_set, callback_function exti_callback)
{
    tof_type = type_set;
    tof_module_exti_handler = ((exti_callback == NULL) ? (type_default_callback) : (exti_callback));
}


