Updated to match the new sensors API

This commit is contained in:
nifi 2010-01-14 18:18:51 +00:00
parent e1c6c4993a
commit 67ae9fe26a
3 changed files with 15 additions and 17 deletions

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* @(#)$Id: beeper.c,v 1.2 2008/07/08 12:54:41 nifi Exp $ * @(#)$Id: beeper.c,v 1.3 2010/01/14 18:18:51 nifi Exp $
*/ */
#include "contiki-esb.h" #include "contiki-esb.h"
@ -67,7 +67,7 @@ PROCESS_THREAD(beeper_process, ev, data)
etimer_set(&etimer, CLOCK_SECOND / 2); etimer_set(&etimer, CLOCK_SECOND / 2);
PT_INIT(&beeper_pt); PT_INIT(&beeper_pt);
button_sensor.activate(); button_sensor.configure(SENSORS_ACTIVE, 1);
while(1) { while(1) {

View File

@ -26,14 +26,14 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: blinker.c,v 1.2 2007/11/28 20:31:30 nifi Exp $ * $Id: blinker.c,v 1.3 2010/01/14 18:18:51 nifi Exp $
* *
* ----------------------------------------------------------------- * -----------------------------------------------------------------
* *
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
* Created : 2006-08-28 * Created : 2006-08-28
* Updated : $Date: 2007/11/28 20:31:30 $ * Updated : $Date: 2010/01/14 18:18:51 $
* $Revision: 1.2 $ * $Revision: 1.3 $
*/ */
#include "contiki-esb.h" #include "contiki-esb.h"
@ -52,9 +52,9 @@ PROCESS_THREAD(blinker_process, ev, data)
etimer_stop(&pir_timer); etimer_stop(&pir_timer);
etimer_stop(&vib_timer); etimer_stop(&vib_timer);
etimer_set(&etimer, CLOCK_SECOND * 4); etimer_set(&etimer, CLOCK_SECOND * 4);
button_sensor.activate(); button_sensor.configure(SENSORS_ACTIVE, 1);
vib_sensor.activate(); vib_sensor.configure(SENSORS_ACTIVE, 1);
pir_sensor.activate(); pir_sensor.configure(SENSORS_ACTIVE, 1);
while(1) { while(1) {

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: fft-test.c,v 1.2 2008/04/25 22:12:25 joxe Exp $ * $Id: fft-test.c,v 1.3 2010/01/14 18:18:51 nifi Exp $
* *
* ----------------------------------------------------------------- * -----------------------------------------------------------------
* fft-test - a test program that use the sound sensor for sampling * fft-test - a test program that use the sound sensor for sampling
@ -35,8 +35,8 @@
* *
* Author : Joakim Eriksson * Author : Joakim Eriksson
* Created : 2008-04-04 * Created : 2008-04-04
* Updated : $Date: 2008/04/25 22:12:25 $ * Updated : $Date: 2010/01/14 18:18:51 $
* $Revision: 1.2 $ * $Revision: 1.3 $
*/ */
#include "contiki-esb.h" #include "contiki-esb.h"
@ -65,12 +65,10 @@ PROCESS_THREAD(fft_process, ev, data)
PROCESS_BEGIN(); PROCESS_BEGIN();
etimer_set(&etimer, CLOCK_SECOND * 4); etimer_set(&etimer, CLOCK_SECOND * 4);
button_sensor.activate(); button_sensor.configure(SENSORS_ACTIVE, 1);
/* start and configure the sound sensor for sampling */ /* start and configure the sound sensor for sampling */
sound_sensor.activate(); sound_sensor.configure(SENSORS_ACTIVE, 1);
sound_sensor.configure(SOUND_SET_BUFFER_PTR, fftBuf); sound_sensor_set_buffer(fftBuf, FFT_TEST_SIZE, 1);
sound_sensor.configure(SOUND_SET_BUFFER_SIZE, (void *) FFT_TEST_SIZE);
sound_sensor.configure(SOUND_SET_DIV, (void *) 1);
while(1) { while(1) {
PROCESS_WAIT_EVENT(); PROCESS_WAIT_EVENT();
@ -124,7 +122,7 @@ PROCESS_THREAD(fft_process, ev, data)
} else if(ev == PROCESS_EVENT_TIMER) { } else if(ev == PROCESS_EVENT_TIMER) {
if(data == &etimer) { if(data == &etimer) {
if(on) { if(on) {
sound_sensor.configure(SOUND_START_SAMPLE, NULL); sound_sensor_start_sample();
leds_off(LEDS_ALL); leds_off(LEDS_ALL);
} }
etimer_set(&etimer, CLOCK_SECOND / 2); etimer_set(&etimer, CLOCK_SECOND / 2);