#include "SEGGER_RTT_Conf.h"
|
#include "SEGGER_RTT.h"
|
#include "SysCfg.h"
|
#include "gd32e23x.h"
|
#include "pwm.h"
|
#include "motor.h"
|
static uint32_t RttDataOutPutFlag = 0;
|
static void RTT_KeyValue(uint32_t key);
|
extern void RTT_TaskInit(void)
|
{
|
// /* ÅäÖÃͨµÀ0£¬ÉÏÐÐÅäÖã¨STM32->RTT ViewerÈí¼þ£© */
|
// SEGGER_RTT_ConfigUpBuffer(0, "RTTUP", NULL, 0, SEGGER_RTT_MODE_NO_BLOCK_SKIP);
|
|
// /* ÅäÖÃͨµÀ0£¬ÏÂÐÐÅäÖã¨RTT ViewerÈí¼þ->STM32£© */
|
// SEGGER_RTT_ConfigDownBuffer(0, "RTTDOWN", NULL, 0, SEGGER_RTT_MODE_NO_BLOCK_SKIP);
|
SEGGER_RTT_Init();
|
RttDataOutPutFlag = 0;
|
}
|
|
extern void RTT_Task10ms(void *p)
|
{
|
static uint32_t output_index = 0;
|
uint32_t GetKey = 0;
|
if (SEGGER_RTT_HasKey()) /* ÅжϽÓÊÕ»º³åÇøÖÐÊÇ·ñÓÐÊý¾Ý */
|
{
|
GetKey = SEGGER_RTT_GetKey(); /* ´Ó½ÓÊÜ»º³åÇøÖÐÈ¡³öÒ»¸ö×Ö·û */
|
RTT_KeyValue(GetKey);
|
// SEGGER_RTT_SetTerminal(1);
|
}
|
if (0 != RttDataOutPutFlag)
|
{
|
SEGGER_RTT_printf(0, "%d\n", output_index++);
|
}
|
}
|
|
static void RTT_KeyValue(uint32_t key)
|
{
|
switch (key)
|
{
|
case 0:
|
/* code */
|
break;
|
case 'd':
|
case 'D':
|
RttDataOutPutFlag = !RttDataOutPutFlag;
|
SEGGER_RTT_printf(0, "Index:\tTemp\tBase\tCP\tleakCurr\tCurr\tAC_Vot\tState\tError\n");
|
break;
|
case 'v':
|
case 'V':
|
SEGGER_RTT_printf(0, "Software Version is :%s\n\r", &SOFTWARE_VERSION);
|
SEGGER_RTT_printf(0, "Hardware Version is :%s\n\r", &HARDWARE_VERSION);
|
break;
|
case 'p':
|
case 'P':
|
SEGGER_RTT_printf(0, "Software PartNum is :%s\n\r", &SOFTWARE_PN);
|
SEGGER_RTT_printf(0, "Hardware PartNum is :%s\n\r", &HARDWAR_PN);
|
break;
|
case 't':
|
case 'T':
|
SEGGER_RTT_printf(0, "Software Compile time is :%s %s\n\r", &COMPILE_DATE, &COMPILE_TIME);
|
break;
|
case 'o':
|
timer_channel_output_mode_config(TIMER0, MOTOR_OUT_CH_W, TIMER_OC_MODE_PWM0);
|
timer_channel_output_state_config(TIMER0, MOTOR_OUT_CH_W, TIMER_CCX_ENABLE);
|
break;
|
case 's':
|
timer_channel_output_state_config(TIMER0, MOTOR_OUT_CH_W, TIMER_CCX_DISABLE);
|
break;
|
default:
|
break;`
|
}
|
}
|