2023-04-27 08:54:45 +00:00
|
|
|
|
/*
|
|
|
|
|
* 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>
|
|
|
|
|
|
2023-04-27 09:29:44 +00:00
|
|
|
|
#define LOG_TAG "main"
|
|
|
|
|
#define LOG_LVL LOG_LVL_DBG
|
|
|
|
|
#include <ulog.h>
|
|
|
|
|
#include <board.h>
|
2023-05-25 06:58:31 +00:00
|
|
|
|
#include <ttmsg/ttmsg.h>
|
2023-06-06 07:45:13 +00:00
|
|
|
|
//#include <cfg.h>
|
|
|
|
|
|
|
|
|
|
|
2023-07-27 07:46:45 +00:00
|
|
|
|
///* 中断回调函数 */
|
|
|
|
|
//void pwTT_irq_callback(void *args)
|
|
|
|
|
//{
|
|
|
|
|
// LOG_D("key irq callback");
|
|
|
|
|
//}
|
2023-05-30 08:53:31 +00:00
|
|
|
|
|
2023-08-29 11:29:58 +00:00
|
|
|
|
//extern void sysInit(void);
|
2023-06-02 06:37:58 +00:00
|
|
|
|
|
2023-04-27 08:54:45 +00:00
|
|
|
|
int main(void)
|
|
|
|
|
{
|
2023-06-01 02:23:08 +00:00
|
|
|
|
|
|
|
|
|
//
|
2023-05-30 08:53:31 +00:00
|
|
|
|
// clock_information();
|
2023-04-27 09:29:44 +00:00
|
|
|
|
|
2023-04-28 00:15:49 +00:00
|
|
|
|
// #define LED_HEART GET_PIN(E,3)
|
2023-04-27 09:29:44 +00:00
|
|
|
|
/* 设置PIN脚模式为输出 */
|
|
|
|
|
rt_pin_mode(LED_HEART, PIN_MODE_OUTPUT);
|
2023-06-06 07:45:13 +00:00
|
|
|
|
rt_pin_mode(LED_HEART_DEBUG, PIN_MODE_OUTPUT);
|
2023-04-28 00:15:49 +00:00
|
|
|
|
rt_pin_mode(ETH_RESET_PIN, PIN_MODE_OUTPUT);
|
2023-08-21 09:18:07 +00:00
|
|
|
|
rt_pin_write(ETH_RESET_PIN, PIN_LOW);
|
2023-04-28 00:15:49 +00:00
|
|
|
|
|
2023-05-29 12:49:30 +00:00
|
|
|
|
rt_pin_mode(TT_EN, PIN_MODE_OUTPUT);
|
2023-08-15 09:10:18 +00:00
|
|
|
|
rt_pin_write(TT_EN, PIN_LOW);
|
2023-08-19 06:41:13 +00:00
|
|
|
|
|
2023-05-29 12:49:30 +00:00
|
|
|
|
|
2023-06-25 10:49:11 +00:00
|
|
|
|
rt_pin_mode(TR485_RE, PIN_MODE_OUTPUT);
|
|
|
|
|
rt_pin_write(TR485_RE, PIN_LOW);
|
2023-07-27 07:46:45 +00:00
|
|
|
|
|
2023-08-29 11:29:58 +00:00
|
|
|
|
|
2023-08-04 06:09:39 +00:00
|
|
|
|
sysInit();
|
|
|
|
|
// sysEventInit();
|
2023-08-29 11:29:58 +00:00
|
|
|
|
// if (isInWindowZone()) {//开机检查是否在开窗区间内,是则给TT开机
|
|
|
|
|
// initTT();
|
|
|
|
|
// setWindowMode();
|
|
|
|
|
//// pwTT_thread_entry("1");
|
|
|
|
|
// }
|
2023-06-17 10:26:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-23 03:02:26 +00:00
|
|
|
|
while (0)
|
2023-04-27 09:29:44 +00:00
|
|
|
|
{
|
|
|
|
|
/* 拉低PIN脚 */
|
|
|
|
|
rt_pin_write(LED_HEART, PIN_LOW);
|
2023-06-06 07:45:13 +00:00
|
|
|
|
rt_pin_write(LED_HEART_DEBUG, PIN_HIGH);
|
2023-04-27 09:29:44 +00:00
|
|
|
|
/* 延时1ms,省电 */
|
2023-05-30 08:53:31 +00:00
|
|
|
|
rt_thread_mdelay(10); //去掉延时,共用print替换
|
2023-04-27 09:29:44 +00:00
|
|
|
|
// rt_kprintf("Heartbeat.\n");
|
|
|
|
|
|
|
|
|
|
/* 拉高PIN脚 */
|
|
|
|
|
rt_pin_write(LED_HEART, PIN_HIGH);
|
2023-06-06 07:45:13 +00:00
|
|
|
|
rt_pin_write(LED_HEART_DEBUG, PIN_LOW);
|
2023-04-27 09:29:44 +00:00
|
|
|
|
rt_thread_mdelay(1000);
|
2023-05-30 08:53:31 +00:00
|
|
|
|
|
2023-04-27 09:29:44 +00:00
|
|
|
|
}
|
2023-04-27 08:54:45 +00:00
|
|
|
|
|
|
|
|
|
return RT_EOK;
|
|
|
|
|
}
|
2023-04-27 09:10:08 +00:00
|
|
|
|
//fastlz_test -c demo.bin f.bin
|
2023-06-19 07:56:45 +00:00
|
|
|
|
|
2023-06-25 10:49:11 +00:00
|
|
|
|
|
2023-06-01 02:23:08 +00:00
|
|
|
|
extern int rt_hw_stm32_eth_init(void);
|
2023-06-02 02:23:26 +00:00
|
|
|
|
MSH_CMD_EXPORT(rt_hw_stm32_eth_init, 初始化网络。);
|
2023-06-18 01:34:09 +00:00
|
|
|
|
|
|
|
|
|
void show_version(void)
|
|
|
|
|
{
|
2023-07-20 07:29:37 +00:00
|
|
|
|
char str[30];
|
|
|
|
|
uint8_t t[10];
|
|
|
|
|
size_t len=time2Byte(t);
|
2023-09-14 11:55:33 +00:00
|
|
|
|
rt_kprintf("SW Version: %s, build-%s\n","2.45d",bytes2str(t, 3, 10, "", str));
|
2023-06-18 01:34:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MSH_CMD_EXPORT(show_version,显示版本号);
|
|
|
|
|
INIT_COMPONENT_EXPORT(show_version);
|
2023-09-02 07:23:32 +00:00
|
|
|
|
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,始终信息);
|