mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
adafruitss: renamed to adafruit pca9685 servo shield
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
2725342c19
commit
f53d8e79cc
@ -100,7 +100,7 @@ add_executable (at42qt1070-example at42qt1070.cxx)
|
||||
add_executable (grovemd-example grovemd.cxx)
|
||||
add_executable (pca9685-example pca9685.cxx)
|
||||
add_executable (groveeldriver-example groveeldriver.cxx)
|
||||
add_executable (pca9685ss-example pca9685ss.cxx)
|
||||
add_executable (adafruitss-example adafruitss.cxx)
|
||||
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/hmc5883l)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grove)
|
||||
@ -182,6 +182,7 @@ include_directories (${PROJECT_SOURCE_DIR}/src/at42qt1070)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovemd)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/pca9685)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/groveeldriver)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/adafruitss)
|
||||
|
||||
target_link_libraries (hmc5883l-example hmc5883l ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveled-example grove ${CMAKE_THREAD_LIBS_INIT})
|
||||
@ -283,4 +284,4 @@ target_link_libraries (at42qt1070-example at42qt1070 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovemd-example grovemd ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (pca9685-example pca9685 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveeldriver-example groveeldriver ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (pca9685ss-example pca9685 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (adafruitss-example adafruitss ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include "pca9685ss.h"
|
||||
#include "adafruitss.h"
|
||||
#include <unistd.h>
|
||||
|
||||
using namespace std;
|
||||
@ -43,7 +43,7 @@ int main() {
|
||||
int n;
|
||||
|
||||
//! [Interesting]
|
||||
upm::pca9685ss* servos = new upm::pca9685ss(6,0x40);
|
||||
upm::adafruitss* servos = new upm::adafruitss(6,0x40);
|
||||
|
||||
for (;;)
|
||||
{
|
5
src/adafruitss/CMakeLists.txt
Normal file
5
src/adafruitss/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
set (libname "adafruitss")
|
||||
set (libdescription "upm Adafruit pca9685 based 16-channel servo shield")
|
||||
set (module_src ${libname}.cxx)
|
||||
set (module_h ${libname}.h)
|
||||
upm_module_init()
|
@ -22,13 +22,13 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "pca9685ss.h"
|
||||
#include "adafruitss.h"
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
|
||||
using namespace upm;
|
||||
|
||||
pca9685ss::pca9685ss(int bus,int i2c_address)
|
||||
adafruitss::adafruitss(int bus,int i2c_address)
|
||||
{
|
||||
int n;
|
||||
int result;
|
||||
@ -44,13 +44,13 @@ pca9685ss::pca9685ss(int bus,int i2c_address)
|
||||
m_rx_tx_buf[1]=0;
|
||||
result=mraa_i2c_write(m_i2c,m_rx_tx_buf,2);
|
||||
|
||||
pca9685ss::setPWMFreq(60);
|
||||
adafruitss::setPWMFreq(60);
|
||||
|
||||
|
||||
pca9685ss::update();
|
||||
adafruitss::update();
|
||||
}
|
||||
|
||||
void pca9685ss::setPWMFreq(float freq) {
|
||||
void adafruitss::setPWMFreq(float freq) {
|
||||
int result;
|
||||
freq *= 0.88; // Correct for overshoot in the frequency setting (see issue #11).
|
||||
float prescaleval = 25000000;
|
||||
@ -101,13 +101,13 @@ void pca9685ss::setPWMFreq(float freq) {
|
||||
result=mraa_i2c_write(m_i2c,m_rx_tx_buf,2);
|
||||
}
|
||||
|
||||
int pca9685ss::update(void)
|
||||
int adafruitss::update(void)
|
||||
{
|
||||
return MRAA_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void pca9685ss::servo(uint8_t port, uint8_t servo_type, uint16_t degrees) {
|
||||
void adafruitss::servo(uint8_t port, uint8_t servo_type, uint16_t degrees) {
|
||||
// Set Servo values
|
||||
// Degrees is from 0 to 180
|
||||
// servo_type: 0 = standard 1ms to 2ms
|
@ -56,8 +56,8 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief pca9685 based servo controller
|
||||
* @defgroup pca9685 libupm-pca9685
|
||||
* @brief Adafruit PCA9685 based servo controller
|
||||
* @defgroup adafruitss libupm-adafruitss
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -66,17 +66,17 @@ namespace upm {
|
||||
* Adafruit do recommend a capacitor be installed on the board which should alleviate the issue. Sizing depends on servos and count.
|
||||
*
|
||||
* @ingroup i2c
|
||||
* @snippet pca9685ss.cxx Interesting
|
||||
* @snippet adafruitss.cxx Interesting
|
||||
*/
|
||||
class pca9685ss {
|
||||
class adafruitss {
|
||||
public:
|
||||
/**
|
||||
* Creates a pca9685ss object
|
||||
* Creates a adafruitss object
|
||||
*
|
||||
* @param bus number of used i2c bus
|
||||
* @param i2c_address address of servo controller on i2c bus
|
||||
*/
|
||||
pca9685ss(int bus, int i2c_address);
|
||||
adafruitss(int bus, int i2c_address);
|
||||
int update(void);
|
||||
/**
|
||||
* Sets the frequency for your servos
|
7
src/adafruitss/jsupm_adafruitss.i
Normal file
7
src/adafruitss/jsupm_adafruitss.i
Normal file
@ -0,0 +1,7 @@
|
||||
%module jsupm_adafruitss
|
||||
%include "../upm.i"
|
||||
|
||||
%include "adafruitss.h"
|
||||
%{
|
||||
#include "adafruitss.h"
|
||||
%}
|
9
src/adafruitss/pyupm_adafruitss.i
Normal file
9
src/adafruitss/pyupm_adafruitss.i
Normal file
@ -0,0 +1,9 @@
|
||||
%module pyupm_adafruitss
|
||||
%include "../upm.i"
|
||||
|
||||
%feature("autodoc", "3");
|
||||
|
||||
%include "adafruitss.h"
|
||||
%{
|
||||
#include "adafruitss.h"
|
||||
%}
|
@ -1,7 +0,0 @@
|
||||
%module jsupm_pca9685
|
||||
%include "../upm.i"
|
||||
|
||||
%include "pca9685ss.h"
|
||||
%{
|
||||
#include "pca9685ss.h"
|
||||
%}
|
@ -1,9 +0,0 @@
|
||||
%module pyupm_pca9685
|
||||
%include "../upm.i"
|
||||
|
||||
%feature("autodoc", "3");
|
||||
|
||||
%include "pca9685ss.h"
|
||||
%{
|
||||
#include "pca9685ss.h"
|
||||
%}
|
Loading…
x
Reference in New Issue
Block a user