49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
/*
|
|
* @Author: DaMingSY zxm5337@163.com
|
|
* @Date: 2024-09-02 08:54:40
|
|
* @LastEditors: DaMingSY zxm5337@163.com
|
|
* @LastEditTime: 2024-09-09 11:11:11
|
|
* @FilePath: \signal_generator\App\BLE\ble.c
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
|
|
#include "ble.h"
|
|
|
|
void ble_send(UART_HandleTypeDef *huart, uint8_t *data)
|
|
{
|
|
usart_printf(huart, (char *)data);
|
|
}
|
|
|
|
void transparent_bluetooth(st_scom *scom)
|
|
{
|
|
if (scom != &scom6_ble) return;
|
|
|
|
if (scom->rx_flag == TRUE)
|
|
{
|
|
scom->rx_flag = FALSE;
|
|
|
|
memcpy(scom2_rs485.tx_buff, scom->rx_buff, sizeof(scom->rx_buff));
|
|
scom2_rs485.tx_len = scom->rx_len;
|
|
scom2_rs485.tx_flag = TRUE;
|
|
}
|
|
|
|
if (scom->tx_flag == TRUE)
|
|
{
|
|
scom->tx_flag = FALSE;
|
|
|
|
ble_send(&huart6, scom6_ble.tx_buff);
|
|
}
|
|
}
|
|
|
|
int8_t write_ble_id(char *id)
|
|
{
|
|
if(!id) return -1;
|
|
|
|
char str_id[50] = {0};
|
|
|
|
sprintf(str_id,"AT+NAME=%s\r\n",id);
|
|
usart_printf(&huart6, str_id);
|
|
return 1;
|
|
}
|
|
|