System Management code
Dependencies: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
IMD.h
00001 // copied idea from http://developer.mbed.org/forum/mbed/topic/466/?page=1#comment-2457 00002 00003 #ifndef _FILE_IMD_H 00004 #define _FILE_IMD_H 00005 00006 #include "mbed.h" 00007 00008 enum IMDstatus { 00009 OFF = 1<<0, 00010 NORMAL = 1<<1, 00011 UNDERVOLT = 1<<2, 00012 SPEEDSTART = 1<<3, 00013 ERROR = 1<<4, 00014 GROUNDERR = 1<<5, 00015 INVALID = 1<<6, 00016 }; 00017 00018 class IMD{ 00019 public: 00020 IMD(PinName _pin); 00021 00022 char status(); 00023 // Gets the insulation resistance reading 00024 // Returns 0 to 50,000,000 in normal/UV modes 00025 // Returns 0 or 50,000,000 in speed start (good/bad only) 00026 // Nan for invalid measurement (out of permissible range) 00027 // Nan for not avail. in this mode 00028 float resistance(); 00029 00030 // Interrupt function for the edge type detected 00031 void edgeIRQ(); 00032 // Used to zero (reset) the data on timeout 00033 void zeroIRQ(); 00034 00035 private: 00036 float frequency(); 00037 float duty(); 00038 00039 volatile uint32_t startTime; 00040 volatile uint32_t widthTicks; 00041 volatile uint32_t periodTicks; 00042 volatile bool first; 00043 00044 LPC_TIM_TypeDef *timerBase; // Base address of the active timer module 00045 int pin; // Capture pin#, 0 or 1 00046 int timer; 00047 }; 00048 00049 #endif
Generated on Fri Jul 15 2022 06:07:18 by
1.7.2
