APM:Libraries
handler.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <hal.h>
4 
5 template<typename T> void ZeroIt(T& value)
6 {
7  memset(&value,0,sizeof(value));
8 }
9 
10 FUNCTOR_TYPEDEF(MemberProcArg, void, uint32_t);
11 
12 #pragma pack(push, 1)
13 union Revo_handler { // blood, bowels, assembler :) transform functors into a unified view for calling from C
17  AP_HAL::Device::PeriodicCb pcb;//\\ this is C not C ++, so we can not declare the support of functors explicitly, and are forced to pass
18  AP_HAL::MemberProc mp; // support of functors explicitly, and are forced to pass
19  MemberProcArg mpa;
20  Handler h; // treat as handle <-- as 64-bit integer
21  uint32_t w[2]; // words, to check. if this is a functor then the high is the address of the flash and the lower one is the address in RAM.
22  // if this is a function pointer then lower word is an address in flash and high is 0
23 };
24 #pragma pack(pop)
25 
void(* voidFuncPtr)(void)
Definition: hal_types.h:16
AP_HAL::MemberProc mp
Definition: handler.h:18
Handler h
Definition: handler.h:20
revo_isr_handler isr
Definition: handler.h:15
void(* Proc)(void)
void(* revo_isr_handler)(uint32_t arg)
Definition: hal_types.h:17
uint32_t w[2]
Definition: handler.h:21
void ZeroIt(T &value)
Definition: handler.h:5
MemberProcArg mpa
Definition: handler.h:19
FUNCTOR_TYPEDEF(MemberProcArg, void, uint32_t)
AP_HAL::Device::PeriodicCb pcb
Definition: handler.h:17
float value
voidFuncPtr vp
Definition: handler.h:14
uint64_t Handler
Definition: hal_types.h:19
AP_HAL::Proc hp
Definition: handler.h:16