api-interrupt-mgr.h 613 B

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include <stdbool.h>
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. typedef void (*InterruptCallback)(void*, void*);
  7. typedef enum {
  8. InterruptTypeComparatorTrigger,
  9. InterruptTypeTimerCapture,
  10. } InterruptType;
  11. typedef struct {
  12. InterruptCallback callback;
  13. InterruptType type;
  14. void* context;
  15. bool ready;
  16. } InterruptCallbackItem;
  17. bool api_interrupt_init();
  18. void api_interrupt_add(InterruptCallback callback, InterruptType type, void* context);
  19. void api_interrupt_remove(InterruptCallback callback);
  20. void api_interrupt_call(InterruptType type, void* hw);
  21. #ifdef __cplusplus
  22. }
  23. #endif