Library to handle the X_NUCLEO_IHM02A1 Motor Control Expansion Board based on the L6470 component.
Fork of X_NUCLEO_IHM02A1 by
Diff: Components/l6470/l6470_class.h
- Revision:
- 14:e614697ebf34
- Parent:
- 13:25a579b9b7c3
- Child:
- 15:31785d1acd4b
--- a/Components/l6470/l6470_class.h Tue Jan 19 16:07:00 2016 +0000 +++ b/Components/l6470/l6470_class.h Tue Feb 09 16:01:30 2016 +0000 @@ -57,12 +57,12 @@ /* ACTION 1 ------------------------------------------------------------------* * Include here platform specific header files. * - *----------------------------------------------------------------------------*/ + *----------------------------------------------------------------------------*/ #include "mbed.h" #include "DevSPI.h" /* ACTION 2 ------------------------------------------------------------------* * Include here component specific header files. * - *----------------------------------------------------------------------------*/ + *----------------------------------------------------------------------------*/ #include "l6470.h" /* ACTION 3 ------------------------------------------------------------------* * Include here interface specific header files. * @@ -76,7 +76,8 @@ /* Classes -------------------------------------------------------------------*/ -/** Class representing a L6470 component. +/** + * @brief Class representing a L6470 component. */ class L6470 : public StepperMotor { @@ -153,9 +154,9 @@ * table's functions, if any (2). * * * * Example: * - * virtual int GetValue(float *pData) //(1) * + * virtual int GetValue(float *f) //(1) * * { * - * return COMPONENT_GetValue(float *pfData); * + * return COMPONENT_GetValue(float *f); * * } * * * * virtual int EnableFeature(void) //(2) * @@ -1054,11 +1055,11 @@ * Implement here interrupt related methods, if any. * * Note that interrupt handling is platform dependent, e.g.: * * + mbed: * - * InterruptIn feature_irq(pin); //Interrupt object. * - * feature_irq.rise(callback); //Attach a callback. * - * feature_irq.mode(PullNone); //Set interrupt mode. * - * feature_irq.enable_irq(); //Enable interrupt. * - * feature_irq.disable_irq(); //Disable interrupt. * + * InterruptIn feature_irq(pin); //Interrupt object. * + * feature_irq.fall(callback); //Attach a callback. * + * feature_irq.mode(PullNone); //Set interrupt mode. * + * feature_irq.enable_irq(); //Enable interrupt. * + * feature_irq.disable_irq(); //Disable interrupt. * * + Arduino: * * attachInterrupt(pin, callback, RISING); //Attach a callback. * * detachInterrupt(pin); //Detach a callback. * @@ -1066,7 +1067,7 @@ * Example (mbed): * * void AttachFeatureIRQ(void (*fptr) (void)) * * { * - * feature_irq.rise(fptr); * + * feature_irq.fall(fptr); * * } * * * * void EnableFeatureIRQ(void) * @@ -1155,9 +1156,9 @@ * source files but not pointed by the component's virtual table (3). * * * * Example: * - * DrvStatusTypeDef COMPONENT_GetValue(float* pfData); //(1) * - * DrvStatusTypeDef COMPONENT_EnableFeature(void); //(2) * - * DrvStatusTypeDef COMPONENT_ComputeAverage(void); //(3) * + * Status_t COMPONENT_GetValue(float *f); //(1) * + * Status_t COMPONENT_EnableFeature(void); //(2) * + * Status_t COMPONENT_ComputeAverage(void); //(3) * *------------------------------------------------------------------------*/ int32_t L6470_AbsPos_2_Position(uint32_t AbsPos); uint32_t L6470_Position_2_AbsPos(int32_t Position); @@ -1185,7 +1186,7 @@ uint8_t L6470_mA_2_OcdTh(float mA); float L6470_StallTh_2_mA(uint8_t StallTh); uint8_t L6470_mA_2_StallTh(float mA); - DrvStatusTypeDef L6470_Config(void *init); + Status_t L6470_Config(void *init); void L6470_SetParam(eL6470_RegId_t L6470_RegId, uint32_t Value); uint32_t L6470_GetParam(eL6470_RegId_t L6470_RegId); void L6470_Run(eL6470_DirId_t L6470_DirId, uint32_t Speed); @@ -1254,7 +1255,7 @@ * @param[in] NumBytesToRead number of bytes to read. * @retval COMPONENT_OK in case of success, COMPONENT_ERROR otherwise. */ - DrvStatusTypeDef Read(uint8_t* pBuffer, uint16_t NumBytesToRead) + Status_t Read(uint8_t* pBuffer, uint16_t NumBytesToRead) { if (dev_spi.spi_read(pBuffer, ssel, NumBytesToRead) != 0) return COMPONENT_ERROR; @@ -1267,7 +1268,7 @@ * @param[in] NumBytesToWrite number of bytes to write. * @retval COMPONENT_OK in case of success, COMPONENT_ERROR otherwise. */ - DrvStatusTypeDef Write(uint8_t* pBuffer, uint16_t NumBytesToWrite) + Status_t Write(uint8_t* pBuffer, uint16_t NumBytesToWrite) { if (dev_spi.spi_write(pBuffer, ssel, NumBytesToWrite) != 0) return COMPONENT_ERROR; @@ -1281,7 +1282,7 @@ * @param[in] NumBytes number of bytes to read and write. * @retval COMPONENT_OK in case of success, COMPONENT_ERROR otherwise. */ - DrvStatusTypeDef ReadWrite(uint8_t* pBufferToRead, uint8_t* pBufferToWrite, uint16_t NumBytes) + Status_t ReadWrite(uint8_t* pBufferToRead, uint8_t* pBufferToWrite, uint16_t NumBytes) { if (dev_spi.spi_read_write(pBufferToRead, pBufferToWrite, ssel, NumBytes) != 0) return COMPONENT_ERROR; @@ -1398,6 +1399,6 @@ static uint8_t L6470_DaisyChainSpiRxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE]; }; -#endif // __L6470_CLASS_H +#endif /* __L6470_CLASS_H */ -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/