Wim Huiskamp / Mbed 2 deprecated mbed_audio_alert

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers IEC60601-1-8.h Source File

IEC60601-1-8.h

00001 /****************************************************************
00002  *  IEC601601-1-8 
00003  *
00004  *   This modules provides the IEC Medical Alert tones.
00005  *
00006  *
00007  *   Copyright(C) 2007, NXP Semiconductor
00008  *   All rights reserved.
00009  *
00010  *   Port to mbed 2012 (WH)
00011  ****************************************************************/
00012  
00013 #ifndef _IEC60601_1_8_H
00014 #define _IEC60601_1_8_H
00015 
00016 enum Note_Type  {C4=0,D4=1,E4=2,F4=3,Fsharp4=4,G4=5,A4=6,B4=7,C5=8};      // Can address array rows with notes
00017 
00018 enum Alarm_Type {GENERAL=0, CARDIOVASCULAR=1, PERFUSION=2, VENTILATION=3,  
00019                  TEMPERATURE=4, OXYGEN=5, DRUG_DELIVERY=6, POWER_FAIL=7, LOW_ALARM=8}; // Can tone_seq array rows with alarms
00020 
00021 enum Prio_Type  {HIGH, MEDIUM, LOW, TEST};
00022 
00023 struct wave  {                  // struct for Sine Wave Generator Signal   
00024   short coef;                      // IIR filter coefficient                
00025   long y1;                         // y[-1] value                            
00026   long y2;                         // y[-2] value      
00027 };  
00028 
00029 
00030 class IEC60601 {
00031 
00032 public:
00033   IEC60601();
00034   void TurnOnAlarm(Prio_Type priority, Alarm_Type alarm_type);
00035   void TurnOffAlarm(void); 
00036   void TestAlarm(Note_Type active_note, int w0, int w1, int w2, int w3, int w4);           
00037 
00038 private:  
00039   void _InitSequencer(void);
00040   void _InitDAC(void);   
00041   void _InitToneCoefArray(void);
00042   void _TimerInteruptHandler (void);      
00043 
00044   void _GenerateMultiTone (struct wave *t);
00045 //  void _OutputTones(Note_Type note, unsigned char level);
00046   void _TurnOnNote(void);
00047   void _TurnOffNote(void);
00048   void _EnvelopeControl(void);    
00049   void _HighPriSequence (void);
00050   void _MedPriSequence (void);
00051   void _LowPriSequence (void);
00052   void _TestSequence (void);
00053     
00054   Alarm_Type _alarm_type;
00055   Prio_Type _priority;
00056   unsigned int _sequence;
00057   unsigned int _mscount;
00058   
00059   int _envelope;
00060   Note_Type _active_note;
00061   bool _note_on;
00062   int _note_level;  
00063   bool _envelope_on;    
00064   bool _envelope_off;
00065   
00066   Ticker _ticker;
00067   
00068 };
00069 #endif