ECRobot C++ API for LEGO MINDSTORMS NXT  1.0.10
device/I2c.h
00001 //
00002 // I2c.h
00003 //
00004 // Copyright 2009 by Takashi Chikamasa, Jon C. Martin and Robert W. Kramer
00005 //
00006 
00007 #ifndef I2C_H_
00008 #define I2C_H_
00009 
00010 #include "Port.h"
00011 
00012 extern "C"
00013 {
00014         #include "ecrobot_interface.h"
00015         #include "rtoscalls.h"
00016 };
00017 
00018 namespace ecrobot
00019 {
00058 class I2c
00059 {
00060 public:
00070         explicit I2c(ePortS port, ePower power=POWER_LOWSPEED);
00071 
00077         virtual ~I2c(void);
00078 
00086         bool send(U32 address, U8* data, U32 length);
00087 
00095         bool receive(U32 address, U8* data, U32 length) const;
00096 
00097 protected:
00103         inline ePortS getPort(void) const { return mPort; }
00104 
00105 private:
00106         ePortS mPort;
00107 };
00108 }
00109 
00110 #endif
 All Classes Files Functions Variables Enumerations Enumerator Friends Defines