Skip to content

Instantly share code, notes, and snippets.

Created August 27, 2014 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c2c54905f4ae2b866f40 to your computer and use it in GitHub Desktop.
Save anonymous/c2c54905f4ae2b866f40 to your computer and use it in GitHub Desktop.
#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