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: X_NUCLEO_COMMON ST_INTERFACES
Diff: Components/l6474/l6474_class.h
- Revision:
- 32:6e5198e46287
- Parent:
- 30:a05820cfdba9
--- a/Components/l6474/l6474_class.h Fri Oct 28 13:31:51 2016 +0000
+++ b/Components/l6474/l6474_class.h Tue Feb 28 16:12:31 2017 +0000
@@ -98,8 +98,9 @@
L6474(PinName flag_irq, PinName standby_reset, PinName direction, PinName pwm, PinName ssel, DevSPI &spi) : StepperMotor(), flag_irq(flag_irq), standby_reset(standby_reset), direction(direction), pwm(pwm), ssel(ssel), dev_spi(spi)
{
/* Checking stackability. */
- if (!(number_of_devices < MAX_NUMBER_OF_DEVICES))
+ if (!(number_of_devices < MAX_NUMBER_OF_DEVICES)) {
error("Instantiation of the L6474 component failed: it can be stacked up to %d times.\r\n", MAX_NUMBER_OF_DEVICES);
+ }
/* ACTION 4 ----------------------------------------------------------*
* Initialize here the component's member variables, one variable per *
@@ -216,8 +217,7 @@
unsigned int register_value = (unsigned int) L6474_CmdGetParam((L6474_Registers_t) parameter);
float value;
- switch ((L6474_Registers_t) parameter)
- {
+ switch ((L6474_Registers_t) parameter) {
case L6474_TVAL:
value = L6474_Par_to_Tval_Current((float) register_value);
break;
@@ -368,8 +368,7 @@
{
float register_value;
- switch ((L6474_Registers_t) parameter)
- {
+ switch ((L6474_Registers_t) parameter) {
case L6474_TVAL:
register_value = L6474_Tval_Current_to_Par(value);
break;
@@ -590,8 +589,9 @@
*/
virtual bool SetStepMode(step_mode_t step_mode)
{
- if ((motorStepMode_t) step_mode > STEP_MODE_1_16)
+ if ((motorStepMode_t) step_mode > STEP_MODE_1_16) {
return false;
+ }
SoftHiZ();
L6474_SelectStepMode((motorStepMode_t) step_mode);
@@ -783,8 +783,9 @@
*/
Status_t Read(uint8_t* pBuffer, uint16_t NumBytesToRead)
{
- if (dev_spi.spi_read(pBuffer, ssel, NumBytesToRead) != 0)
+ if (dev_spi.spi_read(pBuffer, ssel, NumBytesToRead) != 0) {
return COMPONENT_ERROR;
+ }
return COMPONENT_OK;
}
@@ -796,8 +797,9 @@
*/
Status_t Write(uint8_t* pBuffer, uint16_t NumBytesToWrite)
{
- if (dev_spi.spi_write(pBuffer, ssel, NumBytesToWrite) != 0)
+ if (dev_spi.spi_write(pBuffer, ssel, NumBytesToWrite) != 0) {
return COMPONENT_ERROR;
+ }
return COMPONENT_OK;
}
@@ -810,8 +812,9 @@
*/
Status_t ReadWrite(uint8_t* pBufferToRead, uint8_t* pBufferToWrite, uint16_t NumBytes)
{
- if (dev_spi.spi_read_write(pBufferToRead, pBufferToWrite, ssel, NumBytes) != 0)
+ if (dev_spi.spi_read_write(pBufferToRead, pBufferToWrite, ssel, NumBytes) != 0) {
return COMPONENT_ERROR;
+ }
return COMPONENT_OK;
}