motor control
Fork of X_NUCLEO_IHM01A1 by
Revision 4:83a1eb397a65, committed 2015-11-13
- Comitter:
- Davidroid
- Date:
- Fri Nov 13 12:56:06 2015 +0000
- Parent:
- 1:b38ebb8ea286
- Child:
- 5:d3c78f12a78d
- Commit message:
- "StepperMotor" abstract class defined.
Changed in this revision
--- a/Components/Interfaces/Motor_class.h Fri Oct 16 13:30:06 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/** - ****************************************************************************** - * @file Motor_class.h - * @author AST / EST - * @version V0.0.1 - * @date 13-April-2015 - * @brief This file contains the abstract class describing the interface of a - * motor component. - ****************************************************************************** - * @attention - * - * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - - -/* Generated with Stm32CubeTOO -----------------------------------------------*/ - - -/* Revision ------------------------------------------------------------------*/ -/* - Repository: http://svn.x-nucleodev.codex.cro.st.com/svnroot/X-NucleoDev - Branch/Trunk/Tag: trunk - Based on: X-CUBE-SPN1/trunk/Drivers/BSP/Components/Common/motor.h - Revision: 0 -*/ - - -/* Define to prevent from recursive inclusion --------------------------------*/ - -#ifndef __MOTOR_CLASS_H -#define __MOTOR_CLASS_H - - -/* Includes ------------------------------------------------------------------*/ - -#include <Component_class.h> - - -/* Classes ------------------------------------------------------------------*/ - -/** An abstract class for Motor components. - */ -class Motor : public Component -{ -public: - /* ACTION 1 --------------------------------------------------------------* - * Declare here the interface's methods. * - * They should be: * - * + Methods with the same name of the C component's virtual table * - * (and extended virtual table, if any)'s functions, provided that * - * the component's driver implements them (i.e.: the corresponding * - * pointer to function is not "0"). * - * * - * Example: * - * virtual int GetValue(float *pfData) = 0; * - *------------------------------------------------------------------------*/ - virtual uint16_t GetAcceleration(void) = 0; - virtual uint16_t GetCurrentSpeed(void) = 0; - virtual uint16_t GetDeceleration(void) = 0; - virtual motorState_t GetDeviceState(void) = 0; - virtual uint8_t GetFwVersion(void) = 0; - virtual int32_t GetMark(void) = 0; - virtual uint16_t GetMaxSpeed(void) = 0; - virtual uint16_t GetMinSpeed(void) = 0; - virtual int32_t GetPosition(void) = 0; - virtual void GoHome(void) = 0; - virtual void GoMark(void) = 0; - virtual void GoTo(int32_t targetPosition) = 0; - virtual void HardStop(void) = 0; - virtual void Move(motorDir_t direction, uint32_t stepCount) = 0; - virtual void Run(motorDir_t direction) = 0; - virtual bool SetAcceleration(uint16_t newAcc) = 0; - virtual bool SetDeceleration(uint16_t newDec) = 0; - virtual void SetHome(void) = 0; - virtual void SetMark(void) = 0; - virtual bool SetMaxSpeed(uint16_t newMaxSpeed) = 0; - virtual bool SetMinSpeed(uint16_t newMinSpeed) = 0; - virtual bool SoftStop(void) = 0; - virtual void StepClockHandler(void) = 0; - virtual void WaitWhileActive(void) = 0; - virtual void CmdDisable(void) = 0; - virtual void CmdEnable(void) = 0; - virtual uint32_t CmdGetParam(uint32_t param) = 0; - virtual uint16_t CmdGetStatus(void) = 0; - virtual void CmdNop(void) = 0; - virtual void CmdSetParam(uint32_t param, uint32_t value) = 0; - virtual uint16_t ReadStatusRegister(void) = 0; - virtual void ReleaseReset(void) = 0; - virtual void Reset(void) = 0; - virtual void SelectStepMode(motorStepMode_t stepMod) = 0; - virtual void SetDirection(motorDir_t direction) = 0; - virtual void ErrorHandler(uint16_t error) = 0; -}; - -#endif /* __MOTOR_CLASS_H */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Components/Interfaces/StepperMotor_class.h Fri Nov 13 12:56:06 2015 +0000 @@ -0,0 +1,143 @@ +/** + ****************************************************************************** + * @file StepperMotor_class.h + * @author AST + * @version V1.0.0 + * @date November 12th, 2015 + * @brief This file contains the abstract class describing the interface of a + * steppermotor component. + ****************************************************************************** + * @attention + * + * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + + +/* Define to prevent from recursive inclusion --------------------------------*/ + +#ifndef __STEPPERMOTOR_CLASS_H +#define __STEPPERMOTOR_CLASS_H + + +/* Includes ------------------------------------------------------------------*/ + +#include <Component_class.h> + + +/* Classes ------------------------------------------------------------------*/ + +/** An abstract class for StepperMotor components. + */ +class StepperMotor : public Component +{ +public: + /** Rotation modes. */ + typedef enum + { + CW = 0, /* Clockwise. */ + CCW /* Counter-Clockwise. */ + } direction_t; + + /* Get the status. */ + virtual unsigned int GetStatus(void) = 0; + + /* Get the specified parameter. */ + virtual unsigned int GetParameter(unsigned int parameter) = 0; + + /* Return the current position. */ + virtual signed int GetPosition(void) = 0; + + /* Return the mark position. */ + virtual signed int GetMark(void) = 0; + + /* Get the current direction of rotation. */ + virtual direction_t GetDirection(void) = 0; + + /* Return the current speed in pps. */ + virtual unsigned int GetSpeed(void) = 0; + + /* Return the maximum speed in pps. */ + virtual unsigned int GetMaxSpeed(void) = 0; + + /* Return the minimum speed in pps. */ + virtual unsigned int GetMinSpeed(void) = 0; + + /* Return the acceleration in pps^2. */ + virtual unsigned int GetAcceleration(void) = 0; + + /* Return the deceleration in pps^2. */ + virtual unsigned int GetDeceleration(void) = 0; + + /* Set the specified parameter. */ + virtual void SetParameter(unsigned int parameter, unsigned int value) = 0; + + /* Set the current position to be the home position. */ + virtual void SetHome(void) = 0; + + /* Set the current position to be the mark position. */ + virtual void SetMark(void) = 0; + + /* Set the direction of rotation. */ + virtual void SetDirection(direction_t direction) = 0; + + /* Set the maximum speed in pps. */ + virtual void SetMaxSpeed(unsigned int speed) = 0; + + /* Set the minimum speed in pps. */ + virtual void SetMinSpeed(unsigned int speed) = 0; + + /* Set the acceleration in pps^2. */ + virtual void SetAcceleration(unsigned int acceleration) = 0; + + /* Set the deceleration in pps^2. */ + virtual void SetDeceleration(unsigned int deceleration) = 0; + + /* Go to the specified position. */ + virtual void GoTo(signed int position) = 0; + + /* Go to the home position. */ + virtual void GoHome(void) = 0; + + /* Go to the marked position. */ + virtual void GoMark(void) = 0; + + /* Run the motor towards a specified direction. */ + virtual void Run(direction_t direction) = 0; + + /* Run the motor towards a specified direction for a specified number of steps. */ + virtual void Move(direction_t direction, unsigned int steps) = 0; + + /* Stop the motor. */ + virtual void SoftStop(void) = 0; + + /* Stop the motor and disable the power bridge. */ + virtual void HardStop(void) = 0; +}; + +#endif /* __STEPPERMOTOR_CLASS_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/l6474/l6474_class.cpp Fri Oct 16 13:30:06 2015 +0000 +++ b/Components/l6474/l6474_class.cpp Fri Nov 13 12:56:06 2015 +0000 @@ -259,7 +259,7 @@ **********************************************************/ void L6474::L6474_GoTo(int32_t targetPosition) { - motorDir_t direction; + direction_t direction; int32_t steps; /* Eventually deactivate motor */ @@ -277,12 +277,12 @@ if (steps >= 0) { devicePrm.stepsToTake = steps; - direction = FORWARD; + direction = CW; } else { devicePrm.stepsToTake = -steps; - direction = BACKWARD; + direction = CCW; } if (steps != 0) @@ -323,7 +323,7 @@ * @param[in] stepCount Number of steps to perform * @retval None **********************************************************/ -void L6474::L6474_Move(motorDir_t direction, uint32_t stepCount) +void L6474::L6474_Move(direction_t direction, uint32_t stepCount) { /* Eventually deactivate motor */ if (devicePrm.motionState != INACTIVE) @@ -377,7 +377,7 @@ * @param[in] direction FORWARD or BACKWARD * @retval None **********************************************************/ -void L6474::L6474_Run(motorDir_t direction) +void L6474::L6474_Run(direction_t direction) { /* Eventually deactivate motor */ if (devicePrm.motionState != INACTIVE) @@ -792,18 +792,27 @@ } /******************************************************//** + * @brief Get the direction + * @retval direction clockwise or counter-clockwise + **********************************************************/ +StepperMotor::direction_t L6474::L6474_GetDirection(void) +{ + return (devicePrm.direction == FORWARD ? CW : CCW); +} + +/******************************************************//** * @brief Specifies the direction * @param[in] dir FORWARD or BACKWARD * @note The direction change is only applied if the device * is in INACTIVE state * @retval None **********************************************************/ -void L6474::L6474_SetDirection(motorDir_t dir) +void L6474::L6474_SetDirection(direction_t direction) { if (devicePrm.motionState == INACTIVE) { - devicePrm.direction = dir; - L6474_SetDirectionGpio(dir); + devicePrm.direction = (direction == CW ? FORWARD : BACKWARD); + L6474_SetDirectionGpio(direction == CW ? 1 : 0); } }
--- a/Components/l6474/l6474_class.h Fri Oct 16 13:30:06 2015 +0000 +++ b/Components/l6474/l6474_class.h Fri Nov 13 12:56:06 2015 +0000 @@ -73,14 +73,14 @@ * #include "../Interfaces/Humidity_class.h" * * #include "../Interfaces/Temperature_class.h" * *----------------------------------------------------------------------------*/ -#include "../Interfaces/Motor_class.h" +#include "../Interfaces/StepperMotor_class.h" /* Classes -------------------------------------------------------------------*/ /** Class representing a L6474 component. */ -class L6474 : public Motor +class L6474 : public StepperMotor { public: @@ -88,13 +88,13 @@ /** * @brief Constructor. - * @param reset pin name of the STBY\RST pin of the component. - * @param direction pin name of the DIR pin of the component. - * @param pwm pin name of the PWM pin of the component. - * @param ssel pin name of the SSEL pin of the SPI device to be used for communication. - * @param spi SPI device to be used for communication. + * @param standby_reset pin name of the STBY\RST pin of the component. + * @param direction pin name of the DIR pin of the component. + * @param pwm pin name of the PWM pin of the component. + * @param ssel pin name of the SSEL pin of the SPI device to be used for communication. + * @param spi SPI device to be used for communication. */ - L6474(PinName reset, PinName direction, PinName pwm, PinName ssel, DevSPI &spi) : Motor(), direction(direction), pwm(pwm), reset(reset), ssel(ssel), dev_spi(spi) + L6474(PinName standby_reset, PinName direction, PinName pwm, PinName ssel, DevSPI &spi) : StepperMotor(), standby_reset(standby_reset), direction(direction), pwm(pwm), ssel(ssel), dev_spi(spi) { /* ACTION 4 ----------------------------------------------------------* * Initialize here the component's member variables, one variable per * @@ -155,64 +155,99 @@ return (int) L6474_ReadID((uint8_t *) id); } - virtual void AttachErrorHandler(void (*callback)(uint16_t error)) + virtual unsigned int GetStatus(void) { - L6474_AttachErrorHandler((void (*)(uint16_t error)) callback); + return (unsigned int) L6474_CmdGetStatus(); } - virtual void AttachFlagInterrupt(void (*callback)(void)) + virtual unsigned int GetParameter(unsigned int parameter) { - L6474_AttachFlagInterrupt((void (*)(void)) callback); + return (unsigned int) L6474_CmdGetParam((unsigned int) parameter); + } + + virtual signed int GetPosition(void) + { + return (signed int) L6474_GetPosition(); } - virtual void FlagInterruptHandler(void) + virtual signed int GetMark(void) { - L6474_FlagInterruptHandler(); + return (signed int) L6474_GetMark(); + } + + virtual direction_t GetDirection(void) + { + return (direction_t) L6474_GetDirection(); } - virtual uint16_t GetAcceleration(void) + virtual unsigned int GetSpeed(void) { - return (uint16_t) L6474_GetAcceleration(); + return (unsigned int) L6474_GetCurrentSpeed(); } - virtual uint16_t GetCurrentSpeed(void) + virtual unsigned int GetMaxSpeed(void) + { + return (unsigned int) L6474_GetMaxSpeed(); + } + + virtual unsigned int GetMinSpeed(void) { - return (uint16_t) L6474_GetCurrentSpeed(); + return (unsigned int) L6474_GetMinSpeed(); + } + + virtual unsigned int GetAcceleration(void) + { + return (unsigned int) L6474_GetAcceleration(); } - virtual uint16_t GetDeceleration(void) + virtual unsigned int GetDeceleration(void) { - return (uint16_t) L6474_GetDeceleration(); + return (unsigned int) L6474_GetDeceleration(); } - virtual motorState_t GetDeviceState(void) + virtual void SetParameter(unsigned int parameter, unsigned int value) { - return (motorState_t) L6474_GetDeviceState(); + L6474_CmdSetParam((unsigned int) parameter, (unsigned int) value); } - virtual uint8_t GetFwVersion(void) + virtual void SetHome(void) { - return (uint8_t) L6474_GetFwVersion(); + L6474_SetHome(); + } + + virtual void SetMark(void) + { + L6474_SetMark(); } - virtual int32_t GetMark(void) + virtual void SetDirection(direction_t direction) { - return (int32_t) L6474_GetMark(); + L6474_SetDirection((direction_t) direction); + } + + virtual void SetMaxSpeed(unsigned int speed) + { + L6474_SetMaxSpeed((unsigned int) speed); } - virtual uint16_t GetMaxSpeed(void) + virtual void SetMinSpeed(unsigned int speed) { - return (uint16_t) L6474_GetMaxSpeed(); + L6474_SetMinSpeed((unsigned int) speed); } - virtual uint16_t GetMinSpeed(void) + virtual void SetAcceleration(unsigned int acceleration) { - return (uint16_t) L6474_GetMinSpeed(); + L6474_SetAcceleration((unsigned int) acceleration); } - virtual int32_t GetPosition(void) + virtual void SetDeceleration(unsigned int deceleration) { - return (int32_t) L6474_GetPosition(); + L6474_SetDeceleration((unsigned int) deceleration); + } + + virtual void GoTo(signed int position) + { + L6474_GoTo((signed int) position); } virtual void GoHome(void) @@ -225,9 +260,19 @@ L6474_GoMark(); } - virtual void GoTo(int32_t targetPosition) + virtual void Run(direction_t direction) + { + L6474_Run((direction_t) direction); + } + + virtual void Move(direction_t direction, unsigned int steps) { - L6474_GoTo((int32_t) targetPosition); + L6474_Move((direction_t) direction, (unsigned int) steps); + } + + virtual void SoftStop(void) + { + L6474_SoftStop(); } virtual void HardStop(void) @@ -235,49 +280,14 @@ L6474_HardStop(); } - virtual void Move(motorDir_t direction, uint32_t stepCount) - { - L6474_Move((motorDir_t) direction, (uint32_t) stepCount); - } - - virtual void Run(motorDir_t direction) + virtual motorState_t GetDeviceState(void) { - L6474_Run((motorDir_t) direction); - } - - virtual bool SetAcceleration(uint16_t newAcc) - { - return (bool) L6474_SetAcceleration((uint16_t) newAcc); - } - - virtual bool SetDeceleration(uint16_t newDec) - { - return (bool) L6474_SetDeceleration((uint16_t) newDec); + return (motorState_t) L6474_GetDeviceState(); } - virtual void SetHome(void) - { - L6474_SetHome(); - } - - virtual void SetMark(void) - { - L6474_SetMark(); - } - - virtual bool SetMaxSpeed(uint16_t newMaxSpeed) + virtual uint8_t GetFwVersion(void) { - return (bool) L6474_SetMaxSpeed((uint16_t) newMaxSpeed); - } - - virtual bool SetMinSpeed(uint16_t newMinSpeed) - { - return (bool) L6474_SetMinSpeed((uint16_t) newMinSpeed); - } - - virtual bool SoftStop(void) - { - return (bool) L6474_SoftStop(); + return (uint8_t) L6474_GetFwVersion(); } virtual void StepClockHandler(void) @@ -300,26 +310,11 @@ L6474_CmdEnable(); } - virtual uint32_t CmdGetParam(uint32_t param) - { - return (uint32_t) L6474_CmdGetParam((uint32_t) param); - } - - virtual uint16_t CmdGetStatus(void) - { - return (uint16_t) L6474_CmdGetStatus(); - } - virtual void CmdNop(void) { L6474_CmdNop(); } - virtual void CmdSetParam(uint32_t param, uint32_t value) - { - L6474_CmdSetParam((uint32_t) param, (uint32_t) value); - } - virtual uint16_t ReadStatusRegister(void) { return (uint16_t) L6474_ReadStatusRegister(); @@ -340,16 +335,26 @@ L6474_SelectStepMode((motorStepMode_t) stepMod); } - virtual void SetDirection(motorDir_t direction) - { - L6474_SetDirection((motorDir_t) direction); - } - virtual void ErrorHandler(uint16_t error) { L6474_ErrorHandler((uint16_t) error); } + virtual void AttachErrorHandler(void (*callback)(uint16_t error)) + { + L6474_AttachErrorHandler((void (*)(uint16_t error)) callback); + } + + virtual void AttachFlagInterrupt(void (*callback)(void)) + { + L6474_AttachFlagInterrupt((void (*)(void)) callback); + } + + virtual void FlagInterruptHandler(void) + { + L6474_FlagInterruptHandler(); + } + /*** Public Interrupt Related Methods ***/ @@ -420,8 +425,8 @@ void L6474_GoMark(void); //Move to the Mark position void L6474_GoTo(int32_t targetPosition); //Go to the specified position void L6474_HardStop(void); //Stop the motor and disable the power bridge - void L6474_Move(motorDir_t direction, uint32_t stepCount); //Move the motor of the specified number of steps - void L6474_Run(motorDir_t direction); //Run the motor + void L6474_Move(direction_t direction, uint32_t stepCount); //Move the motor of the specified number of steps + void L6474_Run(direction_t direction); //Run the motor bool L6474_SetAcceleration(uint16_t newAcc); //Set the acceleration in pps^2 bool L6474_SetDeceleration(uint16_t newDec); //Set the deceleration in pps^2 void L6474_SetHome(void); //Set current position to be the home position @@ -438,7 +443,8 @@ void L6474_CmdSetParam(uint32_t param, uint32_t value); //Send the L6474_SET_PARAM command uint16_t L6474_ReadStatusRegister(void); //Read the L6474_STATUS register without clearing the flags void L6474_SelectStepMode(motorStepMode_t stepMod); //Step mode selection - void L6474_SetDirection(motorDir_t direction); //Set the L6474 direction pin + direction_t L6474_GetDirection(void); //Get the direction of rotation + void L6474_SetDirection(direction_t direction); //Set the direction of rotation void L6474_ApplySpeed(uint16_t newSpeed); void L6474_ComputeSpeedProfile(uint32_t nbSteps); int32_t L6474_ConvertPosition(uint32_t abs_position_reg); @@ -562,19 +568,21 @@ } /* - * Setting the standby/reset pin to high. + * Puts the device in standby mode. */ void L6474_ReleaseReset(void) { - reset = 1; + /* TO BE IMPLEMENTED BY USING TARGET PLATFORM'S APIs. */ + standby_reset = 1; } /* - * Resetting the standby/reset pin to put the device in standby mode. + * Puts the device in reset mode. */ void L6474_Reset(void) { - reset = 0; + /* TO BE IMPLEMENTED BY USING TARGET PLATFORM'S APIs. */ + standby_reset = 0; } /* @@ -606,11 +614,8 @@ /* Type. */ uint8_t type; - /* Configuration. */ - DigitalOut ssel; - - /* Standby and reset pin. */ - DigitalOut reset; + /* Standby/reset pin. */ + DigitalOut standby_reset; /* Direction of rotation pin. */ DigitalOut direction; @@ -618,12 +623,15 @@ /* Pulse Width Modulation pin. */ PwmOut pwm; - /* Timer to trigger the PWM callback at each PWM pulse. */ - Ticker ticker; + /* Configuration. */ + DigitalOut ssel; /* IO Device. */ DevSPI &dev_spi; + /* Timer to trigger the PWM callback at each PWM pulse. */ + Ticker ticker; + /* Interrupts. */ /* ACTION 10 -------------------------------------------------------------* * Put here interrupt related objects, if needed. *