/** ****************************************************************************** * File Name : main.c * Description : Main program body ****************************************************************************** ** This notice applies to any and all portions of this file * that are not between comment pairs USER CODE BEGIN and * USER CODE END. Other portions of this file, whether * inserted by the user or by software development tools * are owned by their respective copyright owners. * * COPYRIGHT(c) 2019 STMicroelectronics * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "stm32f1xx_hal.h" #include "delay.h" #include "sys.h" #include "usart.h" #include "led.h" #include "usmart.h" #include "24cxx.h" //#include "rtc.h" //#include "sim7600.h" #include "iwdg.h" #include "gpio.h" const u8 TEXT_Buffer[]={"4G_SIM7600C STM32F103 IIC TEST"}; #define SIZE sizeof(TEXT_Buffer) int main(void) { u8 datatemp[SIZE]; // u8 time; HAL_Init(); Stm32_Clock_Init(RCC_PLL_MUL9); //设置时钟,72M delay_init(72); //初始化延时函数 uart2_init(115200); uart3_init(115200); //初始化串口 usmart_dev.init(36); //初始化USMART LED_Init(); //初始化LED AT24CXX_Init(); //初始化IIC // time=RTC_Init(); //初始化RTC // sim7600_Init(); //4G模块初始化 while(AT24CXX_Check())//检测不到24c02 { // SIM7600_led=0; delay_ms(50); SIM7600_led=1; delay_ms(50); } // AT24CXX_Write(0,(u8*)TEXT_Buffer,SIZE); // delay_us(50); AT24CXX_Read(0,datatemp,SIZE); Usart_Send_Str_Data("\r ***初始化完成*** \r"); //初始化完成 Usart_Send_Str_Data("\r\n\r\n"); //初始化完成 Usart_Send_Str_Data("\r ***EEPROM初始化完成*** \r"); //初始化完成 while (1) { SIM7600_led=0; Usart_TX_Set(1); //设置为发送模式 delay_us(50); printf("\r\n\r\n"); printf("\r ***串口3发送测试*** \r"); Usart_TX_Set(0); //设置为接收模式 // tx_led=0; delay_ms(300); SIM7600_led=1; delay_ms(300); } } /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/