From bf685e699dac374e7536cb81ed7ca972d01e5861 Mon Sep 17 00:00:00 2001
From: guanjiao <sqrgj@163.com>
Date: 星期六, 15 九月 2018 18:16:51 +0800
Subject: [PATCH] AT指令发送写ID指令

---
 源码/核心板/Src/OnChipDevices/Usart.c |   68 +++++-----------------------------
 1 files changed, 10 insertions(+), 58 deletions(-)

diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/OnChipDevices/Usart.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/OnChipDevices/Usart.c"
index 1d8320b..7ed8dde 100644
--- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/OnChipDevices/Usart.c"
+++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/OnChipDevices/Usart.c"
@@ -1,62 +1,6 @@
 #include "Usart.h"
-
-//void Usart_Init(void)
-//{
-//	USART_InitTypeDef USART_InitStructure;
-//    GPIO_InitTypeDef GPIO_InitStructure;
-//	
-//	/* Enable GPIO clock */
-//    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO, ENABLE);
-//	/* Enable USART clock */
-//    RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
-//	
-//	/* Configure USART Tx as alternate function push-pull */
-//    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
-//    GPIO_InitStructure.GPIO_Pin = USART_TX_pin;
-//    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
-//    GPIO_Init(USART_GPIO, &GPIO_InitStructure);
-
-//    /* Configure USART Rx as input floating */
-//    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
-//    GPIO_InitStructure.GPIO_Pin = USART_RX_pin;
-//    GPIO_Init(USART_GPIO, &GPIO_InitStructure);
-
-//    /* USARTx configured as follow:
-//    	  - BaudRate = 115200 baud
-//    	  - Word Length = 8 Bits
-//    	  - One Stop Bit
-//    	  - No parity
-//    	  - Hardware flow control disabled (RTS and CTS signals)
-//    	  - Receive and transmit enabled
-//    */
-//    USART_InitStructure.USART_BaudRate = BAUD_RATE ;
-//    USART_InitStructure.USART_WordLength = USART_WordLength_8b;
-//    USART_InitStructure.USART_StopBits = USART_StopBits_1;
-//    USART_InitStructure.USART_Parity = USART_Parity_No;
-//    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
-//    USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
-
-//    /* USART configuration */
-//    USART_Init(EXT_USART, &USART_InitStructure);
-
-//    /* Enable USART */
-//    USART_Cmd(EXT_USART, ENABLE);
-
-//}
-
-//uint16_t Checksum_u16(uint8_t *pdata, uint32_t len)
-//{
-//    uint16_t sum = 0;
-//    uint32_t i;
-//    for(i = 0; i < len; i++)
-//        sum += pdata[i];
-//    sum = ~sum;
-//    return sum;
-//}
-
-
-
-///////////////////////////////////
+#include <string.h>
+#include <stdio.h>
 
 //数据发送队列变量
 EUART_Frame m_EUART_TxFrames[EUART_TX_FRM_SIZE];	//数据发送帧队列	
@@ -345,3 +289,11 @@
 	m_EUART_TxFrm_FreeFrmLen++;
 }
 
+int fputc(int ch, FILE *f)
+{
+	
+	USART_SendData(USART1, (unsigned char) ch);// USART1 ???? USART2 ?
+	while (!(USART1->SR & USART_FLAG_TXE));
+	return (ch);
+}
+

--
Gitblit v1.9.3