mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-05 15:38:29 -04:00
a80ae0cde3
This commit changes the way libraries headers are included in source files: - If the header is in the same directory the source belongs to, so the notation '#include ""' is used with the path relative to the directory containing the source. - If the header is outside the directory containing the source, then we use the notation '#include <>' with the path relative to libraries folder. Some of the advantages of such approach: - Only one search path for libraries headers. - OSs like Windows may have a better lookup time.
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
#include <AP_HAL/AP_HAL.h>
|
|
#if (CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_APM2)
|
|
|
|
#include <stdlib.h>
|
|
#include <avr/interrupt.h>
|
|
|
|
#include "ISRRegistry.h"
|
|
|
|
using namespace AP_HAL_AVR;
|
|
|
|
AP_HAL::Proc ISRRegistry::_registry[ISR_REGISTRY_NUM_SLOTS] = {NULL};
|
|
|
|
int ISRRegistry::register_signal(int signal, AP_HAL::Proc proc)
|
|
{
|
|
if (signal >= 0 && signal < ISR_REGISTRY_NUM_SLOTS) {
|
|
_registry[signal] = proc;
|
|
return 0;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
int ISRRegistry::unregister_signal(int signal)
|
|
{
|
|
if (signal >= 0 && signal < ISR_REGISTRY_NUM_SLOTS) {
|
|
_registry[signal] = NULL;
|
|
return 0;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
/* ========== ISR IMPLEMENTATIONS ========== */
|
|
|
|
extern "C" ISR(TIMER2_OVF_vect) {
|
|
if ( ISRRegistry::_registry[ISR_REGISTRY_TIMER2_OVF] != NULL)
|
|
ISRRegistry::_registry[ISR_REGISTRY_TIMER2_OVF]();
|
|
}
|
|
|
|
|
|
extern "C" ISR(TIMER4_CAPT_vect) {
|
|
if ( ISRRegistry::_registry[ISR_REGISTRY_TIMER4_CAPT] != NULL)
|
|
ISRRegistry::_registry[ISR_REGISTRY_TIMER4_CAPT]();
|
|
}
|
|
|
|
extern "C" ISR(TIMER5_CAPT_vect) {
|
|
if ( ISRRegistry::_registry[ISR_REGISTRY_TIMER5_CAPT] != NULL)
|
|
ISRRegistry::_registry[ISR_REGISTRY_TIMER5_CAPT]();
|
|
}
|
|
|
|
#endif
|