Esempio n. 1
0
void edge_detect_test(uint8_t pin, uint8_t  mode)
{
	switch(mode)
	{
		case LOW_MODE:/*low level detect*/
			bcm2835_gpio_len(pin);
			printf("Start to detect the low level on the Phy07!\n");
			while(1)
			{
				if(bcm2835_gpio_eds(pin))
				{
					printf("Phy07:Low level has been detected !\n");
					break;
				}
			}
		break;
		case HIGH_MODE:/*high level detect*/
			bcm2835_gpio_hen(pin);
			printf("Start to detect the High level on the Phy07!\n");
			while(1)
			{
				if(bcm2835_gpio_eds(pin))
				{
					printf("Phy07:High level has been detected !\n");
					break;
				}
			}			
		break;
		case FALLING_MODE:/*falling detect*/
			bcm2835_gpio_fen(pin);
			printf("Start to detect the falling on the Phy07!\n");
			while(1)
			{
				if(bcm2835_gpio_eds(pin))
				{
					printf("Phy07: Falling has been detected !\n");
					break;
				}
			}
		break;
		case RISING_MODE:/*rising detect*/
			bcm2835_gpio_ren(pin);
			printf("Start to detect the rising on the Phy07!\n");
			while(1)
			{
				if(bcm2835_gpio_eds(pin))
				{
					printf("Phy07:Rising has been detected !\n");
					break;
				}
			}
		break;
	}
}
Esempio n. 2
0
static PyObject *
PyBCM2835_gpio_fen(PyObject *self, PyObject *args)
{
	uint8_t pin;

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

	bcm2835_gpio_fen(pin);

	Py_RETURN_NONE;
}
//void bcm2835_gpio_fen(uint8_t pin);
/// Call bcm2835_gpio_fen with 1 parameter
/// \par            Refer
/// \par            Modify
void ope_gpio_fen(void)
{
    get_byte_code();
    bcm2835_gpio_fen( *((uint8_t *)(buff+1)) );
}