Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TCTF_Control_Main by
Diff: MCP23008/MCP23008.h
- Revision:
- 0:a28a1035c31b
- Child:
- 1:0182b86f9bd4
diff -r 000000000000 -r a28a1035c31b MCP23008/MCP23008.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MCP23008/MCP23008.h Mon Jan 22 20:11:52 2018 +0000
@@ -0,0 +1,52 @@
+#include "mbed.h"
+
+class MCP23008 {
+public:
+
+ /** Constructor
+ *
+ * @param sda I2C sda pin
+ * @param scl I2C scl pin
+ * @param address The hardware address of the MCP23008. This is the 3-bit
+ * value that is physically set via A0, A1, and A2.
+ * @param freq The I2C frequency.
+ */
+
+ MCP23008(PinName sda, PinName scl, uint8_t address, int freq);
+
+ /** Setup the port direction of each of the pins
+ *
+ */
+
+ void init();
+
+
+ /** Write to the output pins.
+ *
+ * This function is used to set output pins on or off.
+ *
+ * @param chnl The GPIO pin to set
+ * @param values A bitmask indicating whether a pin should be on or off.
+ */
+
+ void writeOutput(int chnl, bool val);
+
+
+ /** Sets I2C address
+ *
+ * This function is used to set the I2C address
+ *
+ * @param address The I2C address
+ */
+
+ void setAddress(int address);
+
+
+private:
+ I2C i2c;
+
+ uint8_t addrI2C;
+
+ uint8_t GPIO_Pin_Status;
+};
+
