Steven Kay
/
MCP9803_NUCLEO_Driver
Initial I2C Working
Diff: MCP9803/MCP9803.h
- Revision:
- 0:fbf82bf637bb
- Child:
- 1:444546e8cd20
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MCP9803/MCP9803.h Wed Mar 29 08:33:10 2017 +0000 @@ -0,0 +1,57 @@ +/******************************************************************************************** + + 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 \ No newline at end of file