2 * Copyright Droids Corporation, Microb Technology, Eirbot (2005)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Revision : $Id: main.c,v 1.2.2.3 2007-05-23 17:18:13 zer0 Exp $
23 #include <aversive/wait.h>
26 #include <avr/pgmspace.h>
33 struct biquad_filter filter;
36 // filter as in the wiki documentation
38 biquad_set_numerator_coeffs (&filter, 5, 10, 5);
39 biquad_set_deniminator_coeffs(&filter,-400, 164);
40 biquad_set_divisor_shifts(&filter, 8, 8);
44 fdevopen(uart0_dev_send, NULL, 0);
50 int32_t noise, filtered_noise;
52 // generate white noise (is rand a white noise ??)
53 noise = rand() / (RAND_MAX /100); // from 0 to 100
56 filtered_noise = biquad_do_filter(& filter, noise);
58 // output in a logging format : n10f30\n
59 printf_P(PSTR("n%lif%li\n"), noise, filtered_noise);