/*********************************************************************************************************************
* TC264 Opensourec Library TC264 Դ⣩һڹٷ SDK ӿڵĵԴ
* Copyright (c) 2022 SEEKFREE ɿƼ
*
* ļ TC264 Դһ
*
* TC264 Դ 
* Ըᷢ 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_tsl1401
* ˾          ɶɿƼ޹˾
* 汾Ϣ          鿴 libraries/doc ļ version ļ 汾˵
*           ADS v1.9.4
* ƽ̨          TC264D
*           https://seekfree.taobao.com/
*
* ޸ļ¼
*                               ע
* 2022-09-15       pudding            first version
* 2023-04-28       pudding            ע˵
********************************************************************************************************************/
/*********************************************************************************************************************
* ߶壺
*                  ------------------------------------
*                  ģܽ             Ƭܽ
*                  CLK                鿴 zf_device_tsl1401.h  TSL1401_CLK_PIN 궨
*                  SI                 鿴 zf_device_tsl1401.h  TSL1401_SI_PIN 궨
*                  AO[x]              鿴 zf_device_tsl1401.h  TSL1401_AO_PIN_BUFFER 궨
*                  VCC                3.3VԴ
*                  GND                Դ
*                  ------------------------------------
********************************************************************************************************************/

#ifndef _zf_device_tsl1401_h_
#define _zf_device_tsl1401_h_

#include "zf_device_type.h"

//================================================= TSL1401 ================================================
#define TSL1401_AO_PIN          (ADC0_CH4_A4)                                   // Ӧһ TSL1401  AO 
#define TSL1401_AO_PIN1         (ADC0_CH5_A5)                                   // Ӧڶ TSL1401  AO 
// TSL1401 ĿŶ  TSL1401 齫ֱӲ
#define TSL1401_CLK_PIN         (P00_0)                                         // TSL1401  CLK Ŷ
#define TSL1401_SI_PIN          (P00_1)                                         // TSL1401  SI Ŷ
#define TSL1401_CLK(x)          ((x) ? (gpio_high(TSL1401_CLK_PIN)) : (gpio_low(TSL1401_CLK_PIN)))
#define TSL1401_SI(x)           ((x) ? (gpio_high(TSL1401_SI_PIN))  : (gpio_low(TSL1401_SI_PIN)))

// TSL1401 ڲɼֶ ʹõĸ PIT Ҫ  ĸ PIT жϷ
#define TSL1401_EXPOSURE_TIME   (10 )                                           //  TSL1401 عʱ λ MS
#define TSL1401_PIT_INDEX       (CCU61_CH1)                                     // ʹж
#define TSL1401_AD_RESOLUTION   (ADC_8BIT)                                      // ADC  8bit
#define TSL1401_DATA_LEN        (128 )                                          // TSL1401 ݳ
//================================================= TSL1401 ================================================


//================================================= TSL1401 ȫֱ=================================================
extern uint16 tsl1401_data[2][TSL1401_DATA_LEN];                                // TSL1401 ݴ
extern vuint8 tsl1401_finish_flag;                                              // TSL1401 ݲɼɱ־
//================================================= TSL1401 ȫֱ=================================================


//================================================= TSL1401 =================================================
void tsl1401_collect_pit_handler    (void);                                     // TSL1401  CCD ݲɼ
void tsl1401_send_data              (uart_index_enum uart_n, uint8 index);      // TSL1401  CCD ͼλ鿴ͼ
void tsl1401_init                   (void);                                     // TSL1401  CCD ʼ
//================================================= TSL1401 =================================================


#endif
