Skip to content

Commit

Permalink
Fixed static_assert
Browse files Browse the repository at this point in the history
  • Loading branch information
TomSaw committed Mar 17, 2021
1 parent 9e63605 commit 3017e9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/modm/driver/encoder/encoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ template<typename PH_A, typename PH_B, encoder::Division_t DIVISION,
typename UnderlyingType = int8_t>
class Encoder
{
static_assert(std::is_signed<UnderlyingType>::value and std::is_integral<UnderlyingType>::value,
"UnderlyingType must be signed integral");

public:
Encoder() : enc_delta(0), raw_last(0) {};
Encoder() : enc_delta(0), raw_last(0){};

inline void
connect()
{
PH_A::setInput(::Gpio::InputType::PullUp);
PH_B::setInput(::Gpio::InputType::PullUp);

// Tare power-on state
modm::delay(10us);
UnderlyingType raw = 0;
Expand Down
4 changes: 0 additions & 4 deletions src/modm/driver/encoder/encoder_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ template<typename PH_A, typename PH_B, modm::encoder::Division_t DIVISION, typen
inline void
modm::Encoder<PH_A, PH_B, DIVISION, UnderlyingType>::update()
{
static_assert(std::is_signed<UnderlyingType>::value and std::is_integral<UnderlyingType>::value,
"UnderlyingType must be signed integral");
// Tare on power-on
UnderlyingType raw = 0;
UnderlyingType diff;
Expand All @@ -27,8 +25,6 @@ template<typename PH_A, typename PH_B, modm::encoder::Division_t DIVISION, typen
UnderlyingType
modm::Encoder<PH_A, PH_B, DIVISION, UnderlyingType>::getValue()
{
static_assert(std::is_signed<UnderlyingType>::value and std::is_integral<UnderlyingType>::value,
"UnderlyingType must be signed integral");
cli();
UnderlyingType val = enc_delta; // counts since last call
switch (DIVISION)
Expand Down

0 comments on commit 3017e9a

Please sign in to comment.