Added force inline to reduce code size

This commit is contained in:
BlackMark 2019-07-30 21:48:00 +02:00
parent aac73447b3
commit 6861b8f5d1
2 changed files with 8 additions and 9 deletions

View File

@ -41,7 +41,6 @@ enum class ControlFlagsA0 {
DATA_REG_EMPTY = UDRE0,
TRANSMIT_COMPLETE = TXC0,
RECEIVE_COMPLETE = RXC0,
};
enum class ControlFlagsB0 {
@ -86,7 +85,7 @@ constexpr int operator<<(const int &lhs, const ControlFlagsC0 &rhs)
template <class Registers, typename CtrlFlagsA, typename CtrlFlagsB, typename CtrlFlagsC, class cfg, Mode mode>
class Hardware {
public:
static void init()
static void init() FORCE_INLINE
{
constexpr auto baudVal = calcBaud();
@ -107,7 +106,7 @@ class Hardware {
*Registers::CTRL_STAT_REG_C = controlRegC;
}
static void txByte(typename cfg::data_t byte)
static void txByte(typename cfg::data_t byte) FORCE_INLINE
{
while (!(*Registers::CTRL_STAT_REG_A & (1 << CtrlFlagsA::DATA_REG_EMPTY)))
;
@ -220,7 +219,7 @@ class Hardware0 {
using data_t = typename cfg::data_t;
static constexpr auto DATA_BITS = cfg::DATA_BITS;
static void init()
static void init() FORCE_INLINE
{
HardwareImpl::init();
}
@ -230,9 +229,9 @@ class Hardware0 {
HardwareImpl::txByte(byte);
}
static data_t rxByte() {}
static data_t rxByte() FORCE_INLINE {}
static data_t peek() {}
static data_t peek() FORCE_INLINE {}
private:
using HardwareImpl = detail::Hardware<detail::Registers0, detail::ControlFlagsA0, detail::ControlFlagsB0,

View File

@ -81,7 +81,7 @@ class Hardware1 {
using data_t = typename cfg::data_t;
static constexpr auto DATA_BITS = cfg::DATA_BITS;
static void init()
static void init() FORCE_INLINE
{
HardwareImpl::init();
}
@ -91,9 +91,9 @@ class Hardware1 {
HardwareImpl::txByte(byte);
}
static data_t rxByte() {}
static data_t rxByte() FORCE_INLINE {}
static data_t peek() {}
static data_t peek() FORCE_INLINE {}
private:
using HardwareImpl = detail::Hardware<detail::Registers1, detail::ControlFlagsA1, detail::ControlFlagsB1,