mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #1 from ARMmbed/ns_pollution
Removing namespace pollution & rf ctrls refactorpull/12741/head
commit
d7e60e443a
|
@ -26,23 +26,24 @@ SPDX-License-Identifier: BSD-3-Clause
|
||||||
#ifndef SX1272_LORARADIO_H_
|
#ifndef SX1272_LORARADIO_H_
|
||||||
#define SX1272_LORARADIO_H_
|
#define SX1272_LORARADIO_H_
|
||||||
|
|
||||||
|
#include "PinNames.h"
|
||||||
|
#include "InterruptIn.h"
|
||||||
|
#include "DigitalOut.h"
|
||||||
|
#include "DigitalInOut.h"
|
||||||
|
#include "SPI.h"
|
||||||
|
#include "Timeout.h"
|
||||||
|
#ifdef MBED_CONF_RTOS_PRESENT
|
||||||
|
#include "rtos/Thread.h"
|
||||||
|
#endif
|
||||||
#include "netsocket/LoRaRadio.h"
|
#include "netsocket/LoRaRadio.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef MBED_SX1272_LORARADIO_BUFFER_SIZE
|
#ifdef MBED_SX1272_LORARADIO_BUFFER_SIZE
|
||||||
#define MAX_DATA_BUFFER_SIZE MBED_SX1272_LORARADIO_BUFFER_SIZE
|
#define MAX_DATA_BUFFER_SIZE MBED_SX1272_LORARADIO_BUFFER_SIZE
|
||||||
#else
|
#else
|
||||||
#define MAX_DATA_BUFFER_SIZE 256
|
#define MAX_DATA_BUFFER_SIZE 256
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PinName rf_switch_ctl1;
|
|
||||||
PinName rf_switch_ctl2;
|
|
||||||
PinName txctl;
|
|
||||||
PinName rxctl;
|
|
||||||
PinName ant_switch;
|
|
||||||
PinName pwr_amp_ctl;
|
|
||||||
} rf_ctrls;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Radio driver implementation for Semtech SX1272 plus variants.
|
* Radio driver implementation for Semtech SX1272 plus variants.
|
||||||
* Supports only SPI at the moment. Implements pure virtual LoRaRadio class.
|
* Supports only SPI at the moment. Implements pure virtual LoRaRadio class.
|
||||||
|
@ -301,27 +302,27 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// SPI and chip select control
|
// SPI and chip select control
|
||||||
SPI _spi;
|
mbed::SPI _spi;
|
||||||
DigitalOut _chip_select;
|
mbed::DigitalOut _chip_select;
|
||||||
|
|
||||||
// module rest control
|
// module rest control
|
||||||
DigitalInOut _reset_ctl;
|
mbed::DigitalInOut _reset_ctl;
|
||||||
|
|
||||||
// Interrupt controls
|
// Interrupt controls
|
||||||
InterruptIn _dio0_ctl;
|
mbed::InterruptIn _dio0_ctl;
|
||||||
InterruptIn _dio1_ctl;
|
mbed::InterruptIn _dio1_ctl;
|
||||||
InterruptIn _dio2_ctl;
|
mbed::InterruptIn _dio2_ctl;
|
||||||
InterruptIn _dio3_ctl;
|
mbed::InterruptIn _dio3_ctl;
|
||||||
InterruptIn _dio4_ctl;
|
mbed::InterruptIn _dio4_ctl;
|
||||||
InterruptIn _dio5_ctl;
|
mbed::InterruptIn _dio5_ctl;
|
||||||
|
|
||||||
// Radio specific controls
|
// Radio specific controls
|
||||||
DigitalOut _rf_switch_ctl1;
|
mbed::DigitalOut _rf_switch_ctl1;
|
||||||
DigitalOut _rf_switch_ctl2;
|
mbed::DigitalOut _rf_switch_ctl2;
|
||||||
DigitalOut _txctl;
|
mbed::DigitalOut _txctl;
|
||||||
DigitalOut _rxctl;
|
mbed::DigitalOut _rxctl;
|
||||||
DigitalInOut _ant_switch;
|
mbed::DigitalInOut _ant_switch;
|
||||||
DigitalOut _pwr_amp_ctl;
|
mbed::DigitalOut _pwr_amp_ctl;
|
||||||
|
|
||||||
// Contains all RF control pin names
|
// Contains all RF control pin names
|
||||||
// This storage is needed even after assigning the
|
// This storage is needed even after assigning the
|
||||||
|
@ -343,13 +344,13 @@ private:
|
||||||
uint8_t _data_buffer[MAX_DATA_BUFFER_SIZE];
|
uint8_t _data_buffer[MAX_DATA_BUFFER_SIZE];
|
||||||
|
|
||||||
// TX/RX Timers - all use milisecond units
|
// TX/RX Timers - all use milisecond units
|
||||||
Timeout tx_timeout_timer;
|
mbed::Timeout tx_timeout_timer;
|
||||||
Timeout rx_timeout_timer;
|
mbed::Timeout rx_timeout_timer;
|
||||||
Timeout rx_timeout_sync_word;
|
mbed::Timeout rx_timeout_sync_word;
|
||||||
|
|
||||||
#ifdef MBED_CONF_RTOS_PRESENT
|
#ifdef MBED_CONF_RTOS_PRESENT
|
||||||
// Thread to handle interrupts
|
// Thread to handle interrupts
|
||||||
Thread irq_thread;
|
rtos::Thread irq_thread;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Access protection
|
// Access protection
|
||||||
|
|
|
@ -26,6 +26,15 @@ SPDX-License-Identifier: BSD-3-Clause
|
||||||
#ifndef SX1276_LORARADIO_H_
|
#ifndef SX1276_LORARADIO_H_
|
||||||
#define SX1276_LORARADIO_H_
|
#define SX1276_LORARADIO_H_
|
||||||
|
|
||||||
|
#include "PinNames.h"
|
||||||
|
#include "InterruptIn.h"
|
||||||
|
#include "DigitalOut.h"
|
||||||
|
#include "DigitalInOut.h"
|
||||||
|
#include "SPI.h"
|
||||||
|
#include "Timeout.h"
|
||||||
|
#ifdef MBED_CONF_RTOS_PRESENT
|
||||||
|
#include "rtos/Thread.h"
|
||||||
|
#endif
|
||||||
#include "netsocket/LoRaRadio.h"
|
#include "netsocket/LoRaRadio.h"
|
||||||
|
|
||||||
#ifdef MBED_SX1276_LORARADIO_BUFFER_SIZE
|
#ifdef MBED_SX1276_LORARADIO_BUFFER_SIZE
|
||||||
|
@ -34,16 +43,6 @@ SPDX-License-Identifier: BSD-3-Clause
|
||||||
#define MAX_DATA_BUFFER_SIZE 256
|
#define MAX_DATA_BUFFER_SIZE 256
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PinName rf_switch_ctl1;
|
|
||||||
PinName rf_switch_ctl2;
|
|
||||||
PinName txctl;
|
|
||||||
PinName rxctl;
|
|
||||||
PinName ant_switch;
|
|
||||||
PinName pwr_amp_ctl;
|
|
||||||
PinName tcxo;
|
|
||||||
} rf_ctrls;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Radio driver implementation for Semtech SX1272 plus variants.
|
* Radio driver implementation for Semtech SX1272 plus variants.
|
||||||
* Supports only SPI at the moment. Implements pure virtual LoRaRadio class.
|
* Supports only SPI at the moment. Implements pure virtual LoRaRadio class.
|
||||||
|
@ -318,28 +317,28 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// SPI and chip select control
|
// SPI and chip select control
|
||||||
SPI _spi;
|
mbed::SPI _spi;
|
||||||
DigitalOut _chip_select;
|
mbed::DigitalOut _chip_select;
|
||||||
|
|
||||||
// module rest control
|
// module rest control
|
||||||
DigitalInOut _reset_ctl;
|
mbed::DigitalInOut _reset_ctl;
|
||||||
|
|
||||||
// Interrupt controls
|
// Interrupt controls
|
||||||
InterruptIn _dio0_ctl;
|
mbed::InterruptIn _dio0_ctl;
|
||||||
InterruptIn _dio1_ctl;
|
mbed::InterruptIn _dio1_ctl;
|
||||||
InterruptIn _dio2_ctl;
|
mbed::InterruptIn _dio2_ctl;
|
||||||
InterruptIn _dio3_ctl;
|
mbed::InterruptIn _dio3_ctl;
|
||||||
InterruptIn _dio4_ctl;
|
mbed::InterruptIn _dio4_ctl;
|
||||||
InterruptIn _dio5_ctl;
|
mbed::InterruptIn _dio5_ctl;
|
||||||
|
|
||||||
// Radio specific controls
|
// Radio specific controls
|
||||||
DigitalOut _rf_switch_ctl1;
|
mbed::DigitalOut _rf_switch_ctl1;
|
||||||
DigitalOut _rf_switch_ctl2;
|
mbed::DigitalOut _rf_switch_ctl2;
|
||||||
DigitalOut _txctl;
|
mbed::DigitalOut _txctl;
|
||||||
DigitalOut _rxctl;
|
mbed::DigitalOut _rxctl;
|
||||||
DigitalInOut _ant_switch;
|
mbed::DigitalInOut _ant_switch;
|
||||||
DigitalOut _pwr_amp_ctl;
|
mbed::DigitalOut _pwr_amp_ctl;
|
||||||
DigitalOut _tcxo;
|
mbed::DigitalOut _tcxo;
|
||||||
|
|
||||||
// Contains all RF control pin names
|
// Contains all RF control pin names
|
||||||
// This storage is needed even after assigning the
|
// This storage is needed even after assigning the
|
||||||
|
@ -361,13 +360,13 @@ private:
|
||||||
uint8_t _data_buffer[MAX_DATA_BUFFER_SIZE];
|
uint8_t _data_buffer[MAX_DATA_BUFFER_SIZE];
|
||||||
|
|
||||||
// TX/RX Timers - all use milisecond units
|
// TX/RX Timers - all use milisecond units
|
||||||
Timeout tx_timeout_timer;
|
mbed::Timeout tx_timeout_timer;
|
||||||
Timeout rx_timeout_timer;
|
mbed::Timeout rx_timeout_timer;
|
||||||
Timeout rx_timeout_sync_word;
|
mbed::Timeout rx_timeout_sync_word;
|
||||||
|
|
||||||
#ifdef MBED_CONF_RTOS_PRESENT
|
#ifdef MBED_CONF_RTOS_PRESENT
|
||||||
// Thread to handle interrupts
|
// Thread to handle interrupts
|
||||||
Thread irq_thread;
|
rtos::Thread irq_thread;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Access protection
|
// Access protection
|
||||||
|
@ -419,6 +418,5 @@ private:
|
||||||
void handle_dio4_irq();
|
void handle_dio4_irq();
|
||||||
void handle_dio5_irq();
|
void handle_dio5_irq();
|
||||||
void handle_timeout_irq();
|
void handle_timeout_irq();
|
||||||
};
|
|
||||||
|
|
||||||
#endif // SX1276_LORARADIO_H_
|
#endif // SX1276_LORARADIO_H_
|
||||||
|
|
Loading…
Reference in New Issue