/** * @ingroup GPIO * * Sets the Pull-up/down mode for the specified pin. * * @param pin GPIO number. * @param pud The desired Pull-up/down mode. One of BCM2835_GPIO_PUD_* from \ref bcm2835PUDControl */ void bcm2835_gpio_set_pud(const uint8_t pin, const uint8_t pud) { bcm2835_gpio_pud(pud); udelay(10); bcm2835_gpio_pudclk(pin, 1); udelay(10); bcm2835_gpio_pud(BCM2835_GPIO_PUD_OFF); bcm2835_gpio_pudclk(pin, 0); }
// Set the pullup/down resistor for a pin // // The GPIO Pull-up/down Clock Registers control the actuation of internal pull-downs on // the respective GPIO pins. These registers must be used in conjunction with the GPPUD // register to effect GPIO Pull-up/down changes. The following sequence of events is // required: // 1. Write to GPPUD to set the required control signal (i.e. Pull-up or Pull-Down or neither // to remove the current Pull-up/down) // 2. Wait 150 cycles ? this provides the required set-up time for the control signal // 3. Write to GPPUDCLK0/1 to clock the control signal into the GPIO pads you wish to // modify ? NOTE only the pads which receive a clock will be modified, all others will // retain their previous state. // 4. Wait 150 cycles ? this provides the required hold time for the control signal // 5. Write to GPPUD to remove the control signal // 6. Write to GPPUDCLK0/1 to remove the clock // // RPi has P1-03 and P1-05 with 1k8 pullup resistor void bcm2835_gpio_set_pud(uint8_t pin, uint8_t pud) { bcm2835_gpio_pud(pud); delayMicroseconds(10); bcm2835_gpio_pudclk(pin, 1); delayMicroseconds(10); bcm2835_gpio_pud(BCM2835_GPIO_PUD_OFF); bcm2835_gpio_pudclk(pin, 0); }
static PyObject * PyBCM2835_gpio_pudclk(PyObject *self, PyObject *args) { uint8_t pin; uint8_t on; if (!PyArg_ParseTuple(args,"ii",&pin,&on)) { return NULL; } bcm2835_gpio_pudclk(pin,on); Py_RETURN_NONE; }
//void bcm2835_gpio_pudclk(uint8_t pin, uint8_t on); /// Call bcm2835_gpio_pudclk with 1 parameter /// \par Refer /// \par Modify void ope_gpio_pudclk(void) { get_byte_code(); get_byte_code(); bcm2835_gpio_pudclk( *((uint8_t *)(buff+1)), *((uint8_t *)(buff+2)) ); }