-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRobovero.h
More file actions
72 lines (63 loc) · 1.92 KB
/
Robovero.h
File metadata and controls
72 lines (63 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* Robovero.h
*
* Robovero class header to communicate with the Gumstix Robovero expansion board
*
* This class is basically a conversion of the python code written by Neil
* MacMunn (neil@gumstix.com) at Gumstix.
* https://github.com/robovero
*
*
* Andrew C. Smith
* acsmith@stanford.edu
* Aerospace Robotics Lab
* Stanford University
*
* v1.2 June 26 2013
*
*/
#ifndef Robovero_H
#define Robovero_H
#include <pthread.h>
#include <time.h>
#include <string>
#include <map>
using namespace std;
class Robovero
{
int log;
bool debug;
pthread_t threadReader;
int readerID;
time_t start_time;
map <string,int> functionDict;
public:
// serialPort and message are public so thread can access them
int serialPort;
char message[256];
// returns up to num_return integers in the response into return_values buffer and returns the actual amount returned
int getReturn(int num_return, unsigned int* return_values);
// makes calls to the robovero functions, expects no return
int robocaller(char* function, unsigned int* args, int num_args);
// makes calls to the robovero functions, return values are placed in return_values
int robocaller(char* function, int num_return, unsigned int* return_values, unsigned int* args, int num_args);
// allocate memory and return address
void* malloc(unsigned int size);
// free memory
void free(void* ptr);
// retrieve value at address (deref)
//unsigned char read(void* ptr, unsigned int width);
// return single byte or two bytes
unsigned char readC(void* ptr);
unsigned short readS(void *ptr);
// store data at address
//void store(void* ptr, unsigned int width, unsigned char data);
void store(void* ptr, unsigned char data);
Robovero (const char* port);
Robovero (const char* port, const char* logFile);
~Robovero ();
private:
int getMessage(char* buffer);
void init(const char* port);
};
#endif