/*********************************************************************************************************************
* 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_wireless_uart
* ˾          ɶɿƼ޹˾
* 汾Ϣ          鿴 libraries/doc ļ version ļ 汾˵
*           IAR 8.32.4 or MDK 5.33
* ƽ̨          RT1064DVL6A
*           https://seekfree.taobao.com/
* 
* ޸ļ¼
*                               ע
* 2022-09-21        SeekFree            first version
********************************************************************************************************************/
/*********************************************************************************************************************
* ߶壺
*                   ------------------------------------
*                   ģܽ            Ƭܽ
*                   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_8)                                    // ߴڶӦʹõĴں
#define WIRELESS_UART_BUAD_RATE     (115200)                                    // ߴڶӦʹõĴڲ
#define WIRELESS_UART_TX_PIN        (UART8_RX_D17)                              // ߴڶӦģ TX ҪӵƬ RX
#define WIRELESS_UART_RX_PIN        (UART8_TX_D16)                              // ߴڶӦģ RX ҪӵƬ TX
#define WIRELESS_UART_RTS_PIN       (D26)                                       // ߴڶӦģ RTS 

// ------------------------------------ Զ ------------------------------------
// ע1תģ汾V2.0µ޷Զʵġ
// ע2ԶRTS Ὺʧܡ
// ע3ģԶʧܵĻ ԳԶϵ

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

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

#define WIRELESS_UART_AUTO_BAUD_RATE    (0)

#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     (1)

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
