Skip to content

Commit

Permalink
✨ (interface): Add DACTouch
Browse files Browse the repository at this point in the history
  • Loading branch information
MMyster committed Jun 27, 2022
1 parent 58b025c commit 729ade7
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
29 changes: 29 additions & 0 deletions include/interface/drivers/DACTouch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Leka - LekaOS
// Copyright 2022 APF France handicap
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include <cstdint>

#include "array"

namespace leka::interface {

class DACTouch
{
public:
virtual ~DACTouch() = default;
virtual void writeToAllInputRegister(std::array<uint8_t, 2> value) = 0;
virtual void writeToSpecificInputRegister(uint8_t channel, std::array<uint8_t, 2> value) = 0;
virtual void writeToMemoryRegisterUntilChannelD(uint8_t starting_channel, std::array<uint8_t, 2> value) = 0;
virtual void writeToSpecificMemoryRegister(uint8_t channel, std::array<uint8_t, 2> value) = 0;

virtual void writeVoltageReference(uint8_t voltageReference) = 0;
virtual void writePowerMode(uint8_t powerMode) = 0;
virtual void writeGain(uint8_t gain) = 0;

virtual void readMemory(std::array<uint8_t, 24> &value) = 0;
};

} // namespace leka::interface
28 changes: 28 additions & 0 deletions tests/unit/mocks/mocks/leka/CoreDACTouch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Leka - LekaOS
// Copyright 2022 APF France handicap
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include "CoreBufferedSerial.h"
#include "gmock/gmock.h"

namespace leka {

class CoreDACTouchMock : public interface::DACTouch
{
public:
MOCK_METHOD(void, setVoltageReference, (uint8_t), (override));
MOCK_METHOD(void, setPowerMode, (uint8_t), (override));
MOCK_METHOD(void, setGain, (uint8_t), (override));

MOCK_METHOD(void, writeToAllInputRegister, (std::array<uint8_t, 2>), (override));
MOCK_METHOD(void, writeToSpecificInputRegister, (uint8_t, std::array<uint8_t, 2>), (override));

MOCK_METHOD(void, writeToMemoryRegisterUntilChannelD, (uint8_t, std::array<uint8_t, 2>), (override));
MOCK_METHOD(void, writeToSpecificMemoryRegister, (uint8_t, std::array<uint8_t, 2>), (override));

MOCK_METHOD(void, readMemory, (std::array<uint8_t, 24> &), (override));
};

} // namespace leka

0 comments on commit 729ade7

Please sign in to comment.