710ffb8e62
func.c 中 setCommWindow 添加取值核验 isManualWindow 逻辑更新 parseRS232 更新ASCII判断逻辑(数据有\r\n但是前期采集未体现) 更新岸基地址为ADDR_ANJI = 0x3E 增加tcpRecMQ堆栈
104 lines
2.4 KiB
C
104 lines
2.4 KiB
C
/*
|
||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||
*
|
||
* SPDX-License-Identifier: Apache-2.0
|
||
*
|
||
* Change Logs:
|
||
* Date Author Notes
|
||
* 2023-04-27 RT-Thread first version
|
||
*/
|
||
|
||
#include <rtthread.h>
|
||
|
||
#define LOG_TAG "main"
|
||
#define LOG_LVL LOG_LVL_DBG
|
||
#include <ulog.h>
|
||
#include <board.h>
|
||
#include <ttmsg/ttmsg.h>
|
||
//#include <cfg.h>
|
||
|
||
|
||
///* 中断回调函数 */
|
||
//void pwTT_irq_callback(void *args)
|
||
//{
|
||
// LOG_D("key irq callback");
|
||
//}
|
||
|
||
//extern void sysInit(void);
|
||
|
||
int main(void)
|
||
{
|
||
|
||
//
|
||
// clock_information();
|
||
|
||
// #define LED_HEART GET_PIN(E,3)
|
||
/* 设置PIN脚模式为输出 */
|
||
rt_pin_mode(LED_HEART, PIN_MODE_OUTPUT);
|
||
rt_pin_mode(LED_HEART_DEBUG, PIN_MODE_OUTPUT);
|
||
rt_pin_mode(ETH_RESET_PIN, PIN_MODE_OUTPUT);
|
||
rt_pin_write(ETH_RESET_PIN, PIN_LOW);
|
||
|
||
rt_pin_mode(TT_EN, PIN_MODE_OUTPUT);
|
||
rt_pin_write(TT_EN, PIN_LOW);
|
||
|
||
|
||
rt_pin_mode(TR485_RE, PIN_MODE_OUTPUT);
|
||
rt_pin_write(TR485_RE, PIN_LOW);
|
||
|
||
|
||
sysInit();
|
||
// sysEventInit();
|
||
// if (isInWindowZone()) {//开机检查是否在开窗区间内,是则给TT开机
|
||
// initTT();
|
||
// setWindowMode();
|
||
//// pwTT_thread_entry("1");
|
||
// }
|
||
|
||
|
||
|
||
while (0)
|
||
{
|
||
/* 拉低PIN脚 */
|
||
rt_pin_write(LED_HEART, PIN_LOW);
|
||
rt_pin_write(LED_HEART_DEBUG, PIN_HIGH);
|
||
/* 延时1ms,省电 */
|
||
rt_thread_mdelay(10); //去掉延时,共用print替换
|
||
// rt_kprintf("Heartbeat.\n");
|
||
|
||
/* 拉高PIN脚 */
|
||
rt_pin_write(LED_HEART, PIN_HIGH);
|
||
rt_pin_write(LED_HEART_DEBUG, PIN_LOW);
|
||
rt_thread_mdelay(1000);
|
||
|
||
}
|
||
|
||
return RT_EOK;
|
||
}
|
||
//fastlz_test -c demo.bin f.bin
|
||
|
||
|
||
extern int rt_hw_stm32_eth_init(void);
|
||
MSH_CMD_EXPORT(rt_hw_stm32_eth_init, 初始化网络。);
|
||
|
||
void show_version(void)
|
||
{
|
||
char str[30];
|
||
uint8_t t[10];
|
||
size_t len=time2Byte(t);
|
||
rt_kprintf("SW Version: %s, build-%s\n","1.9d",bytes2str(t, 3, 10, "", str));
|
||
}
|
||
|
||
MSH_CMD_EXPORT(show_version,显示版本号);
|
||
INIT_COMPONENT_EXPORT(show_version);
|
||
static void clock_information(void)
|
||
{
|
||
LOG_D("System Clock information");
|
||
LOG_D("SYSCLK_Frequency = %d", HAL_RCC_GetSysClockFreq());
|
||
LOG_D("HCLK_Frequency = %d", HAL_RCC_GetHCLKFreq());
|
||
LOG_D("PCLK1_Frequency = %d", HAL_RCC_GetPCLK1Freq());
|
||
LOG_D("PCLK2_Frequency = %d", HAL_RCC_GetPCLK2Freq());
|
||
|
||
}
|
||
MSH_CMD_EXPORT(clock_information,始终信息);
|