IMU Ethernet initial commit

Dependencies:   F7_Ethernet MadgwickAHRS mbed

TCA9548.h

Committer:
rctaduio
Date:
2016-10-06
Revision:
1:7d5d767744cd
Parent:
0:80a695ae3cc3

File content as of revision 1:7d5d767744cd:

#ifndef TCA9548_H
#define TCA9548_H

// Includes
#include "mbed.h"

 
//Constants

 
 
class TCA9548 
{
    //data members
    protected:
     
    public:
     
     
    private:
    uint8_t addr;
     
    //functions
    protected:
     
    public:
     
    TCA9548(uint8_t address = 0x70)
    {
         //MBED uses 8 bit address, most devices use 7 bit address, so need to shift
         addr = address << 1;         
    } // end of constructor    
     
    void setAddr(uint8_t address)
    {
         addr = address;
    } // end of setAddr
     
    void addrSelect(uint8_t ch)
    {
        //address range is 0-7
        if (ch > 7) return;
        char ch_s[1];
        ch_s[0] = 1 << ch;
        
        i2c.write(addr, ch_s, 1);
     
    } // end of addrSelect
     
    private:
     
};// end of class





#endif