Exemplo n.º 1
0
/* Initialize the PIR motion detection sensor on a given GPIO pin, 0 on success */
int pirmtn_init(uint8_t pin)
{
    if (!bcm2835_init()) {
        return 1;
    }

    // Set PIN to be an input
    bcm2835_gpio_fsel(pin, BCM2835_GPIO_FSEL_INPT);

    // with a pulldown
    bcm2835_gpio_set_pud(pin, BCM2835_GPIO_PUD_DOWN);

    // And a rising edge detect enable
    bcm2835_gpio_aren(pin);

    // Wait little while for the init jitter on the GPIO
    delay(500);

    // Now clear the eds flag by setting it to 1
    bcm2835_gpio_set_eds(pin);

    // Set the given pin as our static default one
    pirmtn_pin = pin;

    return 0;
}
Exemplo n.º 2
0
static PyObject *
PyBCM2835_gpio_aren(PyObject *self, PyObject *args)
{
	uint8_t pin;

	if (!PyArg_ParseTuple(args,"i",&pin)) {
		return NULL;
	}

	bcm2835_gpio_aren(pin);

	Py_RETURN_NONE;
}
Exemplo n.º 3
0
/**
 * @brief Enables detection of rising  edge interrupt.
 * @param pin Pin to be configured, Available pin definitons are defined in the Utitlies.h
 * @return none
 */
void EnableDetectRisingInterrupt(PIN_t pin)
{
	bcm2835_gpio_aren(pin);		//enable rising edge detect on pin
}
//void bcm2835_gpio_aren(uint8_t pin);
/// Call bcm2835_gpio_aren with 1 parameter
/// \par            Refer
/// \par            Modify
void ope_gpio_aren(void)
{
    get_byte_code();
    bcm2835_gpio_aren( *((uint8_t *)(buff+1)) );
}