Initial I2C Working

Dependencies:   mbed

MCP9803/MCP9803.h

Committer:
sk398
Date:
2017-03-29
Revision:
0:fbf82bf637bb
Child:
1:444546e8cd20

File content as of revision 0:fbf82bf637bb:

/********************************************************************************************

   Filename: MCP9803.h

   Original Author: Steven Kay

   Development Group: Autonomous Systems Group, RAL Space

   Original Creation Date: April 2017

   Description: <Desc>

   Revision History: Version 1.0 - Initial Release

 *********************************************************************************************/

#ifndef MCP9803_H
#define MCP9803_H

#include "mbed.h"

union CONFIG_REG
{
    struct
    {
        unsigned int SHUTDOWN_BIT: 1;
        unsigned int COMP_INT_BIT: 1;
        unsigned int ALERT_POLARITY_BIT: 1;
        unsigned int FAULT_QUEUE: 2;
        unsigned int ADC_RES: 2;
        unsigned int ONE_SHOT: 1;
    } CONFIG_BITS;
    
    uint8_t CONFIG_VALUE;
};

class MCP9803
{
    
public:
    MCP9803(PinName sda, PinName scl, int Address, int frequency);
    int ConfigSensor();
    int I2C_Write(char *dataOut,int dataLen);
    char *I2C_Read(int dataLen);

private:
    I2C *_I2C;
    int chipAddress;
    union CONFIG_REG CONFIG_REG_VALUE; 
        

protected:
  
    
};

#endif