IEC60601-1-8 Audible Alert Generator

Dependencies:   mbed

See here for more info.

Committer:
wim
Date:
Fri May 18 19:51:12 2012 +0000
Revision:
0:07767204347b
First Release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wim 0:07767204347b 1 /****************************************************************
wim 0:07767204347b 2 * IEC601601-1-8
wim 0:07767204347b 3 *
wim 0:07767204347b 4 * This modules provides the IEC Medical Alert tones.
wim 0:07767204347b 5 *
wim 0:07767204347b 6 *
wim 0:07767204347b 7 * Copyright(C) 2007, NXP Semiconductor
wim 0:07767204347b 8 * All rights reserved.
wim 0:07767204347b 9 *
wim 0:07767204347b 10 * Port to mbed 2012 (WH)
wim 0:07767204347b 11 ****************************************************************/
wim 0:07767204347b 12
wim 0:07767204347b 13 #ifndef _IEC60601_1_8_H
wim 0:07767204347b 14 #define _IEC60601_1_8_H
wim 0:07767204347b 15
wim 0:07767204347b 16 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
wim 0:07767204347b 17
wim 0:07767204347b 18 enum Alarm_Type {GENERAL=0, CARDIOVASCULAR=1, PERFUSION=2, VENTILATION=3,
wim 0:07767204347b 19 TEMPERATURE=4, OXYGEN=5, DRUG_DELIVERY=6, POWER_FAIL=7, LOW_ALARM=8}; // Can tone_seq array rows with alarms
wim 0:07767204347b 20
wim 0:07767204347b 21 enum Prio_Type {HIGH, MEDIUM, LOW, TEST};
wim 0:07767204347b 22
wim 0:07767204347b 23 struct wave { // struct for Sine Wave Generator Signal
wim 0:07767204347b 24 short coef; // IIR filter coefficient
wim 0:07767204347b 25 long y1; // y[-1] value
wim 0:07767204347b 26 long y2; // y[-2] value
wim 0:07767204347b 27 };
wim 0:07767204347b 28
wim 0:07767204347b 29
wim 0:07767204347b 30 class IEC60601 {
wim 0:07767204347b 31
wim 0:07767204347b 32 public:
wim 0:07767204347b 33 IEC60601();
wim 0:07767204347b 34 void TurnOnAlarm(Prio_Type priority, Alarm_Type alarm_type);
wim 0:07767204347b 35 void TurnOffAlarm(void);
wim 0:07767204347b 36 void TestAlarm(Note_Type active_note, int w0, int w1, int w2, int w3, int w4);
wim 0:07767204347b 37
wim 0:07767204347b 38 private:
wim 0:07767204347b 39 void _InitSequencer(void);
wim 0:07767204347b 40 void _InitDAC(void);
wim 0:07767204347b 41 void _InitToneCoefArray(void);
wim 0:07767204347b 42 void _TimerInteruptHandler (void);
wim 0:07767204347b 43
wim 0:07767204347b 44 void _GenerateMultiTone (struct wave *t);
wim 0:07767204347b 45 // void _OutputTones(Note_Type note, unsigned char level);
wim 0:07767204347b 46 void _TurnOnNote(void);
wim 0:07767204347b 47 void _TurnOffNote(void);
wim 0:07767204347b 48 void _EnvelopeControl(void);
wim 0:07767204347b 49 void _HighPriSequence (void);
wim 0:07767204347b 50 void _MedPriSequence (void);
wim 0:07767204347b 51 void _LowPriSequence (void);
wim 0:07767204347b 52 void _TestSequence (void);
wim 0:07767204347b 53
wim 0:07767204347b 54 Alarm_Type _alarm_type;
wim 0:07767204347b 55 Prio_Type _priority;
wim 0:07767204347b 56 unsigned int _sequence;
wim 0:07767204347b 57 unsigned int _mscount;
wim 0:07767204347b 58
wim 0:07767204347b 59 int _envelope;
wim 0:07767204347b 60 Note_Type _active_note;
wim 0:07767204347b 61 bool _note_on;
wim 0:07767204347b 62 int _note_level;
wim 0:07767204347b 63 bool _envelope_on;
wim 0:07767204347b 64 bool _envelope_off;
wim 0:07767204347b 65
wim 0:07767204347b 66 Ticker _ticker;
wim 0:07767204347b 67
wim 0:07767204347b 68 };
wim 0:07767204347b 69 #endif