From 5b9738bba1c62e53eaf7096dd968a1e2a5274499 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Mon, 3 Dec 2012 11:41:20 -0800 Subject: [PATCH] remove Arduino_Mega_ISR_Registry library, deprecated under AP_HAL --- .../Arduino_Mega_ISR_Registry.cpp | 48 ------------------- .../Arduino_Mega_ISR_Registry.h | 22 --------- 2 files changed, 70 deletions(-) delete mode 100644 libraries/Arduino_Mega_ISR_Registry/Arduino_Mega_ISR_Registry.cpp delete mode 100644 libraries/Arduino_Mega_ISR_Registry/Arduino_Mega_ISR_Registry.h diff --git a/libraries/Arduino_Mega_ISR_Registry/Arduino_Mega_ISR_Registry.cpp b/libraries/Arduino_Mega_ISR_Registry/Arduino_Mega_ISR_Registry.cpp deleted file mode 100644 index ef3bd790fd..0000000000 --- a/libraries/Arduino_Mega_ISR_Registry/Arduino_Mega_ISR_Registry.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -#include -#include "Arduino_Mega_ISR_Registry.h" -#include "avr/interrupt.h" - -proc_ptr Arduino_Mega_ISR_Registry::_registry[ISR_REGISTRY_NUM_SLOTS]; - -void Arduino_Mega_ISR_Registry::init() -{ - for (int i = 0; i < ISR_REGISTRY_NUM_SLOTS; i++) - _registry[i] = NULL; -} - -int Arduino_Mega_ISR_Registry::register_signal(int signal, proc_ptr proc) -{ - if (signal >= 0 && signal < ISR_REGISTRY_NUM_SLOTS) { - _registry[signal] = proc; - return 0; - } - return -1; -} - -int Arduino_Mega_ISR_Registry::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 (Arduino_Mega_ISR_Registry::_registry[ISR_REGISTRY_TIMER2_OVF] != NULL) - Arduino_Mega_ISR_Registry::_registry[ISR_REGISTRY_TIMER2_OVF](); -} - - -extern "C" ISR(TIMER4_CAPT_vect) { - if (Arduino_Mega_ISR_Registry::_registry[ISR_REGISTRY_TIMER4_CAPT] != NULL) - Arduino_Mega_ISR_Registry::_registry[ISR_REGISTRY_TIMER4_CAPT](); -} - -extern "C" ISR(TIMER5_CAPT_vect) { - if (Arduino_Mega_ISR_Registry::_registry[ISR_REGISTRY_TIMER5_CAPT] != NULL) - Arduino_Mega_ISR_Registry::_registry[ISR_REGISTRY_TIMER5_CAPT](); -} diff --git a/libraries/Arduino_Mega_ISR_Registry/Arduino_Mega_ISR_Registry.h b/libraries/Arduino_Mega_ISR_Registry/Arduino_Mega_ISR_Registry.h deleted file mode 100644 index 420d3e3e4e..0000000000 --- a/libraries/Arduino_Mega_ISR_Registry/Arduino_Mega_ISR_Registry.h +++ /dev/null @@ -1,22 +0,0 @@ - -#ifndef __ARDUINO_MEGA_ISR_REGISTRY_H__ -#define __ARDUINO_MEGA_ISR_REGISTRY_H__ - -#define ISR_REGISTRY_TIMER2_OVF 0 -#define ISR_REGISTRY_TIMER4_CAPT 1 -#define ISR_REGISTRY_TIMER5_CAPT 2 -#define ISR_REGISTRY_NUM_SLOTS 3 - -typedef void (*proc_ptr)(void); - -class Arduino_Mega_ISR_Registry -{ -public: - void init(); - int register_signal(int isr_number, proc_ptr proc); - int unregister_signal(int isr_number); - - static proc_ptr _registry[ISR_REGISTRY_NUM_SLOTS]; -}; - -#endif // __ARDUINO_MEGA_ISR_REGISTRY_H__