TT12-MCU/applications/main.c
CSSC-WORK\murmur afaf81a3fc 更新继电器逻辑,继电器不去反
更新TT帧头数据
rulecheck屏蔽部分log避免刷屏
添加led显示
2023-08-15 17:10:18 +08:00

110 lines
2.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 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");
//}
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_mode(TT_EN, PIN_MODE_OUTPUT);
rt_pin_write(TT_EN, PIN_LOW);
// rt_pin_attach_irq(TT_EN, PIN_IRQ_MODE_FALLING, pwTT_irq_callback, RT_NULL); // 下降沿触发
// rt_pin_irq_enable(TT_EN, PIN_IRQ_ENABLE); // 使能中断
rt_pin_mode(TR485_RE, PIN_MODE_OUTPUT);
rt_pin_write(TR485_RE, PIN_LOW);
//sysSemInit
sysInit();
// sysEventInit();
if (isInWindowZone()) {//开机检查是否在开窗区间内是则给TT开机
initTT();
// pwTT_thread_entry("1");
}
while (1)
{
/* 拉低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
//
//RT_WEAK void initTT()
//{
//
//}
//
//RT_WEAK void deInitTT()
//{
//
//}
INIT_APP_EXPORT(main);
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);
bytes2str(t, len, 10, "", str);
rt_kprintf("SW Version: %s, build-%s\n","1.46",bytes2str(t, len, 10, "", str));
}
MSH_CMD_EXPORT(show_version,);
INIT_COMPONENT_EXPORT(show_version);