48 lines
902 B
C
Raw Normal View History

#ifndef __MW_BLUETOOTH_H__
#define __MW_BLUETOOTH_H__
#include "stm32f10x.h"
typedef enum
{
hc06 = 0,
2024-12-03 22:49:37 +08:00
bluetooth_num
}bluetooth_type_enum;
2024-12-17 22:12:53 +08:00
/* usart api define*/
typedef struct
{
2024-12-17 22:12:53 +08:00
// void * usart_type;
int8_t (*pf_init)(void);
int8_t (*pf_deinit)(void);
2024-12-06 16:46:34 +08:00
// tx rx function
2024-12-17 22:12:53 +08:00
int8_t (*pf_trans_one_byte)(uint8_t tx_data);
uint8_t (*pf_recv_one_byte)(void);
2024-12-06 16:46:34 +08:00
}system_usart_t;
2024-12-17 22:12:53 +08:00
/* timer api define */
2024-12-06 16:46:34 +08:00
typedef struct
{
uint32_t (*pf_get_systick_ms)(void);
}system_timetick_t;
2024-12-06 16:46:34 +08:00
typedef struct
{
2024-12-17 22:12:53 +08:00
// the type of bluetooth
2024-12-06 16:46:34 +08:00
bluetooth_type_enum bluetooth_drv;
2024-12-17 22:12:53 +08:00
// usart api
2024-12-06 16:46:34 +08:00
system_usart_t bluetooth_usart;
2024-12-17 22:12:53 +08:00
// timer api
system_timetick_t timer_obj;
2024-12-06 16:46:34 +08:00
void (*pf_init)(void);
void (*pf_deinit)(void);
void (*pf_send_bytes)(uint8_t * tx_buf, uint16_t len);
void (*pf_recv_deal)(void);
2024-12-03 22:49:37 +08:00
}mw_bluetooth_t;
2024-12-17 22:12:53 +08:00
void mw_bluetooth_drv_init(void);
#endif