S32 Design Studio PE工具配置TMR
配置步骤
配置内容
生成的配置结构体如下,在Generated_Code路径下的lpTmr.c文件和lpTmr.h文件。
/*! lpTmr1 configuration structure */
const lptmr_config_t lpTmr1_config0 = {.workMode = LPTMR_WORKMODE_PULSECOUNTER,.dmaRequest = false,.interruptEnable = true,.freeRun = false,.compareValue = 1000U,.counterUnits = LPTMR_COUNTER_UNITS_TICKS,.clockSelect = LPTMR_CLOCKSOURCE_SIRCDIV2,.prescaler = LPTMR_PRESCALE_2,.bypassPrescaler = true,.pinSelect = LPTMR_PINSELECT_TRGMUX,.pinPolarity = LPTMR_PINPOLARITY_RISING,
};
只读也就是这个配置结构体前面加个const
工作模式有Timer计时器和Plus counter脉冲计数器两种
计时器的话就是用作普通计时器,脉冲计数器要选择对应的输入引脚和跟一个叫TRGMUX的模块配合使用。脉冲通过输入引脚给到TRGMUX模块,通过配置SEL寄存器选择输出到TMR模块计算脉冲数量。
DMA请求就是产生对比事件的时候请求DMA帮忙搬运下数据,不然的话就是让CPU来搬运。
中断使能是跟工作模式配合起来的。如果是计时器模式,那就是时间到达产生中断,进入中断函数。如果是脉冲计数器模式,就是脉冲到达一定数量的时候,进入中断函数。
这个中断只是允许定时器产生中断,要调用下INT_SYS_InstallHandler安装中断函数,INT_SYS_EnableIRQ使能。
/* Install IRQ handler for LPTMR interrupt */
INT_SYS_InstallHandler(LPTMR0_IRQn, &lptmrISR, (isr_t *)0);
/* Enable IRQ for LPTMR */
INT_SYS_EnableIRQ(LPTMR0_IRQn);
里面的LPTMR0_IRQn是设备名称,定死的。lptmrISR是中断时进入的函数,自己看着来写就行。
自由运行模式千万不要选,计数器会一直累加,溢出都不管。
对比值就是TMR累加到这个值就产生中断,无论工作模式是计数器模式还是脉冲计数器模式。这个是有最大数值限制的,自己看着来。
对比值单位是根据工作模式来的。如果是计时器模式,就选择微秒。如果是脉冲计数器模式,就选择次数。
输入时钟就是时钟源。
如果工作模式是计数器模式,分频数是自动适配的,不用选择引脚和极性。
如果工作模式是计数器模式,就可以选择分频数和滤波模式,并且选择映射到的引脚和极性。
极性就是在上升沿时刻计数还是下降沿时刻计数。
接口使用
会产生lptmr_driver.c文件和lptmr_driver.h文件,路径在SDK\platform\drivers\src\lptmr和SDK\platform\drivers\inc。
LPTMR_DRV_InitConfigStruct
初始化TMR配置结构体,也就是将配置结构体变成默认配置。
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_InitConfigStruct* Description : Initialize a configuration structure with default values.** Implements : LPTMR_DRV_InitConfigStruct_Activity*END**************************************************************************/
void LPTMR_DRV_InitConfigStruct(lptmr_config_t * const config)
{DEV_ASSERT(config != NULL);/* General parameters */config->dmaRequest = false;config->interruptEnable = false;config->freeRun = false;config->workMode = LPTMR_WORKMODE_TIMER;/* Counter parameters */config->clockSelect = LPTMR_CLOCKSOURCE_SIRCDIV2;config->prescaler = LPTMR_PRESCALE_2;config->bypassPrescaler = false;config->compareValue = 0u;config->counterUnits = LPTMR_COUNTER_UNITS_TICKS;/* Pulse Counter specific parameters */config->pinSelect = LPTMR_PINSELECT_TRGMUX;config->pinPolarity = LPTMR_PINPOLARITY_RISING;
}
LPTMR_DRV_Init
初始化函数,入参为TMR序号、配置结构体、是否开始计数。
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_Init* Description : Initialize a LPTMR instance based on the input configuration* structure.** When (counterUnits == LPTMR_COUNTER_UNITS_MICROSECONDS) the function will* automatically configure the timer for the input compareValue in microseconds.* The input parameters for 'prescaler' and 'bypassPrescaler' will be ignored* - their values will be adapted by the function, to best fit the input compareValue* (in microseconds) for the operating clock frequency.** LPTMR_COUNTER_UNITS_MICROSECONDS may only be used for LPTMR_WORKMODE_TIMER mode.* Otherwise the function shall not convert 'compareValue' in ticks* and this is likely to cause erroneous behavior.** When (counterUnits == LPTMR_COUNTER_UNITS_TICKS) the function will use the* 'prescaler' and 'bypassPrescaler' provided in the input configuration structure.** When (counterUnits == LPTMR_COUNTER_UNITS_TICKS), 'compareValue' must be lower* than 0xFFFFu. Only the least significant 16bits of 'compareValue' will be used.* When (counterUnits == LPTMR_COUNTER_UNITS_MICROSECONDS), 'compareValue'* may take any 32bits unsigned value.** Implements : LPTMR_DRV_Init_Activity*END**************************************************************************/
void LPTMR_DRV_Init(const uint32_t instance,const lptmr_config_t * const config,const bool startCounter)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);DEV_ASSERT(config != NULL);LPTMR_Type* const base = g_lptmrBase[instance];LPTMR_DRV_SetConfig(instance, config);/* Start the counter if requested */if (startCounter){LPTMR_Enable(base);}
}
LPTMR_DRV_SetConfig
将配置结构体的配置信息设置到序号里面的TMR当中。
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_SetConfig* Description : Configure a LPTMR instance based on the input configuration* structure.** When (counterUnits == LPTMR_COUNTER_UNITS_MICROSECONDS) the function will* automatically configure the timer for the input compareValue in microseconds.* The input parameters for 'prescaler' and 'bypassPrescaler' will be ignored* - their values will be adapted by the function, to best fit the input compareValue* (in microseconds) for the operating clock frequency.** LPTMR_COUNTER_UNITS_MICROSECONDS may only be used for LPTMR_WORKMODE_TIMER mode.* Otherwise the function shall not convert 'compareValue' in ticks* and this is likely to cause erroneous behavior.** When (counterUnits == LPTMR_COUNTER_UNITS_TICKS) the function will use the* 'prescaler' and 'bypassPrescaler' provided in the input configuration structure.** When (counterUnits == LPTMR_COUNTER_UNITS_TICKS), 'compareValue' must be lower* than 0xFFFFu. Only the least significant 16bits of 'compareValue' will be used.* When (counterUnits == LPTMR_COUNTER_UNITS_MICROSECONDS), 'compareValue'* may take any 32bits unsigned value.** Implements : LPTMR_DRV_SetConfig_Activity*END**************************************************************************/
void LPTMR_DRV_SetConfig(const uint32_t instance,const lptmr_config_t * const config)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);DEV_ASSERT(config != NULL);LPTMR_Type* const base = g_lptmrBase[instance];uint32_t configCmpValue = config->compareValue;lptmr_workmode_t configWorkMode = config->workMode;uint16_t cmpValueTicks = 0U;lptmr_prescaler_t prescVal = config->prescaler;bool prescBypass = config->bypassPrescaler;lptmr_counter_units_t configCounterUnits = config->counterUnits;if(configWorkMode == LPTMR_WORKMODE_TIMER){/* A valid clock must be selected when used in Timer Mode. */uint32_t clkFreq;clkFreq = lptmr_GetClkFreq(config->clockSelect, instance);DEV_ASSERT(clkFreq != 0U); /* Clock frequency equal to '0', signals invalid value. */if(configCounterUnits == LPTMR_COUNTER_UNITS_MICROSECONDS){bool chooseClkConfigStatus;/* When workmode is set to Timer Mode and compare value is provided in microseconds,* then the input parameters for prescale value and prescaleBypass are ignored.* The prescaleValue, prescaleBypass and cmpValue in ticks, are calculated to best fit* the input configCmpValue (in us) for the current operating clk frequency. */chooseClkConfigStatus = lptmr_ChooseClkConfig(clkFreq, configCmpValue, &prescVal, &prescBypass, &cmpValueTicks);DEV_ASSERT(chooseClkConfigStatus == true);(void) chooseClkConfigStatus;}else{DEV_ASSERT(configCounterUnits == LPTMR_COUNTER_UNITS_TICKS);DEV_ASSERT(configCmpValue <= LPTMR_CMR_COMPARE_MASK); /* Compare Value in Tick Units must fit in CMR. */cmpValueTicks = (uint16_t)(configCmpValue & LPTMR_CMR_COMPARE_MASK);}}else{/* If configWorkMode is not LPTMR_WORKMODE_TIMER, then it must be LPTMR_WORKMODE_PULSECOUNTER. */DEV_ASSERT(configWorkMode == LPTMR_WORKMODE_PULSECOUNTER);/* Only LPTMR_COUNTER_UNITS_TICKS can be used when LPTMR is configured as Pulse Counter. */DEV_ASSERT(config->counterUnits == LPTMR_COUNTER_UNITS_TICKS);/* A valid clock must be selected when glitch filter is enabled (prescaler not bypassed). */DEV_ASSERT((lptmr_GetClkFreq(config->clockSelect, instance) != 0u) || prescBypass);/* Glitch filter does not support LPTMR_PRESCALE_2. */DEV_ASSERT(prescBypass || (prescVal != LPTMR_PRESCALE_2));DEV_ASSERT(configCmpValue <= LPTMR_CMR_COMPARE_MASK); /* Compare Value in Tick Units must fit in CMR. */cmpValueTicks = (uint16_t)(configCmpValue & LPTMR_CMR_COMPARE_MASK);}/* Initialize and write configuration parameters. */LPTMR_Init(base);LPTMR_SetDmaRequest (base, config->dmaRequest);LPTMR_SetInterrupt (base, config->interruptEnable);LPTMR_SetFreeRunning (base, config->freeRun);LPTMR_SetWorkMode (base, configWorkMode);LPTMR_SetPrescaler (base, prescVal);LPTMR_SetBypass (base, prescBypass);LPTMR_SetClockSelect (base, config->clockSelect);LPTMR_SetCompareValue (base, cmpValueTicks);LPTMR_SetPinSelect (base, config->pinSelect);LPTMR_SetPinPolarity (base, config->pinPolarity);
}
LPTMR_DRV_GetConfig
获取配置结构体信息
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_GetConfig* Description : Get the current configuration of the LPTMR instance.* Always returns compareValue in LPTMR_COUNTER_UNITS_TICKS.** Implements : LPTMR_DRV_GetConfig_Activity*END**************************************************************************/
void LPTMR_DRV_GetConfig(const uint32_t instance,lptmr_config_t * const config)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);DEV_ASSERT(config != NULL);const LPTMR_Type* const base = g_lptmrBase[instance];/* Read current configuration */config->dmaRequest = LPTMR_GetDmaRequest(base);config->interruptEnable = LPTMR_GetInterruptEnable(base);config->freeRun = LPTMR_GetFreeRunning(base);config->workMode = LPTMR_GetWorkMode(base);config->prescaler = LPTMR_GetPrescaler(base);config->bypassPrescaler = LPTMR_GetBypass(base);config->clockSelect = LPTMR_GetClockSelect(base);config->compareValue = LPTMR_GetCompareValue(base);config->counterUnits = LPTMR_COUNTER_UNITS_TICKS;config->pinSelect = LPTMR_GetPinSelect(base);config->pinPolarity = LPTMR_GetPinPolarity(base);
}
LPTMR_DRV_Deinit
逆初始化
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_Deinit* Description : De-initialize the LPTMR (stop the counter and reset all registers to default value).** Implements : LPTMR_DRV_Deinit_Activity*END**************************************************************************/
void LPTMR_DRV_Deinit(const uint32_t instance)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);LPTMR_Type* const base = g_lptmrBase[instance];LPTMR_Disable(base);LPTMR_Init(base);
}
LPTMR_DRV_SetCompareValueByCount
设置对比值
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_SetCompareValueByCount* Description : Set the compare value in counter tick units, for a LPTMR instance.* Possible return values:* - STATUS_SUCCESS: completed successfully* - STATUS_ERROR: cannot reconfigure compare value (TCF not set)* - STATUS_TIMEOUT: compare value is smaller than current counter value** Implements : LPTMR_DRV_SetCompareValueByCount_Activity*END**************************************************************************/
status_t LPTMR_DRV_SetCompareValueByCount(const uint32_t instance,const uint16_t compareValueByCount)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);LPTMR_Type* const base = g_lptmrBase[instance];status_t statusCode = STATUS_SUCCESS;bool timerEnabled = LPTMR_GetEnable(base);bool compareFlag = LPTMR_GetCompareFlag(base);uint16_t counterVal;/* Check if a valid clock is selected for the timer/glitch filter */
#if (defined (DEV_ERROR_DETECT) || defined (CUSTOM_DEVASSERT))bool bypass = LPTMR_GetBypass(base);lptmr_workmode_t workMode = LPTMR_GetWorkMode(base);(void) bypass;(void) workMode;
#endif /* (defined (DEV_ERROR_DETECT) || defined (CUSTOM_DEVASSERT)) */DEV_ASSERT((lptmr_GetClkFreq(LPTMR_GetClockSelect(base), instance) != 0u) || \(bypass && (workMode == LPTMR_WORKMODE_PULSECOUNTER)));/* The compare value can only be written if counter is disabled or the compare flag is set. */if (timerEnabled && !compareFlag){statusCode = STATUS_ERROR;}else{/* Check if new value is below the current counter value */LPTMR_SetCompareValue(base, compareValueByCount);counterVal = LPTMR_GetCounterValue(base);if (counterVal >= compareValueByCount){statusCode = STATUS_TIMEOUT;}}return statusCode;
}
LPTMR_DRV_GetCompareValueByCount
获取对比值
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_GetCompareValueByCount* Description : Get the compare value of timer in ticks units.** Implements : LPTMR_DRV_GetCompareValueByCount_Activity*END**************************************************************************/
void LPTMR_DRV_GetCompareValueByCount(const uint32_t instance,uint16_t * const compareValueByCount)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);const LPTMR_Type* const base = g_lptmrBase[instance];*compareValueByCount = LPTMR_GetCompareValue(base);
}
LPTMR_DRV_SetCompareValueByUs
设置对比值,需要工作模式为计时器
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_SetCompareValueUs* Description : Set the compare value for Timer Mode in microseconds,* for a LPTMR instance.* Can be used only in Timer Mode.* Possible return values:* - STATUS_SUCCESS: completed successfully* - STATUS_ERROR: cannot reconfigure compare value* - STATUS_TIMEOUT: compare value greater then current counter value** Implements : LPTMR_DRV_SetCompareValueByUs_Activity*END**************************************************************************/
status_t LPTMR_DRV_SetCompareValueByUs(const uint32_t instance,const uint32_t compareValueUs)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);status_t returnCode = STATUS_SUCCESS;LPTMR_Type* const base = g_lptmrBase[instance];bool timerEnabled, compareFlag;lptmr_clocksource_t clkSrc;uint32_t clkFreq;uint16_t cmpValTicks, currentCounterVal;lptmr_prescaler_t prescVal;bool prescBypass, conversionStatus;/* This function can only be used if LPTMR is configured in Timer Mode. */DEV_ASSERT(LPTMR_GetWorkMode(base) == LPTMR_WORKMODE_TIMER);timerEnabled = LPTMR_GetEnable(base);compareFlag = LPTMR_GetCompareFlag(base);/* The compare value can only be written if counter is disabled or the compare flag is set. */if (timerEnabled && !compareFlag){returnCode = STATUS_ERROR;}else{clkSrc = LPTMR_GetClockSelect(base);clkFreq = lptmr_GetClkFreq(clkSrc, instance);DEV_ASSERT(clkFreq != 0U); /* Check the calculated clock frequency: '0' - invalid*//* Get prescaler value and prescaler bypass state.*/prescVal = LPTMR_GetPrescaler(base);prescBypass = LPTMR_GetBypass(base);/* Convert new compare value from microseconds to ticks. */conversionStatus = lptmr_Us2Ticks(clkFreq, prescVal, prescBypass, compareValueUs, &cmpValTicks);DEV_ASSERT(conversionStatus == true); /* Check the conversion status: compareValueUs doesn't fit for current prescaller. */(void) conversionStatus;/* Write value and check if written successfully */LPTMR_SetCompareValue(base, cmpValTicks);currentCounterVal = LPTMR_GetCounterValue(base);if (currentCounterVal >= cmpValTicks){returnCode = STATUS_TIMEOUT;}}return returnCode;
}
LPTMR_DRV_GetCompareValueByUs
获取对比值,需要工作模式为计时器
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_GetCompareValueByUs* Description : Get the compare value in microseconds representation.* Can be used only in Timer Mode.** Implements : LPTMR_DRV_GetCompareValueByUs_Activity*END**************************************************************************/
void LPTMR_DRV_GetCompareValueByUs(const uint32_t instance,uint32_t * const compareValueUs)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);DEV_ASSERT(compareValueUs != NULL);const LPTMR_Type* const base = g_lptmrBase[instance];lptmr_clocksource_t clkSrc;uint32_t clkFreq;uint16_t cmpValTicks;lptmr_prescaler_t prescVal;bool prescBypass, conversionStatus;/* This function can only be used if LPTMR is configured in Timer Mode. */DEV_ASSERT(LPTMR_GetWorkMode(base) == LPTMR_WORKMODE_TIMER);clkSrc = LPTMR_GetClockSelect(base);clkFreq = lptmr_GetClkFreq(clkSrc, instance);/* The clock frequency must be valid. */DEV_ASSERT(clkFreq != 0U);/* Get prescaler value and prescaler bypass state.*/prescVal = LPTMR_GetPrescaler(base);prescBypass = LPTMR_GetBypass(base);cmpValTicks = LPTMR_GetCompareValue(base);/* Convert current compare value from ticks to microseconds. */conversionStatus = lptmr_Ticks2Us(clkFreq, prescVal, prescBypass, cmpValTicks, compareValueUs);DEV_ASSERT(conversionStatus == true); /* Check the conversion status. */(void) conversionStatus;
}
LPTMR_DRV_GetCompareFlag
它获取的对比标志位的意思是比较事件是否触发
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_GetCompareFlag* Description : Get the current state of the Compare Flag of a LPTMR instance** Implements : LPTMR_DRV_GetCompareFlag_Activity*END**************************************************************************/
bool LPTMR_DRV_GetCompareFlag(const uint32_t instance)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);const LPTMR_Type* const base = g_lptmrBase[instance];bool compareFlag = LPTMR_GetCompareFlag(base);return compareFlag;
}
LPTMR_DRV_ClearCompareFlag
清除对比标志位
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_ClearCompareFlag* Description : Clear the Compare Flag.** Implements : LPTMR_DRV_ClearCompareFlag_Activity*END**************************************************************************/
void LPTMR_DRV_ClearCompareFlag(const uint32_t instance)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);LPTMR_Type* const base = g_lptmrBase[instance];LPTMR_ClearCompareFlag(base);
}
LPTMR_DRV_IsRunning
查看TMR是否在运行
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_IsRunning* Description : Get the running state of a LPTMR instance.* Possible return values:* - true: Timer/Counter started* - false: Timer/Counter stopped** Implements : LPTMR_DRV_IsRunning_Activity*END**************************************************************************/
bool LPTMR_DRV_IsRunning(const uint32_t instance)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);const LPTMR_Type* const base = g_lptmrBase[instance];bool runningState = LPTMR_GetEnable(base);return runningState;
}
LPTMR_DRV_SetInterrupt
设置是否开启中断
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_SetInterrupt* Description : Enable/disable the LPTMR interrupt.** Implements : LPTMR_DRV_SetInterrupt_Activity*END**************************************************************************/
void LPTMR_DRV_SetInterrupt(const uint32_t instance,const bool enableInterrupt)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);LPTMR_Type* const base = g_lptmrBase[instance];LPTMR_SetInterrupt(base, enableInterrupt);
}
LPTMR_DRV_GetCounterValueByCount
获取计数器值,需要工作模式为脉冲计数器
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_GetCounterValueTicks* Description : Get the current Counter Value in timer ticks representation.* Return:* - the counter value.** Implements : LPTMR_DRV_GetCounterValueByCount_Activity*END**************************************************************************/
uint16_t LPTMR_DRV_GetCounterValueByCount(const uint32_t instance)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);LPTMR_Type* const base = g_lptmrBase[instance];uint16_t counterVal = LPTMR_GetCounterValue(base);return counterVal;
}
LPTMR_DRV_StartCounter
开始计时
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_StartCounter* Description : Enable (start) the counter.** Implements : LPTMR_DRV_StartCounter_Activity*END**************************************************************************/
void LPTMR_DRV_StartCounter(const uint32_t instance)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);LPTMR_Type* const base = g_lptmrBase[instance];/* Check if a valid clock is selected for the timer/glitch filter */
#if (defined (DEV_ERROR_DETECT) || defined (CUSTOM_DEVASSERT))bool bypass = LPTMR_GetBypass(base);lptmr_workmode_t workMode = LPTMR_GetWorkMode(base);(void) bypass;(void) workMode;
#endif /* (defined (DEV_ERROR_DETECT) || defined (CUSTOM_DEVASSERT)) */DEV_ASSERT((lptmr_GetClkFreq(LPTMR_GetClockSelect(base), instance) != 0u) || \(bypass && (workMode == LPTMR_WORKMODE_PULSECOUNTER)));LPTMR_Enable(base);
}
LPTMR_DRV_StopCounter
停止工作
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_StopCounter* Description : Disable (stop) the counter.** Implements : LPTMR_DRV_StopCounter_Activity*END**************************************************************************/
void LPTMR_DRV_StopCounter(const uint32_t instance)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);LPTMR_Type* const base = g_lptmrBase[instance];LPTMR_Disable(base);
}
LPTMR_DRV_SetPinConfiguration
设置脉冲计数的引脚和极性
/*FUNCTION************************************************************************ Function Name : LPTMR_DRV_SetPinConfiguration* Description : Set the Input Pin configuration for Pulse Counter mode.** Implements : LPTMR_DRV_SetPinConfiguration_Activity*END**************************************************************************/
void LPTMR_DRV_SetPinConfiguration(const uint32_t instance,const lptmr_pinselect_t pinSelect,const lptmr_pinpolarity_t pinPolarity)
{DEV_ASSERT(instance < LPTMR_INSTANCE_COUNT);LPTMR_Type* const base = g_lptmrBase[instance];LPTMR_SetPinSelect(base, pinSelect);LPTMR_SetPinPolarity(base, pinPolarity);
}
相关文章:

