api-interrupt-mgr.h 887 B

1234567891011121314151617181920212223242526272829303132333435
  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. InterruptTypeTimerOutputCompare,
  11. InterruptTypeTimerUpdate,
  12. InterruptTypeExternalInterrupt,
  13. } InterruptType;
  14. typedef struct {
  15. InterruptCallback callback;
  16. InterruptType type;
  17. void* context;
  18. bool ready;
  19. } InterruptCallbackItem;
  20. bool api_interrupt_init();
  21. void api_interrupt_add(InterruptCallback callback, InterruptType type, void* context);
  22. void api_interrupt_remove(InterruptCallback callback, InterruptType type);
  23. void api_interrupt_enable(InterruptCallback callback, InterruptType type);
  24. void api_interrupt_disable(InterruptCallback callback, InterruptType type);
  25. void api_interrupt_call(InterruptType type, void* hw);
  26. #ifdef __cplusplus
  27. }
  28. #endif