MAC电脑外设键盘如何更改command为control键MAC电脑外设键盘如何更改command为control键...

#include "main.h"#include "stdio.h"#include "string.h"UART_HandleTypeDef huart1;GPIO_InitTypeDef GPIO_InitStruct;void LED_Control(uint8_t state) { HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, state);}void USART1_Init(void) { huart1.Instance = USART1; huart1.Init.BaudRate = 115200; huart1.Init.WordLength = UART_WORDLENGTH_8B; huart1.Init.StopBits = UART_STOPBITS_1; huart1.Init.Parity = UART_PARITY_NONE; huart1.Init.Mode = UART_MODE_TX_RX; huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart1.Init.OverSampling = UART_OVERSAMPLING_16; if (HAL_UART_Init(&huart1) != HAL_OK) { Error_Handler(); }}void MX_GPIO_Init(void) { GPIO_InitStruct.Pin = LED_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(LED_GPIO_Port, &GPIO_InitStruct);}void AT_SendCommand(char *cmd, char *response) { uint8_t buffer_rx[100]; uint8_t buffer_tx[100]; memset(buffer_rx, 0, sizeof(buffer_rx)); memset(buffer_tx, 0, sizeof(buffer_tx)); sprintf((char *)buffer_tx, "%s\r\n", cmd); HAL_UART_Transmit(&huart1, buffer_tx, strlen((char *)buffer_tx), 1000); HAL_UART_Receive(&huart1, buffer_rx, sizeof(buffer_rx), 5000); if (strstr((char *)buffer_rx, response) == NULL) { printf("AT Command Failed: %s", response); }}int main(void) { HAL_Init(); USART1_Init(); MX_GPIO_Init(); char buffer_rx[100]; memset(buffer_rx, 0, sizeof(buffer_rx)); AT_SendCommand("AT", "OK"); AT_SendCommand("AT+CWMODE=1", "OK"); AT_SendCommand("AT+CWJAP=\"ssid\",\"password\"", "OK"); while (1) { AT_SendCommand("AT+CIPSTART=\"TCP\",\"server_ip\",80", "OK"); AT_SendCommand("AT+CIPSEND=4", ">"); AT_SendCommand("test", "SEND OK"); HAL_Delay(1000); }}
06-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值