|
|
Jump to this file's LXR Page |
|
|
File: [CENS] / emstar / devel / loc / ar / ar_soundtest.c
(download)
/
(as text)
Revision: 1.2, Thu Aug 17 17:24:49 2006 UTC (3 years, 3 months ago) by girod Branch: MAIN CVS Tags: pregeonet, PRE_TOSNIC_FIX, PRE_64BIT, HEAD, CYCLOPS_RELEASE_CANDIDATE_2_0, CYCLOPS_PRERELEASE_STABLE, CENTROUTE_EMSTAR_SOCKETS, AMARSS_JR_DEPLOYMENT_6_05_07 Changes since 1.1: +6 -2 lines fixes from martin |
/*
*
* Copyright (c) 2005 The Regents of the University of California. All
* rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of the University 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 REGENTS 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.
*
*/
#include <ar.h>
#include <emrun/emrun.h>
/*
* ar_soundtest
*
* for testing with SPL meter
*/
void usage(char *name)
{
misc_print_usage
(name,
"",
" "
);
exit(1);
}
void ar_shutdown(void *data)
{
elog(LOG_WARNING, "shutdown called..");
exit(1);
}
ar_state_t _ar = {
flood_interface: "flood",
sensor_interface: "vxp",
sound_dev: "hw:%d,%d",
curr_temperature: 20,
gpio_channel: -1 ,
chirp_len: CHIRP_CHIPS*MOD_FACTOR*RANGE_FACTOR
};
int main(int argc, char **argv)
{
/* generic init */
misc_init(&argc, argv, CVSTAG);
_ar.next_seed = 10;
_ar.next_mod = 0;
_ar.next_nocomp = 1;
_ar.next_note = NULL;
misc_parse_option_as_int(&argc, argv, "mod", 0, &(_ar.next_mod));
misc_parse_option_as_int(&argc, argv, "seed", 0, &(_ar.next_seed));
/* parse platform */
_ar.platform = misc_parse_out_option(&argc, argv, "platform", 0);
misc_parse_option_as_int(&argc, argv, "gpio-channel", 0, &(_ar.gpio_channel));
int chirp_len = CHIRP_CHIPS*MOD_FACTOR;
_ar.next_chirp = g_new0(int16_t, chirp_len);
ar_pn_generate_chirp(_ar.next_chirp, chirp_len, _ar.next_seed, _ar.next_mod, 1.0);
/* turn on amplifier via GPIO */
ar_amplifier_enable(&(_ar), 1);
if (misc_args_remain(&argc, argv))
usage(argv[0]);
while (1) {
ar_emit_current_chirp(&_ar, 1);
}
return 0;
}
| CENS CVS Mailing List |
Powered by ViewCVS 0.9.2 |