mirror of
git://soft.sys114.com/klipper
synced 2026-02-13 08:40:35 +09:00
hc32f460: Add support for hc32f460 micro-controllers
Signed-off-by: Steven Gotthardt <gotthardt@gmail.com>
This commit is contained in:
committed by
Kevin O'Connor
parent
94cbf5ff48
commit
72b6bd7efa
29
src/hc32f460/interrupts.c
Normal file
29
src/hc32f460/interrupts.c
Normal file
@@ -0,0 +1,29 @@
|
||||
// Interrupt support for HC32F460
|
||||
// The library interrupt support is huge and redefines systick
|
||||
//
|
||||
// Copyright (C) 2022 Steven Gotthardt <gotthardt@gmail.com>
|
||||
//
|
||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
|
||||
#include "hc32f460.h"
|
||||
|
||||
#define IRQ_PRIORITY_DEFAULT 15u
|
||||
|
||||
/* the interrupts on the hc32f460 can be 're-assigned'
|
||||
The author can choose the irqType (IRQ000_Handler, etc...)
|
||||
that the source (irqSrc) triggers
|
||||
*/
|
||||
|
||||
void IrqRegistration(en_int_src_t irqSrc, IRQn_Type irqType)
|
||||
{
|
||||
stc_intc_sel_field_t *stcIntSel = (stc_intc_sel_field_t *)
|
||||
((uint32_t)(&M4_INTC->SEL0) + (4u * irqType));
|
||||
|
||||
// what is the source of the selected interrupt? (USART, etc...)
|
||||
stcIntSel->INTSEL = irqSrc;
|
||||
|
||||
// set priority and enable
|
||||
NVIC_SetPriority(irqType, IRQ_PRIORITY_DEFAULT);
|
||||
NVIC_ClearPendingIRQ(irqType);
|
||||
NVIC_EnableIRQ(irqType);
|
||||
}
|
||||
Reference in New Issue
Block a user