Hi everyone,
we're working with the latest RTEMS in the Beaglebone and we're using the
GPIO api. We've added the code for configuring the pullup/pulldown resistor
in the Beaglebone. Could anyone give it a shoot?

-- 

<http://www.tallertechnologies.com>


Federico Garcia Cruz

Software Engineer


San Lorenzo 47, 3rd Floor, Office 5

Córdoba, Argentina


Phone: +54 351 4217888 / +54 351 4218211


<http://www.linkedin.com/company/taller-technologies>
<https://www.facebook.com/tallertechnologies>
diff --git a/c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c b/c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c
index bd26051..4dede50 100644
--- a/c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c
+++ b/c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c
@@ -269,8 +269,17 @@ rtems_status_code rtems_gpio_bsp_set_resistor_mode(
   uint32_t pin,
   rtems_gpio_pull_mode mode
 ) {
-  /* TODO: Add support for setting up resistor moode */
-  return RTEMS_NOT_DEFINED;
+
+  if (mode == PULL_UP) {
+    mmio_set(bbb_conf_reg(bank, pin), BBB_PU_EN);
+    mmio_clear(bbb_conf_reg(bank, pin), BBB_PUDEN);
+  } else if (mode == PULL_DOWN) {
+    mmio_clear(bbb_conf_reg(bank, pin), BBB_PU_EN);
+    mmio_clear(bbb_conf_reg(bank, pin), BBB_PUDEN);
+  } else {
+    mmio_set(bbb_conf_reg(bank, pin), BBB_PUDEN);
+  }
+  return RTEMS_SUCCESSFUL;
 }
 
 rtems_vector_number rtems_gpio_bsp_get_vector(uint32_t bank)
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to