Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Adafruit-PWM-Servo-Driver MPU6050 RS300 mbed
Diff: Motion.cpp
- Revision:
- 12:6cd135bf03bd
- Parent:
- 11:1539d181e159
- Child:
- 13:711f74b2fa33
diff -r 1539d181e159 -r 6cd135bf03bd Motion.cpp
--- a/Motion.cpp Sat Sep 22 10:24:14 2012 +0000
+++ b/Motion.cpp Sun Feb 03 04:53:44 2013 +0000
@@ -1,18 +1,18 @@
#include "Motion.h"
#include "PWM.h"
-extern PWM pwm;
extern Ticker tick;
+PWM pwm;
Motion::Motion(uint16_t** data, unsigned short int size_idx, unsigned char size_num)
{
+ //pwm = new PWM();
+
m_data = data;
- //data size
m_IDX_MAX = size_idx;
- m_NUM_MAX = size_num -1;
-
- //interpolate num
+ m_NUM_MAX = size_num - 1;
+
for(int i = 0; i < m_IDX_MAX; ++i) {
m_data_num[i] = data[i][m_NUM_MAX];
}
@@ -20,7 +20,6 @@
m_mode = 1;
m_in_interrupt = false;
- //zero clear
m_idx = 0;
m_play = 0;
@@ -32,6 +31,11 @@
m_brake_flg = 0.0;
}
+Motion::~Motion()
+{
+ //delete pwm;
+}
+
void Motion::step()
{
if (m_idx < m_IDX_MAX - 1) {
@@ -97,6 +101,7 @@
m_dd_buf[i] = 0.0;
__disable_irq();
+ //pwm->SetDuty(i, (uint32_t)m_buf[i]);
pwm.SetDuty(i, (uint32_t)m_buf[i]);
__enable_irq();
}
@@ -113,6 +118,7 @@
m_buf[i] += m_d_buf[i];
__disable_irq();
+ //pwm->SetDuty(i, (uint32_t)m_buf[i]);
pwm.SetDuty(i, (uint32_t)m_buf[i]);
__enable_irq();
}