working on structure of interrupt

interrupts
polymurph 3 years ago
parent 3e9b0d7cb8
commit 15c0f36e11

@ -0,0 +1,44 @@
#include "interrupt.h"
void intInit(
intType_t intType
intHandler_t handler,
uint8_t priority)
{
NVIC_SetPriority(, priority);
}
void intEnableAll()
{
__enable_irq();
}
void intDissableAll()
{
__disable_irq();
}
void intEnable(
intType_t intType)
{
NVIC_EnableIRQ();
}
void intDissable(
intType_t intType)
{
}
// Interrupt service routines
void TIM2_IRQHandler()
{
if(TIM2->SR & TIM_SR_UIF) {
// clear flag
TIM2-> SR &= ~TIM_SR_UIF;
//TODO: call handler here
}
}

@ -41,7 +41,7 @@ typedef enum {
* The interrupt will be automatically enabled and will be able to run after intEnableAll is * The interrupt will be automatically enabled and will be able to run after intEnableAll is
* called. If the interrupt should only run at a specific even one can controll it by calling * called. If the interrupt should only run at a specific even one can controll it by calling
* intDissable prior to calling intEnableAll and calling intEnbale at a specific point and * intDissable prior to calling intEnableAll and calling intEnbale at a specific point and
* dissabling it again with intDissable * dissabling it again with intDisable
* When the desired interrupt occures the handler will be called. * When the desired interrupt occures the handler will be called.
* The interrupt type and priority level is dependent on the architecture of the target MCU. * The interrupt type and priority level is dependent on the architecture of the target MCU.
* To find more information on what can be done one must read the documentation specific to the * To find more information on what can be done one must read the documentation specific to the
@ -65,19 +65,19 @@ void intInit(
void intEnableAll(); void intEnableAll();
/** /**
* @brief Dissable all Interrups * @brief Disable all Interrups
* *
* Dissables all interrupts globally exept the non maskable ones given by the architecture of the * Dissables all interrupts globally exept the non maskable ones given by the architecture of the
* MCU. * MCU.
*/ */
void intDissableAll(); void intDisableAll();
/** /**
* @brief Enable one interrupt type * @brief Enable one interrupt type
* *
* The Interrupt for the desired interrupt will be enabled. This means that interrupt of that * The Interrupt for the desired interrupt will be enabled. This means that interrupt of that
* type will occure. To revert this intDissable musst be called. * type will occure. To revert this intDisable musst be called.
* It can be called when interrupts are are globally allowed or when dissabled. * It can be called when interrupts are are globally allowed or when disabled.
* *
* @param intType interrupt type * @param intType interrupt type
*/ */
@ -88,14 +88,14 @@ void intEnable(
/** /**
* @brief Dissable one interrupt type * @brief Dissable one interrupt type
* *
* The Interrupt for the desired interrupt will be dissabled. This means that no interrupt of that * The Interrupt for the desired interrupt will be disabled. This means that no interrupt of that
* type will occure. To revert this intEnable musst be called. * type will occure. To revert this intEnable musst be called.
* It can be called when interrupts are are globally allowed or when dissabled. * It can be called when interrupts are are globally allowed or when dissabled.
* It will not stop other all interrupts in contrast to intDissableAll. * It will not stop other all interrupts in contrast to intDissableAll.
* *
* @param intType interrupt type * @param intType interrupt type
*/ */
void intDissable( void intDisable(
intType_t intType); intType_t intType);
#ifdef __cplusplus #ifdef __cplusplus
@ -103,3 +103,4 @@ void intDissable(
#endif #endif
#endif #endif

Loading…
Cancel
Save