[Pager] Reworked logic to workaround linker error on MegaCore (CI_BUILD_ALL)
This commit is contained in:
parent
1382e56508
commit
f6e5d02481
1 changed files with 9 additions and 4 deletions
|
@ -422,16 +422,21 @@ void PagerClient::write(uint32_t codeWord) {
|
||||||
Module* mod = _phy->getMod();
|
Module* mod = _phy->getMod();
|
||||||
for(int8_t i = 31; i >= 0; i--) {
|
for(int8_t i = 31; i >= 0; i--) {
|
||||||
uint32_t mask = (uint32_t)0x01 << i;
|
uint32_t mask = (uint32_t)0x01 << i;
|
||||||
|
uint32_t start = mod->micros();
|
||||||
if(codeWord & mask) {
|
if(codeWord & mask) {
|
||||||
// send 1
|
// send 1
|
||||||
uint32_t start = mod->micros();
|
|
||||||
_phy->transmitDirect(_baseRaw + _shift);
|
_phy->transmitDirect(_baseRaw + _shift);
|
||||||
while(mod->micros() - start < _bitDuration);
|
|
||||||
} else {
|
} else {
|
||||||
// send 0
|
// send 0
|
||||||
uint32_t start = mod->micros();
|
|
||||||
_phy->transmitDirect(_baseRaw - _shift);
|
_phy->transmitDirect(_baseRaw - _shift);
|
||||||
while(mod->micros() - start < _bitDuration);
|
}
|
||||||
|
|
||||||
|
// this is pretty silly, while(mod->micros() ... ) would be enough
|
||||||
|
// but for some reason, MegaCore throws a linker error on it
|
||||||
|
// "relocation truncated to fit: R_AVR_7_PCREL against `no symbol'"
|
||||||
|
uint32_t now = mod->micros();
|
||||||
|
while(now - start < _bitDuration) {
|
||||||
|
now = mod->micros();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue