From 5250cfd4feadc07b0d640507b31aea5ff746a4f1 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sun, 11 Jul 2021 20:33:59 +0200 Subject: [PATCH] Implement the SHR16::SetTMCDir stub for testing --- tests/unit/modules/stubs/stub_shr16.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/unit/modules/stubs/stub_shr16.cpp b/tests/unit/modules/stubs/stub_shr16.cpp index 45bcf30..97d179f 100644 --- a/tests/unit/modules/stubs/stub_shr16.cpp +++ b/tests/unit/modules/stubs/stub_shr16.cpp @@ -6,20 +6,29 @@ namespace shr16 { SHR16 shr16; uint16_t shr16_v_copy; +uint8_t shr16_tmc_dir; void SHR16::Init() { shr16_v_copy = 0; + shr16_tmc_dir = 0; } void SHR16::SetLED(uint16_t led) { shr16_v_copy = ((led & 0x00ff) << 8) | ((led & 0x0300) >> 2); } + void SHR16::SetTMCEnabled(uint8_t index, bool ena) { // do nothing right now } + void SHR16::SetTMCDir(uint8_t index, bool dir) { - // do nothing right now + // this is using another array for testing convenience + if (dir) + shr16_tmc_dir |= (1 << index); + else + shr16_tmc_dir &= ~(1 << index); } + void SHR16::Write(uint16_t v) { // do nothing right now }