mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-22 21:01:40 +03:00
3114a2d4b8
* Add cscope db generation * Add api-hal-irda, TIM2: HAL->LL * Add libirda: pwm decoding * Universal state machine * Add irda decoder library * Move IRDA capture to standalone tool * Add encoder/decoder samsung32, NEC, fix bugs * Port current App to new Irda lib * Fix clang format for test data * Port IRDA api-hal to f6 Co-authored-by: あく <alleteam@gmail.com>
73 lines
1.5 KiB
C
73 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,
|
|
InterruptTypeExternalInterrupt,
|
|
} 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
|