/*********************************************************************************************************************
* 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-21        SeekFree            first version
********************************************************************************************************************/
/*********************************************************************************************************************
* ߶壺
*                   ------------------------------------
*                   ģܽ            Ƭܽ
*                   RX                  鿴 zf_device_bluetooth_ch9141.h  CH9141_RX_PINx 궨
*                   TX                  鿴 zf_device_bluetooth_ch9141.h  CH9141_TX_PINx 궨
*                   RTS                 鿴 zf_device_bluetooth_ch9141.h  CH9141_RTS_PINx 궨
*                   VCC                 3.3VԴ
*                   GND                 Դ
*                   
*                   ------------------------------------
********************************************************************************************************************/
#ifndef _zf_device_bluetooth_ch9141_h_
#define _zf_device_bluetooth_ch9141_h_

#include "zf_common_typedef.h"

#define BLUETOOTH_CH9141_INDEX                  (UART_8)                        // ģӦʹõĴں
#define BLUETOOTH_CH9141_BUAD_RATE              (115200)                        // ģӦʹõĴڲ
#define BLUETOOTH_CH9141_TX_PIN                 (UART8_RX_D17)                  // ģӦģ TX ҪӵƬ RX
#define BLUETOOTH_CH9141_RX_PIN                 (UART8_TX_D16)                  // ģӦģ RX ҪӵƬ TX
#define BLUETOOTH_CH9141_RTS_PIN                (D26)                           // ģӦģ RTS 

#define BLUETOOTH_CH9141_BUFFER_SIZE            (64)                            // ĬϵģʹõĽջС
#define BLUETOOTH_CH9141_TIMEOUT_COUNT          (500)

uint32      bluetooth_ch9141_send_byte          (const uint8 data);
uint32      bluetooth_ch9141_send_buffer        (const uint8 *buff, uint32 len);
uint32      bluetooth_ch9141_send_string        (const char *str);
void        bluetooth_ch9141_send_image         (const uint8 *image_addr, uint32 image_size);

uint32      bluetooth_ch9141_read_buffer        (uint8 *buff, uint32 len);

void        bluetooth_ch9141_uart_callback      (void);

uint8       bluetooth_ch9141_init               (void);

#endif
