/*********************************************************************************************************************
* 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_wireless_uart
* ˾          ɶɿƼ޹˾
* 汾Ϣ          鿴 libraries/doc ļ version ļ 汾˵
*           ADS v1.9.4
* ƽ̨          TC264D
*           https://seekfree.taobao.com/
*
* ޸ļ¼
*                               ע
* 2022-09-15       pudding            first version
* 2023-04-28       pudding            ע˵
********************************************************************************************************************/
/*********************************************************************************************************************
* ߶壺
*                  ------------------------------------
*                  ģܽ             Ƭܽ
*                  RX                 鿴 zf_device_wireless_uart.h  WIRELESS_UART_RX_PINx 궨
*                  TX                 鿴 zf_device_wireless_uart.h  WIRELESS_UART_TX_PINx 궨
*                  RTS                鿴 zf_device_wireless_uart.h  WIRELESS_UART_RTS_PINx 궨
*                  VCC                3.3VԴ
*                  GND                Դ
*                  
*                  ------------------------------------
********************************************************************************************************************/

#ifndef _zf_device_wireless_uart_h_
#define _zf_device_wireless_uart_h_

#include "zf_common_typedef.h"
//================================================ ߴ ===================================================
#define WIRELESS_UART_INDEX         (UART_2)                                    // ߴڶӦʹõĴں
#define WIRELESS_UART_BUAD_RATE     (115200)                                    // ߴڶӦʹõĴڲ
#define WIRELESS_UART_TX_PIN        (UART2_RX_P10_6)                            // ߴڶӦģ TX ҪӵƬ RX
#define WIRELESS_UART_RX_PIN        (UART2_TX_P10_5)                            // ߴڶӦģ RX ҪӵƬ TX
#define WIRELESS_UART_RTS_PIN       (P10_2)                                     // ߴڶӦģ RTS 
//====================================================Զ====================================================
// ע1תģ汾V2.0µ޷Զʵġ
// ע2ԶRTS Ὺʧܡ
// ע3ģԶʧܵĻ ԳԶϵ

// ԶĶ ע
// ԶĶ ע
// ԶĶ ע

// 0رԶ  
// 1Զ Զʵ޸ WIRELESS_UART_BAUD ֮Ҫģ ģԶΪӦĲ

#define WIRELESS_UART_AUTO_BAUD_RATE    ( 1 )
//====================================================Զ====================================================
#if (1 == WIRELESS_UART_AUTO_BAUD_RATE)
typedef enum
{
    WIRELESS_UART_AUTO_BAUD_RATE_SUCCESS,
    WIRELESS_UART_AUTO_BAUD_RATE_INIT,
    WIRELESS_UART_AUTO_BAUD_RATE_START,
    WIRELESS_UART_AUTO_BAUD_RATE_GET_ACK,
}wireless_uart_auto_baudrate_state_enum;
#endif

#define WIRELESS_UART_BUFFER_SIZE       ( 64   )
#define WIRELESS_UART_TIMEOUT_COUNT     ( 0x64 )
//================================================ ߴ ===================================================


//================================================ ߴ ===================================================
uint32      wireless_uart_send_byte         (const uint8 data);
uint32      wireless_uart_send_buffer      (const uint8 *buff, uint32 len);
uint32      wireless_uart_send_string       (const char *str);
void        wireless_uart_send_image        (const uint8 *image_addr, uint32 image_size);

uint32      wireless_uart_read_buffer       (uint8 *buff, uint32 len);

void        wireless_uart_callback          (void);

uint8       wireless_uart_init              (void);
//================================================ ߴ ===================================================

#endif


