Created
August 27, 2014 17:47
-
-
Save anonymous/c2c54905f4ae2b866f40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef ROS_ARDUINO_HARDWARE_H_ | |
#define ROS_ARDUINO_HARDWARE_H_ | |
#include "../Adafruit_CC3000_Library_master/Adafruit_CC3000.h" | |
#if ARDUINO>=100 | |
#include <Arduino.h> // Arduino 1.0 | |
#else | |
#include <WProgram.h> // Arduino 0022 | |
#endif | |
#define DEFAULT_PORTNUM 11411 | |
class ArduinoHardware { | |
public: | |
ArduinoHardware(char *pn, long baud= 57600) | |
{ | |
baud_ = baud; | |
} | |
ArduinoHardware() // focus on this one since this is the only one being called from examples. | |
{ | |
this->client = NULL; | |
baud_ = 57600; | |
} | |
ArduinoHardware(ArduinoHardware& h) | |
{ | |
this->baud_ = h.baud_; | |
} | |
void setBaud(long baud) | |
{ | |
this->baud_= baud; | |
} | |
int getBaud() | |
{ | |
return this->baud_; | |
} | |
void init() | |
{ | |
// I think the purpose of this function is to set up the client. | |
} | |
void myinit(Adafruit_CC3000& cc3000, uint32_t destIP, uint16_t destPort = DEFAULT) | |
{ | |
client = cc3000.connectTCP(destIP, destPort); | |
} | |
int read() | |
{ | |
return this->client.read(); | |
}; | |
void write(uint8_t* data, int length){ | |
this->client.write(data, length); | |
} | |
unsigned long time() | |
{ | |
return millis(); | |
} | |
protected: | |
long baud_; | |
Adafruit_CC3000_Client client; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment