static int
rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg)
{
+ int ret;
int payload_length;
/* receiver config */
{
SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, always));
}
- SET_CHECKED(rf69_set_packet_format (dev->spi, rx_cfg->enable_length_byte));
+ if (rx_cfg->enable_length_byte == optionOn) {
+ ret = rf69_set_packet_format(dev->spi, packetLengthVar);
+ if (ret < 0)
+ return ret;
+ } else {
+ ret = rf69_set_packet_format(dev->spi, packetLengthFix);
+ if (ret < 0)
+ return ret;
+ }
SET_CHECKED(rf69_set_adressFiltering(dev->spi, rx_cfg->enable_address_filtering));
SET_CHECKED(rf69_set_crc_enable (dev->spi, rx_cfg->enable_crc));
static int
rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg)
{
+ int ret;
+
SET_CHECKED(rf69_set_frequency (dev->spi, tx_cfg->frequency));
SET_CHECKED(rf69_set_bit_rate (dev->spi, tx_cfg->bit_rate));
SET_CHECKED(rf69_set_modulation (dev->spi, tx_cfg->modulation));
SET_CHECKED(rf69_set_preamble_length(dev->spi, 0));
}
SET_CHECKED(rf69_set_sync_enable (dev->spi, tx_cfg->enable_sync));
- SET_CHECKED(rf69_set_packet_format(dev->spi, tx_cfg->enable_length_byte));
+ if (tx_cfg->enable_length_byte == optionOn) {
+ ret = rf69_set_packet_format(dev->spi, packetLengthVar);
+ if (ret < 0)
+ return ret;
+ } else {
+ ret = rf69_set_packet_format(dev->spi, packetLengthFix);
+ if (ret < 0)
+ return ret;
+ }
SET_CHECKED(rf69_set_crc_enable (dev->spi, tx_cfg->enable_crc));
/* configure sync, if enabled */