mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
Adafruitms1438: Add string based constructor
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
9db28cd4fc
commit
7b5b02d859
@ -35,6 +35,21 @@ using namespace std;
|
||||
|
||||
AdafruitMS1438::AdafruitMS1438(int bus, uint8_t 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();
|
||||
|
||||
@ -56,11 +71,6 @@ AdafruitMS1438::AdafruitMS1438(int bus, uint8_t address) :
|
||||
stepConfig(STEPMOTOR_M34, 200);
|
||||
}
|
||||
|
||||
AdafruitMS1438::~AdafruitMS1438()
|
||||
{
|
||||
delete m_pca9685;
|
||||
}
|
||||
|
||||
void AdafruitMS1438::initClock(STEPMOTORS_T motor)
|
||||
{
|
||||
gettimeofday(&m_stepConfig[motor].startTime, NULL);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <string>
|
||||
#include <mraa/i2c.h>
|
||||
#include <mraa/gpio.h>
|
||||
#include <mraa/initio.hpp>
|
||||
|
||||
#include "pca9685.hpp"
|
||||
|
||||
@ -104,11 +105,23 @@ namespace upm {
|
||||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
* AdafruitMS1438 initialization method
|
||||
*/
|
||||
void initAdafruitMS1438();
|
||||
|
||||
/**
|
||||
* Returns the number of milliseconds elapsed since initClock(...)
|
||||
* was last called.
|
||||
|
Loading…
x
Reference in New Issue
Block a user