Finish most of the uart stuff.
I've decided to push this, even though I can't test it.
That worries me a little. Use it with caution.
Implement GPIO stuff, and a main executable to receive uart
data. Also make some modifications to Brian's stuff, to get it to
build correctly.
Finally, add some testing stuff. Feel free to disregard that.
I probably won't be using it until I get debian flashed onto
my BeagleBone Black.
diff --git a/bbb_cape/src/bbb/gpios.h b/bbb_cape/src/bbb/gpios.h
new file mode 100644
index 0000000..1494da2
--- /dev/null
+++ b/bbb_cape/src/bbb/gpios.h
@@ -0,0 +1,40 @@
+#ifndef BBB_CAPE_SRC_BBB_CAPE_CONTROL_H_
+#define BBB_CAPE_SRC_BBB_CAPE_CONTROL_H_
+
+#include <cstdint>
+#include <cstring>
+
+// As it turns out, controlling the BBB's GPIO pins
+// from C++ is kind of a pain. The purpose of this
+// code is to provide a simple wrapper that masks
+// all the ugly stuff and exposes a nice API.
+
+// Based on example from
+// <http://learnbuildshare.wordpress.com/2013/05/29/beaglebone-black-digital-ouput/>
+
+namespace bbb {
+
+class Pin {
+ FILE *handle_;
+ int direction_;
+ int kernel_pin_;
+ bool exported_;
+
+ int DoPinDirSet(int direction);
+ int DoExport();
+
+public:
+ // Here, for example, if you wanted to use
+ // GPIO1_28, you would give the ctor
+ // 1, 28 as arguments.
+ Pin(int bank, int pin);
+ ~Pin();
+ int MakeInput();
+ int MakeOutput();
+ int Write(uint8_t value);
+ int Read();
+};
+
+} // bbb
+
+#endif