/***********************************************************************/
/*
* Initialize the NVIC to enable the specified IRQ.
*
* NOTE: The function only initializes the NVIC to enable a single IRQ.
* Interrupts will also need to be enabled in the ARM core. This can be
* done using the EnableInterrupts macro.
*
* Parameters:
* irq irq number to be enabled (the irq number NOT the vector number)
*/
void enable_irq (int irq)
{
int div;
/* Make sure that the IRQ is an allowable number. Right now up to 91 is
* used.
*/
if (irq > 91)
printf("\nERR! Invalid IRQ value passed to enable irq function!\n");
/* Determine which of the NVICISERs corresponds to the irq */
div = irq/32;
switch (div)
{
case 0x0:
NVICICPR0 = 1 << (irq%32);
NVICISER0 = 1 << (irq%32);
break;
case 0x1:
NVICICPR1 = 1 << (irq%32);
arm_cm4.c关于kinetis的修改
最新推荐文章于 2024-07-04 09:45:12 发布
针对Kinetis微控制器的特性,需要在arm_cm4.c文件中调整中断设置。原始代码NVIC |= 1<<(irq%32) 改为 NVIC = 1<<(irq%32),以确保在处理连续中断时不会清除先前的配置。

最低0.47元/天 解锁文章
2万+

被折叠的 条评论
为什么被折叠?



