mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-08-06 17:03:17 +00:00
Shift some bus functions definitions out of the header
This commit is contained in:
@@ -41,6 +41,10 @@ constexpr int ADDR_WIDTH = 12;
|
||||
}
|
||||
|
||||
namespace avclan {
|
||||
|
||||
Bus::Handle::Handle() { AVCLAN_stopEvent(); }
|
||||
Bus::Handle::~Handle() { AVCLAN_startEvent(); }
|
||||
|
||||
void Bus::init() { AVCLAN_busInit(); };
|
||||
void Bus::mute(bool mute) { AVCLAN_muteDevice(mute); };
|
||||
bool Bus::is_muted() const { return AVCLAN_ismuted(); };
|
||||
@@ -291,4 +295,16 @@ auto Bus::Handle::readstartbit() -> Read {
|
||||
void Bus::Handle::send_ACK() { AVCLAN_sendbit_ACK(); };
|
||||
uint8_t Bus::Handle::read_ACK() { return AVCLAN_readbit_ACK(); };
|
||||
|
||||
template <> inline avclan_bit_t Bus::Handle::sendbits<8>(uint8_t bits) {
|
||||
return AVCLAN_sendbyte(&bits);
|
||||
};
|
||||
template <> inline avclan_bit_t Bus::Handle::sendbits<1>(uint8_t bits) {
|
||||
const avclan_bit_t bit{static_cast<avclan_bit_t>(bits & 1U)};
|
||||
AVCLAN_sendbit(bit);
|
||||
return bit;
|
||||
};
|
||||
template <> inline avclan_bit_t Bus::Handle::readbits<8>(uint8_t *bits) {
|
||||
return static_cast<avclan_bit_t>(AVCLAN_readbyte(bits));
|
||||
};
|
||||
|
||||
} // namespace avclan
|
||||
|
||||
+2
-14
@@ -71,11 +71,11 @@ public:
|
||||
};
|
||||
|
||||
class Bus::Handle {
|
||||
Handle() { AVCLAN_stopEvent(); }
|
||||
Handle();
|
||||
friend Bus;
|
||||
|
||||
public:
|
||||
~Handle() { AVCLAN_startEvent(); }
|
||||
~Handle();
|
||||
Handle(const Handle &) = delete;
|
||||
Handle(Handle &&) = delete;
|
||||
using Error = detail::Error;
|
||||
@@ -159,16 +159,4 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
template <> inline avclan_bit_t Bus::Handle::sendbits<8>(uint8_t bits) {
|
||||
return AVCLAN_sendbyte(&bits);
|
||||
};
|
||||
template <> inline avclan_bit_t Bus::Handle::sendbits<1>(uint8_t bits) {
|
||||
const avclan_bit_t bit{static_cast<avclan_bit_t>(bits & 1U)};
|
||||
AVCLAN_sendbit(bit);
|
||||
return bit;
|
||||
};
|
||||
template <> inline avclan_bit_t Bus::Handle::readbits<8>(uint8_t *bits) {
|
||||
return static_cast<avclan_bit_t>(AVCLAN_readbyte(bits));
|
||||
};
|
||||
|
||||
} // namespace avclan
|
||||
|
||||
Reference in New Issue
Block a user