S32 Design Studio PE工具配置TMR
配置步骤 配置内容 生成的配置结构体如下,在Generated_Code路径下的lpTmr.c文件和lpTmr.h文件。 /*! lpTmr1 configuration structure */ const lptmr_config_t lpTmr1_config0 {.workMode LPTMR_WORKMODE_PULSECOUNTER,.dmaRequest false,.interruptEnable tr…...

Typescript中常用的数据类型
文章目录 概要TS的数据类型1.基础类型-- 简单的类型-- Array类型-- Object类型- 可选类型 -- Function类型- 函数的参数类型- 函数的返回值类型- 匿名函数的参数- 函数参数为对象类型- 函数的调用签名- 函数的构造签名(了解)- 剩余参数- 函数的重载(了解)- 函数的this(了解) 2.…...

【推荐】渗透测试面试(问题+答案)
1、介绍一下自认为有趣的挖洞经历 2、你平时用的比较多的漏洞是哪些?相关漏洞的原理?以及对应漏洞的修复方案? 3、php/java反序列化漏洞的原理?解决方案? 4、如果一台服务器被入侵后,你会如何做应急响应? 5、你平时使用哪些工具?以及对应工具的特点? 6、如果遇到waf的情…...

基于java+springboot+vue实现的美食信息推荐系统(文末源码+Lw)23-170
1 摘 要 使用旧方法对美食信息推荐系统的信息进行系统化管理已经不再让人们信赖了,把现在的网络信息技术运用在美食信息推荐系统的管理上面可以解决许多信息管理上面的难题,比如处理数据时间很长,数据存在错误不能及时纠正等问题。这次开发…...

HGAME week2 web
1.What the cow say? 测试发现可以反引号命令执行 ls /f* tac /f*/f* 2.myflask import pickle import base64 from flask import Flask, session, request, send_file from datetime import datetime from pytz import timezonecurrentDateAndTime datetime.now(timezone(…...

SQL注入:网鼎杯2018-unfinish
目录 使用dirmap扫描 使用dirsearch扫描 使用acunetix扫描 爆破后端过滤的字符 绕过限制获取数据 这次的进行SQL注入的靶机是:BUUCTF在线评测 进入到主页面后发现是可以进行登录的,那么我们作为一个安全人员,那肯定不会按照常规的方式来…...

C 标准库 - <limits.h>
在C语言编程中,<limits.h> 头文件扮演着关键角色,它为各种基本数据类型定义了最小和最大限制。通过使用这些预定义的宏,程序员可以确保程序代码不会尝试存储超出特定类型范围的值。 简介 <limits.h> 头文件包含了关于不同类型&…...

《游戏引擎架构》--学习3
内存管理 优化动态内存分配 维持最低限度的堆分配,并且永不在紧凑循环中使用堆分配 容器 迭代器 Unicode...

c语言中的大小写字母转换怎么转?
在C语言中,大小写字母转换是基于ASCII码表的特性实现的。ASCII码中,小写字母从’a’到’z’的ASCII码值是连续的(97到122),而大写字母从’A’到’Z’的ASCII码值也是连续的(65到90)。它们之间有…...

java面试题之SpringMVC篇
Spring MVC的工作原理 Spring MVC的工作原理如下: DispatcherServlet 接收用户的请求找到用于处理request的 handler 和 Interceptors,构造成 HandlerExecutionChain 执行链找到 handler 相对应的 HandlerAdapter执行所有注册拦截器的preHandler方法调…...

基于FPGA的I2C接口控制器(包含单字节和多字节读写)
1、概括 前文对IIC的时序做了详细的讲解,还有不懂的可以获取TI的IIC数据手册查看原理。通过手册需要知道的是IIC读、写数据都是以字节为单位,每次操作后接收方都需要进行应答。主机向从机写入数据后,从机接收数据,需要把总线拉低来…...

使用sql判断两段时间是否重叠
使用sql判断两段时间是否重叠 1. 时间点重叠判断a)时间重叠有以下4种情况a)时间不重叠只有以下2种情况 判断条件, 不重叠的判断判断条件, 重叠的判断 假设现在有时间 [startTime, endTime], 数据库存在字段 sql_start_time 和 sql_end_time, 分别表示要判断的时间段和数据库的时…...

C++模板从入门到入土
1. 泛型编程 如果我们需要实现一个不同类型的交换函数,如果是学的C语言,你要交换哪些类型,不同的类型就需要重新写一个来实现,所以这是很麻烦的,虽然可以cv一下,有了模板就可以减轻负担。 下面写一个适…...

Kotlin 中注解 @JvmOverloads 的作用
JvmOverloads 注解的作用就是:在有默认参数值的方法加上 JvmOverloads 注解,则 Kotlin 就会暴露多个重载方法。 例如,没有加注解,默认参数没有起到任何作用。 fun f(a: String, b: Int 0, c: String "abc") {}那相当…...

EI级 | Matlab实现TCN-GRU-MATT、TCN-GRU、TCN、GRU多变量时间序列预测对比
EI级 | Matlab实现TCN-GRU-MATT、TCN-GRU、TCN、GRU多变量时间序列预测对比 目录 EI级 | Matlab实现TCN-GRU-MATT、TCN-GRU、TCN、GRU多变量时间序列预测对比预测效果基本介绍程序设计参考资料 预测效果 基本介绍 【EI级】Matlab实现TCN-GRU-MATT、TCN-GRU、TCN、GRU多变量时间…...

MongoDB文档插入
文章目录 MongoDB文档插入对比增删改查文档插入 MongoDB写安全机制非确认式写入 MongoDB文档查询参数说明查询操作符比较查询操作符逻辑查询操作符元素查询操作符数组查询操作符 模糊查询区别:$regex操作符中的option选项 MongoDB游标介绍游标函数手动迭代游标示例游标介绍 Mon…...

涵盖5大领域的机器学习工具介绍
随着数据的产生及其使用量的不断增加,对机器学习模型的需求也在成倍增加。由于ML系统包含了算法和丰富的ML库,它有助于分析数据和做出决策。难怪机器学习的知名度越来越高,因为ML应用几乎主导了现代世界的每一个方面。随着企业对这项技术的探…...

git修改及合并commit提交
在开发过程中,保持代码记录清晰会更方便追踪,对代码审核人员也更有便宜。 修改commit提交 比如我们刚提交了一个commit,但之后要追加代码到已经推送到远程仓库的提交中,这时我们可以选择修改commit提交,使新的更改也推…...

大型语言模型的语义搜索(一):关键词搜索
关键词搜索(Keyword Search)是文本搜索种一种常用的技术,很多知名的应用app比如Spotify、YouTube 或 Google map等都会使用关键词搜索的算法来实现用户的搜索任务,关键词搜索是构建搜索系统最常用的方法,最常用的搜索算法是Okapi BM25&#x…...

无需统考可获双证的中国社科院-美国杜兰大学金融硕士
无需统考可获双证的中国社科院-美国杜兰大学金融硕士 中国社会科学院作为党和国家的思想库、智囊团,一直致力于金融财经领域政策的研究和咨询工作,在这个方面我们已经形成了深厚的积累。通过长期的研究和实践,我们能够深刻感受中国金融人才培…...

编程笔记 Golang基础 024 映射
编程笔记 Golang基础 024 映射 一、映射二、映射的定义与初始化三、基本操作四、综合示例程序 Go语言中的映射(map)是一种关联数组或哈希表数据结构,它存储键值对,其中每个键都是唯一的。在Go中,你可以使用 map[keyTy…...

基于springboot+vue的中小型医院网站(前后端分离)
博主主页:猫头鹰源码 博主简介:Java领域优质创作者、CSDN博客专家、阿里云专家博主、公司架构师、全网粉丝5万、专注Java技术领域和毕业设计项目实战,欢迎高校老师\讲师\同行交流合作 主要内容:毕业设计(Javaweb项目|小程序|Pyt…...

Spring boot 实现监听 Redis key 失效事件
一. 开启Redis key过期提醒 方式一:修改配置文件 redis.conf # 默认 notify-keyspace-events "" notify-keyspace-events Ex方式二:命令行开启 CONFIG SET notify-keyspace-events Ex CONFIG GET notify-keyspace-events二. notify-keyspace-e…...

振动样品磁强计
振动样品磁强计是基于电磁感应原理的高灵敏度磁矩测量仪。检测线圈中的振动产生的感应电压与样品的磁矩,振幅和振动频率成正比。在确保振幅和振动频率的不便的基础上,使用锁相放大器测量该电压,然后可以计算出待测样品的磁矩。 振动样品磁强计…...

C语言标准库介绍:<string.h>
在C语言中,<string.h>头文件是标准库中的一个重要部分,它定义了一系列操作字符串和字符数组的函数。本文将详细介绍<string.h>头文件中包含的22个函数,并提供每个函数的完整示例代码。 简介 <string.h>头文件定义了一个变…...

大语言模型LangChain本地知识库:向量数据库与文件处理技术的深度整合
文章目录 大语言模型LangChain本地知识库:向量数据库与文件处理技术的深度整合引言向量数据库在LangChain知识库中的应用文件处理技术在知识库中的角色向量数据库与文件处理技术的整合实践挑战与展望结论 大语言模型LangChain本地知识库:向量数据库与文件…...

展厅设计中都包含哪些分区与展示内容
1、欢迎区 欢迎区是展厅的入口处,通常展示企业品牌、企业标志和企业形象等内容。这个区域通常会有一个欢迎台,展示企业的宣传片、简介和最新资讯等。 2、产品展示区 产品展示区是展示企业产品的区域,展示的产品包括企业主营产品、新产品和重点…...

【k8s核心概念与专业术语】
k8s架构 1、服务的分类 服务分类按如下图根据数据服务支撑,分为无状态和有状态 无状态引用如下所示,如果一个nginx服务,删除后重新部署有可以访问,这个属于无状态,不涉及到数据存储。 有状态服务,如redis&a…...

【stm32】hal库学习笔记-UART/USART串口通信(超详细!)
【stm32】hal库学习笔记-UART/USART串口通信 hal库驱动函数 CubeMX图形化配置 导入LCD.ioc RTC设置 时钟树配置 设置LSE为RTC时钟源 USART设置 中断设置 程序编写 编写主函数 /* USER CODE BEGIN 2 */lcd_init();lcd_show_str(10, 10, 16, "Demo12_1:USART1-CH340&q…...

通俗易懂理解GhostNetV1轻量级神经网络模型
一、参考资料 原始论文:[1] PyTorch代码链接:Efficient-AI-Backbones MindSpore代码:ghostnet_d 解读模型压缩5:减少冗余特征的Ghost模块:华为Ghost网络系列解读 GhostNet论文解析:Ghost Module CVPR…...