Fix compiler error on GCC 12
static_assert(sizeof(ChopConfU::S) == 4) would return 5 == 4 static_assert(sizeof(ChopConfU) == 4); would return 8 == 4 using uint32_t on all types instead of uint8_t fixes the issue No change in memorypull/273/head
parent
113f71330e
commit
62713b6b62
|
|
@ -119,23 +119,23 @@ bool __attribute__((noinline)) TMC2130::Init(const MotorParams ¶ms, const Mo
|
||||||
// this ugly union/bit structure saves 34B over the previous implementation
|
// this ugly union/bit structure saves 34B over the previous implementation
|
||||||
union ChopConfU {
|
union ChopConfU {
|
||||||
struct __attribute__((packed)) S {
|
struct __attribute__((packed)) S {
|
||||||
uint8_t toff : 4;
|
uint32_t toff : 4;
|
||||||
uint8_t hstrt : 3;
|
uint32_t hstrt : 3;
|
||||||
uint8_t hend : 4;
|
uint32_t hend : 4;
|
||||||
uint8_t fd : 1;
|
uint32_t fd : 1;
|
||||||
uint8_t disfdcc : 1;
|
uint32_t disfdcc : 1;
|
||||||
uint8_t rndtf : 1;
|
uint32_t rndtf : 1;
|
||||||
uint8_t chm : 1;
|
uint32_t chm : 1;
|
||||||
uint8_t tbl : 2;
|
uint32_t tbl : 2;
|
||||||
uint8_t vsense : 1;
|
uint32_t vsense : 1;
|
||||||
uint8_t vhighfs : 1;
|
uint32_t vhighfs : 1;
|
||||||
uint8_t vhighchm : 1;
|
uint32_t vhighchm : 1;
|
||||||
uint8_t sync : 4;
|
uint32_t sync : 4;
|
||||||
uint8_t mres : 4;
|
uint32_t mres : 4;
|
||||||
uint8_t intpol : 1;
|
uint32_t intpol : 1;
|
||||||
uint8_t dedge : 1;
|
uint32_t dedge : 1;
|
||||||
uint8_t diss2g : 1;
|
uint32_t diss2g : 1;
|
||||||
uint8_t reserved : 1;
|
uint32_t reserved : 1;
|
||||||
constexpr S(bool vsense, uint8_t mres)
|
constexpr S(bool vsense, uint8_t mres)
|
||||||
: toff(TOFF_DEFAULT)
|
: toff(TOFF_DEFAULT)
|
||||||
, hstrt(5)
|
, hstrt(5)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue