/* * * Copyright © 2005, University of Washington, * Department of Computer Science and Engineering. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither name of the University of Washington, Department of Computer * Science and Engineering nor the names of its contributors may be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * */ uint16_t distress_call[32] = { 31,0xFc00,0xF500,0xEa00,0xDf10,0xF800,0xEd00,0xE600,0xDb10,0xF400,0xE900,0xDe00,0xD710,0xEc00,0xE500,0xDa00,0xCf10, 0xE800,0xDd00,0xD600,0xCb10,0xE400,0xD900,0xCe00,0xC710,0xDc00,0xD500,0xCa00,0xBf51,0x3078,0x3078,0x3078}; // sing startle song (distress song) void sing_distress(void) { uint16_t z, ph; send_fm(0x32,0); // stop FM generator // restore these just before singing another song // set tempo data $31 19 for distress send_fm(0x31,19); // tempo for distress call // set volumes $35, $36 both values full loudness send_fm(0x35,0x1f); // up full send_fm(0x36,0x1f); // always 0x15 except for distress ph = distress_call[0]; for(z=1;z<=ph;++z) { send_fm(0,distress_call[z]); } // set up interrupt send_fm(0x34,0x0021); // start FM $32 = 1 send_fm(0x32,1);