예제 #1
0
int gpio_get_value(unsigned gpio)
{
#ifdef AXP_GPIO
	if (gpio >= SUNXI_GPIO_AXP0_START)
		return axp_gpio_get_value(gpio - SUNXI_GPIO_AXP0_START);
#endif
	return sunxi_gpio_input(gpio);
}
예제 #2
0
파일: gpio.c 프로젝트: 1ntroVert/OLINUXINO
/**
 * Read value of the pin configured as input. If its output raises exception.
 * 
 * @param self
 * @param args GPIO number
 * @return value of the given pin
 */
static PyObject* py_input(PyObject* self, PyObject* args) {

    int gpio;
    int ret;

    /* Parse argument. One integer is required */
    if (!PyArg_ParseTuple(args, "i", &gpio))
        return NULL;
    
    /* Read value */
    ret = sunxi_gpio_input(gpio);
    if (ret < 0) {
        return PyErr_SetFromErrno(PyExc_IOError);
    }

    /* Return read value */
    return Py_BuildValue("i", ret);
}
예제 #3
0
int gpio_get_value(unsigned gpio)
{
	return sunxi_gpio_input(gpio);
}
예제 #4
0
/*
 * digitalRead:
 *	Read the value of a given Pin, returning HIGH or LOW
 *********************************************************************************
 */
int digitalRead(int pin)
{
  return(sunxi_gpio_input(pinWiringOli(pin)));
}
예제 #5
0
int gpio_direction_input(unsigned gpio)
{
	sunxi_gpio_set_cfgpin(gpio, SUNXI_GPIO_INPUT);

	return sunxi_gpio_input(gpio);
}