mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-25 06:13:14 +03:00
eac8626c8c
* App accessor: fix external interrupts binding. Hal: removed InterruptTypeExternalInterrupt. * GPIO hal: add ex and simple init functions to F6 target * GPIO hal: add dummy alt fn to F6 target * RFID hal: update gpio hal usage * F5,F6: synchronize targets, backport VCP fixes, cleanup. Co-authored-by: あく <alleteam@gmail.com>
72 lines
1.5 KiB
C
72 lines
1.5 KiB
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** Interrupt callback prototype */
|
|
typedef void (*InterruptCallback)(void*, void*);
|
|
|
|
/** Interupt type */
|
|
typedef enum {
|
|
InterruptTypeComparatorTrigger,
|
|
InterruptTypeTimerOutputCompare,
|
|
InterruptTypeTimerUpdate,
|
|
} InterruptType;
|
|
|
|
/** Interrupt callback type */
|
|
typedef struct {
|
|
InterruptCallback callback;
|
|
InterruptType type;
|
|
void* context;
|
|
bool ready;
|
|
} InterruptCallbackItem;
|
|
|
|
/**
|
|
* Init interrupt
|
|
* @return true on succsessful initialization, false otherwise
|
|
*/
|
|
bool api_interrupt_init();
|
|
|
|
/**
|
|
* Add interrupt
|
|
* @param callback InterruptCallback
|
|
* @param type InterruptType
|
|
* @param context context for callback
|
|
*/
|
|
void api_interrupt_add(InterruptCallback callback, InterruptType type, void* context);
|
|
|
|
/**
|
|
* Remove interrupt
|
|
* @param callback InterruptCallback
|
|
* @param type InterruptType
|
|
*/
|
|
void api_interrupt_remove(InterruptCallback callback, InterruptType type);
|
|
|
|
/**
|
|
* Enable interrupt
|
|
* @param callback InterruptCallback
|
|
* @param type InterruptType
|
|
*/
|
|
void api_interrupt_enable(InterruptCallback callback, InterruptType type);
|
|
|
|
/**
|
|
* Disable interrupt
|
|
* @param callback InterruptCallback
|
|
* @param type InterruptType
|
|
*/
|
|
void api_interrupt_disable(InterruptCallback callback, InterruptType type);
|
|
|
|
/**
|
|
* Call interrupt
|
|
* @param type InterruptType
|
|
* @param hw pointer to hardware peripheral
|
|
*/
|
|
void api_interrupt_call(InterruptType type, void* hw);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|