mirror of
https://github.com/eclipse/upm.git
synced 2025-03-24 17:30:01 +03:00
Adafruitms1438: Add string based constructor
This commit is contained in:
parent
cdc60a5f1a
commit
7ec90e96af
@ -35,6 +35,21 @@ using namespace std;
|
|||||||
|
|
||||||
AdafruitMS1438::AdafruitMS1438(int bus, uint8_t address) :
|
AdafruitMS1438::AdafruitMS1438(int bus, uint8_t address) :
|
||||||
m_pca9685(new PCA9685(bus, address))
|
m_pca9685(new PCA9685(bus, address))
|
||||||
|
{
|
||||||
|
initAdafruitMS1438();
|
||||||
|
}
|
||||||
|
|
||||||
|
AdafruitMS1438::AdafruitMS1438(std::string initStr) : m_pca9685(new PCA9685(initStr))
|
||||||
|
{
|
||||||
|
initAdafruitMS1438();
|
||||||
|
}
|
||||||
|
|
||||||
|
AdafruitMS1438::~AdafruitMS1438()
|
||||||
|
{
|
||||||
|
delete m_pca9685;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AdafruitMS1438::initAdafruitMS1438()
|
||||||
{
|
{
|
||||||
setupPinMaps();
|
setupPinMaps();
|
||||||
|
|
||||||
@ -56,11 +71,6 @@ AdafruitMS1438::AdafruitMS1438(int bus, uint8_t address) :
|
|||||||
stepConfig(STEPMOTOR_M34, 200);
|
stepConfig(STEPMOTOR_M34, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
AdafruitMS1438::~AdafruitMS1438()
|
|
||||||
{
|
|
||||||
delete m_pca9685;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdafruitMS1438::initClock(STEPMOTORS_T motor)
|
void AdafruitMS1438::initClock(STEPMOTORS_T motor)
|
||||||
{
|
{
|
||||||
gettimeofday(&m_stepConfig[motor].startTime, NULL);
|
gettimeofday(&m_stepConfig[motor].startTime, NULL);
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <mraa/i2c.h>
|
#include <mraa/i2c.h>
|
||||||
#include <mraa/gpio.h>
|
#include <mraa/gpio.h>
|
||||||
|
#include <mraa/initio.hpp>
|
||||||
|
|
||||||
#include "pca9685.hpp"
|
#include "pca9685.hpp"
|
||||||
|
|
||||||
@ -104,11 +105,23 @@ namespace upm {
|
|||||||
*/
|
*/
|
||||||
AdafruitMS1438(int bus, uint8_t address = ADAFRUITMS1438_DEFAULT_I2C_ADDR);
|
AdafruitMS1438(int bus, uint8_t address = ADAFRUITMS1438_DEFAULT_I2C_ADDR);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates AdafruitMS1438 based on a given string.
|
||||||
|
*
|
||||||
|
* @param initStr string containing specific information for AdafruitMS1438 initialization.
|
||||||
|
*/
|
||||||
|
AdafruitMS1438(std::string initStr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdafruitMS1438 destructor
|
* AdafruitMS1438 destructor
|
||||||
*/
|
*/
|
||||||
~AdafruitMS1438();
|
~AdafruitMS1438();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdafruitMS1438 initialization method
|
||||||
|
*/
|
||||||
|
void initAdafruitMS1438();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of milliseconds elapsed since initClock(...)
|
* Returns the number of milliseconds elapsed since initClock(...)
|
||||||
* was last called.
|
* was last called.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user