working DSM2 library and DSM2tester

This commit is contained in:
Brendan Haines 2015-03-16 18:06:01 -06:00
parent 99e929ece7
commit 93e4d90269
2 changed files with 11 additions and 4 deletions

View File

@ -5,14 +5,21 @@
#define VALUE_MASK 0x3FF #define VALUE_MASK 0x3FF
DSM2::DSM2( int mode ) DSM2::DSM2()
{ {
std::cout << "opening serial port..." << std::flush; std::cout << "opening serial port..." << std::flush;
fd = serialOpen( "/dev/ttyAMA0", 115200 ); fd = serialOpen( "/dev/ttyAMA0", 115200 );
std::cout << "SUCCESS " << fd << std::endl; if( fd < 0 )
{
std::cout << "FAILURE" << std::endl;
}
else
{
std::cout << "SUCCESS " << fd << std::endl;
}
std::cout << "flushing serial..." << std::flush; std::cout << "flushing serial..." << std::flush;
serialFlush(fd); serialFlush(fd);
std::cout << "SUCCESS" << std::endl; std::cout << "DONE" << std::endl;
} }
void DSM2::update() void DSM2::update()

View File

@ -4,7 +4,7 @@
class DSM2 class DSM2
{ {
public: public:
DSM2( int mode = 1024 ); DSM2();
void update(); void update();
int values[7]; int values[7];