You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
5.0 KiB
170 lines
5.0 KiB
1 year ago
|
//////////////////////////////////////////////////////////////////////////
|
||
|
/// COPYRIGHT NOTICE
|
||
|
/// Copyright (c) 2023 CCSENS
|
||
|
/// All rights reserved.
|
||
|
///
|
||
|
/// @file main.c
|
||
|
/// @brief main app
|
||
|
///
|
||
|
|
||
|
/// 下面是一个含有两个参数的函数的注释说明(简述)
|
||
|
///
|
||
|
/// 这里写该函数的详述信息
|
||
|
/// @param a 被测试的变量(param描述参数)
|
||
|
/// @param s 指向描述测试信息的字符串
|
||
|
/// @return 测试结果(return描述返回值)
|
||
|
/// @see Test() (本函数参考其它的相关的函数,这里作一个链接)
|
||
|
/// @note (note描述需要注意的问题)
|
||
|
|
||
|
//===============================================
|
||
|
//寄存器头文件
|
||
|
//===============================================
|
||
|
|
||
|
/// 20221023_175541 CCmodify
|
||
|
|
||
|
#include "main.h"
|
||
|
#include "asp_lowpower.h"
|
||
|
|
||
|
|
||
|
void L0_RTC_init(void)
|
||
|
{
|
||
|
P_SW2 = 0x80;
|
||
|
// XOSCCR =0;
|
||
|
///HIRCCR = 0;
|
||
|
IRC32KCR = 0x80; //启动内部32K IRC
|
||
|
while (!(IRC32KCR & 1)); //等待时钟稳定
|
||
|
CLKDIV = 0x00; //时钟不分频
|
||
|
/// CLKSEL = 0x03; //选择内部32K
|
||
|
|
||
|
RTCCFG = 3;
|
||
|
///RTCCFG |= 0x02; //选择内部 32K 作为 RTC 时钟源 RTCCFG | = 0x02; / / Select internal 32K as RTC, clock source
|
||
|
RTCCR = 1;
|
||
|
printf3("\r\n %X %X:%X",(int)(DAY), (int)(MIN), (int)(SEC));
|
||
|
|
||
|
D_stdIO_P2(BITN4);D_P24_REV();
|
||
|
Lc_delay_ms(500);
|
||
|
|
||
|
printf3("\r\n %X %X:%X",(int)(DAY), (int)(MIN), (int)(SEC));
|
||
|
Lc_delay_ms(200);D_stdIO_P2(BITN4);D_P24_REV();
|
||
|
Lc_delay_ms(500);
|
||
|
printf3("\r\n %X %X:%X",(int)(DAY), (int)(MIN), (int)(SEC));
|
||
|
Lc_delay_ms(200);D_stdIO_P2(BITN4);D_P24_REV();
|
||
|
Lc_delay_ms(500);
|
||
|
printf3("\r\n %X %X:%X",(int)(DAY), (int)(MIN), (int)(SEC));
|
||
|
Lc_delay_ms(200);
|
||
|
}
|
||
|
|
||
|
|
||
|
void L0_main_initled(void)
|
||
|
{
|
||
|
D_LED1_OFF();
|
||
|
|
||
|
D_LED2_ON();
|
||
|
|
||
|
TTSS_run_times(6)
|
||
|
{
|
||
|
D_LED1_REV();
|
||
|
D_LED2_REV();
|
||
|
Lc_delay_ms(300);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void L0_main_init(void)
|
||
|
{
|
||
|
int r = 0;
|
||
|
///>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>算法测试区域
|
||
|
|
||
|
///<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<算法测试区域
|
||
|
Lc_delay_ms(200);
|
||
|
L0_main_initled();
|
||
|
CLKDIV = 0;////不分频,使用focs
|
||
|
|
||
|
L0_uart1_open();
|
||
|
/// L0_uart2_open();
|
||
|
|
||
|
L3_debug_drv_init();
|
||
|
L1_task_tick_init();
|
||
|
L0_timer0_Init();ET0 = 1;
|
||
|
|
||
|
|
||
|
printf1("\r\nD_sys_MainFre %ld",D_sys_MainFre);
|
||
|
|
||
|
|
||
|
r = L3_S_init();
|
||
|
printf1("\r\nL3_S_init %d",r);
|
||
|
|
||
|
}
|
||
|
|
||
|
//===============================================
|
||
|
//主函数
|
||
|
//===============================================
|
||
|
void main(void)
|
||
|
{
|
||
|
u16 a= 0;
|
||
|
char d[9]={0xab};
|
||
|
//-----------------------------------------------
|
||
|
//系统初始化
|
||
|
//----------------------------------------------
|
||
|
|
||
|
L0_main_init();
|
||
|
L3_task_weight_init();
|
||
|
|
||
|
TTSS_run_every_init(s_nos_tick.stamp,10);
|
||
|
|
||
|
printfs("\r\3 main while13\r\n");
|
||
|
|
||
|
//-----------------------------------------------
|
||
|
//系统主循环
|
||
|
//-----------------------------------------------
|
||
|
|
||
|
while(1)
|
||
|
{///44M 裸奔2us一个循环
|
||
|
//1>>>>>1>>>>>1>>>>>1>>>>>1>>>>>1>>>>> TTSS 1心跳>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
|
||
|
if(1 == s_nos_tick.t1s_heartbeat)///
|
||
|
{
|
||
|
s_nos_tick.t1s_heartbeat = 0;
|
||
|
///L1_uartD_uc('.');
|
||
|
D_LED2_REV();
|
||
|
}
|
||
|
//1<<<<<1<<<<<1<<<<<1<<<<<1<<<<<1<<<<< TTSS 1心跳<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.
|
||
|
//--------------------------------------------------------------------------------------
|
||
|
//>>>>>2>>>>>>2>>>>>2>>>>>2>>>>>2>>>>> TTSS 2 定期任务>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
|
||
|
TTSS_run_every(s_nos_tick.stamp,40)////500 -7s 70-1s TTSS 2需要主循环定时工作的任务:stamp需要防止被其他程序使用
|
||
|
D_LED1_REV(); L4_weight_out(); //// D_LED1_REV();
|
||
|
///55 0D 0C 90 F5 77 FF 52 80 00 00 00 33
|
||
|
TTSS_run_every_end
|
||
|
|
||
|
//// L1_expara_sample();///
|
||
|
//<<<<<2<<<<<<<2<<<<<<2<<<<<<2<<<<<<<TTSS 2 定期任务 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.
|
||
|
//--------------------------------------------------------------------------------------
|
||
|
//>>>>>3>>>>>>>3>>>>>>3>>>>>>3>>>>>>>TTSS 3 debug>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
|
||
|
if(L2_debug_ONcomand())
|
||
|
{
|
||
|
L3_test_ONdebug(D_cmd_filter_debug);///fd xx xx///
|
||
|
|
||
|
L3_weight_ONdebug(D_cmd_filter_weight);///fd xx xx///
|
||
|
//L3_ADC_debug(D_cmd_filter_adc);///fa xx xx
|
||
|
//L3_moto_debug(D_cmd_filter_moto);///f0 xx xx/
|
||
|
/// L3_lora_debug(D_cmd_filter_lora);//
|
||
|
}
|
||
|
//<<<<<3<<<<<<<3<<<<<<<3<<<<<<3<<<<<<TTSS 3 debug><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.
|
||
|
//--------------------------------------------------------------------------------------
|
||
|
//>>>>>>4>>>>>>>4>>>>>>4>>>>>>4>>>>>>TTSS 4 并行任务>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
|
||
|
|
||
|
L3_task_weight_handler(&tst_weight);
|
||
|
|
||
|
/// L2_task_move_handle(&ts_task_move);
|
||
|
//<<<<<4<<<<<<<<4<<<<<<4<<<<<<<4<<<<<TTSS 4 并行任务 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.
|
||
|
//--------------------------------------------------------------------------------------
|
||
|
//>>>>>>5>>>>>>>5>>>>>>5>>>>>>5>>>>>>TTSS 5 日常任务 随机任务>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
|
||
|
|
||
|
|
||
|
//<<<<<5<<<<<<<5<<<<<<<5<<<<<<5<<<<<<TTSS 5 日常任务 随机任务<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|