Rivian Irvine Team / Mbed 2 deprecated TCTF_Control_Main

Dependencies:   MODSERIAL mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MCP23008.h Source File

MCP23008.h

00001 #include "mbed.h"
00002 
00003 class MCP23008 {
00004 public:
00005 
00006     /** Constructor
00007      *
00008      * @param sda I2C sda pin
00009      * @param scl I2C scl pin
00010      * @param address The hardware address of the MCP23008. This is the 3-bit
00011      * value that is physically set via A0, A1, and A2.
00012      * @param freq The I2C frequency.
00013      */
00014 
00015      MCP23008(PinName sda, PinName scl, uint8_t address, int freq);
00016 
00017      /** Setup the port direction of each of the pins
00018      *
00019      */
00020 
00021      void init();
00022 
00023 
00024      /** Write to the output pins.
00025      *
00026      * This function is used to set output pins on or off.
00027      *
00028      * @param val The GPIO channels to turn on
00029      */
00030 
00031      int writeOutput(int chn1, int chn2, int chn3, int chn4);
00032 
00033 
00034      /** Sets I2C address
00035      *
00036      * This function is used to set the I2C address
00037      *
00038      * @param address The I2C address
00039      */
00040 
00041      void setAddress(int address);
00042 
00043 
00044 private:
00045     I2C i2c;
00046 
00047     uint8_t addrI2C;
00048 
00049     uint8_t GPIO_Pin_Status;
00050 };
00051