Skip to content

Commit

Permalink
tmc2130_read_gstat() read also reset flag. This reverts "Replace bool…
Browse files Browse the repository at this point in the history
…ean operator with bitwise."
  • Loading branch information
mkbel committed Feb 7, 2019
1 parent 5c55b77 commit 8cc1e53
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions MM-control-01/tmc2130.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,12 @@ uint8_t tmc2130_rx(uint8_t axis, uint8_t addr, uint32_t* rval)
return stat;
}

//! @brief Read global error flags for all axes
//! @brief Read global error flags for all axis
//!
//! Error is detected if any of following flags is set.
//! * reset
//! * IC has been reset since the last read access to GSTAT.
//! All registers have been cleared to reset values.
//! * drv_err
//! * Overtemperature or short circuit. Driver has been shut down.
//! * uv_cp
Expand All @@ -357,7 +360,7 @@ uint8_t tmc2130_read_gstat()
{
uint32_t result;
tmc2130_rd(axis, TMC2130_REG_GSTAT, &result);
if (result & 0x6) retval += (1 << axis);
if (result & 0x7) retval += (1 << axis);
}
return retval;
}

0 comments on commit 8cc1e53

Please sign in to comment.