50 #include <sys/types.h> 55 #include "rnr/rnrconfig.h" 72 LaeMotorCtlrChipSelect::LaeMotorCtlrChipSelect()
78 LaeMotorCtlrChipSelect::~LaeMotorCtlrChipSelect()
83 int LaeMotorCtlrChipSelect::open(
int pinGpio)
85 if( (m_fdGpio = gpioOpen(pinGpio)) < 0 )
87 LOGERROR(
"Failed to open motor controllers chip select on GPIO pin %d.",
90 return -LAE_ECODE_NO_RSRC;
98 int LaeMotorCtlrChipSelect::close()
104 rc = gpioClose(m_fdGpio);
110 return rc == OK? LAE_OK: -LAE_ECODE_IO;
113 void LaeMotorCtlrChipSelect::select(
int fd, byte_t addrSel)
117 if( addrSel != m_addrLast )
119 value = addrSel == LaeMotorCtlrCsHigh? 1: 0;
120 if( gpioQuickWrite(m_fdGpio, value) < 0 )
122 LOGWARN(
"Failed to select motor controller 0x%02x.", addrSel);
126 RoboClawChipSelect::select(fd, addrSel);
RoboClaw motor controller class interface.
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
Laelaps motors, encoder, and controllers hardware abstraction interfaces.
Top-level package include file.