1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/driver_pir
Lucas Jenss 426170b064 Improve naming of thread stacksize/priority constants
As discussed in #2725, this commit renames a number of stacksize constants to
better convey their intended usage. In addition, constants for thread priority
are given a `THREAD_` prefix. Changes are:

* KERNEL_CONF_STACKSIZE_PRINTF renamed to THREAD_EXTRA_STACKSIZE_PRINTF
* KERNEL_CONF_STACKSIZE_DEFAULT renamed to THREAD_STACKSIZE_DEFAULT
* KERNEL_CONF_STACKSIZE_IDLE renamed to THREAD_STACKSIZE_IDLE
* KERNEL_CONF_STACKSIZE_MAIN renamed to THREAD_STACKSIZE_MAIN
* Move thread stacksizes from kernel.h to thread.h, since the prefix changed
* PRIORITY_MIN renamed to THREAD_PRIORITY_MIN
* PRIORITY_IDLE renamed to THREAD_PRIORITY_IDLE
* PRIORITY_MAIN renamed to THREAD_PRIORITY_MAIN
* Move thread priorities from kernel.h to thread.h since the prefix has changed
* MINIMUM_STACK_SIZE renamed to THREAD_STACKSIZE_MINIMUM for consistency
2015-05-21 00:14:23 +02:00
..
main.c Improve naming of thread stacksize/priority constants 2015-05-21 00:14:23 +02:00
Makefile tests/driver_pir: set default GPIO 2014-10-06 18:55:54 +02:00
README.md drivers: import PIR motion sensor driver 2014-09-26 18:07:46 +02:00

About

This is a manual test application for the PIR motion sensor driver.

In order to build this application, you need to add the board to the Makefile's WHITELIST first and define a pin mapping (see below).

Usage

There are two ways to test this. You can either actively poll the sensor state, or you can register a thread which receives messages for state changes.

Interrupt driven

Connect the sensor's "out" pin to a GPIO of your board that can be configured to create interrupts. Compile and flash this test application like:

export BOARD=your_board
export PIR_GPIO=name_of_your_pin
make clean
make all-interrupt
make flash

The output should look like:

kernel_init(): jumping into first task...

PIR motion sensor test application

Initializing PIR sensor at GPIO_8... [OK]

Registering PIR handler thread...     [OK]
PIR handler got a message: the movement has ceased.
PIR handler got a message: something started moving.
PIR handler got a message: the movement has ceased.

Polling Mode

Connect the sensor's "out" pin to any GPIO pin of you board. Compile and flash this test application like:

export BOARD=your_board
export PIR_GPIO=name_of_your_pin
make clean
make all-polling
make flash

The output should look like this:

kernel_init(): jumping into first task...
PIR motion sensor test application

Initializing PIR sensor at GPIO_10... [OK]

Printing sensor state every second.
Status: lo
...
Status: lo
Status: hi
...