[PHY] Add default implementation of start transmit/receive
This commit is contained in:
parent
7ec456dad4
commit
d7c00bfa0a
2 changed files with 25 additions and 11 deletions
|
@ -132,11 +132,18 @@ int16_t PhysicalLayer::startReceive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t PhysicalLayer::startReceive(uint32_t timeout, RadioLibIrqFlags_t irqFlags, RadioLibIrqFlags_t irqMask, size_t len) {
|
int16_t PhysicalLayer::startReceive(uint32_t timeout, RadioLibIrqFlags_t irqFlags, RadioLibIrqFlags_t irqMask, size_t len) {
|
||||||
(void)timeout;
|
RadioModeConfig_t cfg = {
|
||||||
(void)irqFlags;
|
.receive = {
|
||||||
(void)irqMask;
|
.timeout = timeout,
|
||||||
(void)len;
|
.irqFlags = irqFlags,
|
||||||
return(RADIOLIB_ERR_UNSUPPORTED);
|
.irqMask = irqMask,
|
||||||
|
.len = len,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int16_t state = this->stageMode(RADIOLIB_RADIO_MODE_RX, &cfg);
|
||||||
|
RADIOLIB_ASSERT(state);
|
||||||
|
return(this->launchMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(RADIOLIB_BUILD_ARDUINO)
|
#if defined(RADIOLIB_BUILD_ARDUINO)
|
||||||
|
@ -150,10 +157,17 @@ int16_t PhysicalLayer::startTransmit(const char* str, uint8_t addr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t PhysicalLayer::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
|
int16_t PhysicalLayer::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
|
||||||
(void)data;
|
RadioModeConfig_t cfg = {
|
||||||
(void)len;
|
.transmit = {
|
||||||
(void)addr;
|
.data = data,
|
||||||
return(RADIOLIB_ERR_UNSUPPORTED);
|
.len = len,
|
||||||
|
.addr = addr,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int16_t state = this->stageMode(RADIOLIB_RADIO_MODE_TX, &cfg);
|
||||||
|
RADIOLIB_ASSERT(state);
|
||||||
|
return(this->launchMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t PhysicalLayer::finishTransmit() {
|
int16_t PhysicalLayer::finishTransmit() {
|
||||||
|
|
|
@ -151,7 +151,7 @@ struct ReceiveConfig_t {
|
||||||
|
|
||||||
struct TransmitConfig_t {
|
struct TransmitConfig_t {
|
||||||
/*! \brief Binary data that will be transmitted. */
|
/*! \brief Binary data that will be transmitted. */
|
||||||
uint8_t* data;
|
const uint8_t* data;
|
||||||
|
|
||||||
/*! \brief Length of binary data to transmit (in bytes). */
|
/*! \brief Length of binary data to transmit (in bytes). */
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -306,7 +306,7 @@ class PhysicalLayer {
|
||||||
\param len Packet length, needed for some modules under special circumstances (e.g. LoRa implicit header mode).
|
\param len Packet length, needed for some modules under special circumstances (e.g. LoRa implicit header mode).
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
virtual int16_t startReceive(uint32_t timeout, RadioLibIrqFlags_t irqFlags, RadioLibIrqFlags_t irqMask, size_t len);
|
virtual int16_t startReceive(uint32_t timeout, RadioLibIrqFlags_t irqFlags = RADIOLIB_IRQ_RX_DEFAULT_FLAGS, RadioLibIrqFlags_t irqMask = RADIOLIB_IRQ_RX_DEFAULT_MASK, size_t len = 0);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Binary receive method. Must be implemented in module class.
|
\brief Binary receive method. Must be implemented in module class.
|
||||||
|
|
Loading…
Add table
Reference in a new issue