/*********************************************************************************************************************
* 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_bluetooth_ch9141
* ˾          ɶɿƼ޹˾
* 汾Ϣ          鿴 libraries/doc ļ version ļ 汾˵
*           IAR 8.32.4 or MDK 5.33
* ƽ̨          RT1064DVL6A
*           https://seekfree.taobao.com/
* 
* ޸ļ¼
*                                                                    ע
* 2022-09-15        W            first version
********************************************************************************************************************/
/*********************************************************************************************************************
* ߶壺
*                   ------------------------------------
*                   ģܽ            Ƭܽ
*                   RX                  鿴 zf_device_wireless_ble6a20.h  BLE6A20_RX_PIN  궨
*                   TX                  鿴 zf_device_wireless_ble6a20.h  BLE6A20_TX_PIN  궨
*                   RTS                 鿴 zf_device_wireless_ble6a20.h  BLE6A20_RTS_PIN 궨
*                   VCC                 3.3VԴ
*                   GND                 Դ
*                   
*                   ------------------------------------
*********************************************************************************************************************/


#ifndef _zf_device_ble6a20_h_
#define _zf_device_ble6a20_h_

#include "zf_common_typedef.h"

#define BLE6A20_INDEX        (UART_8)                                // ڶӦʹõĴں
#define BLE6A20_BUAD_RATE    (115200)                                // ڶӦʹõĴڲ
																	 // ģ鲨ʽ֧ 9600 57600 115200 230400 460800 921600 1500000 2000000
#define BLE6A20_TX_PIN       (UART8_RX_D17)                          // ڶӦģ TX ҪӵƬ RX
#define BLE6A20_RX_PIN       (UART8_TX_D16)                          // ڶӦģ RX ҪӵƬ TX
#define BLE6A20_RTS_PIN      (D26)                                   // ڶӦģ RTS 


// ------------------------------------ Զ ------------------------------------
// ע1ԶRTS Ὺʧܡ
// ע2ģԶʧܵĻ ԳԶϵ

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

// 0رԶ  
// 1Զ Զʵ޸ BLE6A20_BAUD ֮Ҫģ ģԶΪӦĲ
// ģ鲨ʽ֧ 9600 57600 115200 230400 460800 921600 1500000 2000000

#define BLE6A20_AUTO_BAUD_RATE    ( 0 )

#if (1 == BLE6A20_AUTO_BAUD_RATE)
typedef enum
{
    BLE6A20_AUTO_BAUD_RATE_SUCCESS,
    BLE6A20_AUTO_BAUD_RATE_INIT,
    BLE6A20_AUTO_BAUD_RATE_START,
    BLE6A20_AUTO_BAUD_RATE_GET_ACK,
}ble6a20_auto_baudrate_state_enum;
#endif
// ------------------------------------ Զ ------------------------------------

#define BLE6A20_BUFFER_SIZE       ( 64   )
#define BLE6A20_TIMEOUT_COUNT     ( 0x64 )

uint32      ble6a20_send_byte         (const uint8 data);
uint32      ble6a20_send_buffer      (const uint8 *buff, uint32 len);
uint32      ble6a20_send_string       (const char *str);
void        ble6a20_send_image        (const uint8 *image_addr, uint32 image_size);

uint32      ble6a20_read_buffer       (uint8 *buff, uint32 len);

void        ble6a20_callback          (void);

uint8       ble6a20_init              (void);

#endif
