Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
9328a1f2
Commit
9328a1f2
authored
7 years ago
by
Alexandre Abadie
Browse files
Options
Downloads
Patches
Plain Diff
drivers/sx127x: make paselect configurable
parent
690c36b3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
drivers/include/sx127x.h
+13
-9
13 additions, 9 deletions
drivers/include/sx127x.h
drivers/sx127x/include/sx127x_params.h
+6
-1
6 additions, 1 deletion
drivers/sx127x/include/sx127x_params.h
drivers/sx127x/sx127x_getset.c
+5
-15
5 additions, 15 deletions
drivers/sx127x/sx127x_getset.c
with
24 additions
and
25 deletions
drivers/include/sx127x.h
+
13
−
9
View file @
9328a1f2
...
...
@@ -83,17 +83,8 @@ extern "C" {
#define SX127X_TX_TIMEOUT_DEFAULT (1000U * 1000U * 30UL)
/**< TX timeout, 30s */
#define SX127X_RX_SINGLE (false)
/**< Single byte receive mode => continuous by default */
#define SX127X_RX_BUFFER_SIZE (256)
/**< RX buffer size */
#define SX127X_RADIO_TX_POWER (14U)
/**< Radio power in dBm */
#ifndef SX1272_DEFAULT_PASELECT
/** @brief Default PA selection config (1: RFO, 0: PABOOST)
*
* This depends on the module configuration.
*/
#define SX1272_DEFAULT_PASELECT (1U)
#endif
#define SX127X_EVENT_HANDLER_STACK_SIZE (2048U)
/**< Stack size event handler */
#define SX127X_IRQ_DIO0 (1<<0)
/**< DIO0 IRQ */
#define SX127X_IRQ_DIO1 (1<<1)
/**< DIO1 IRQ */
...
...
@@ -144,6 +135,18 @@ enum {
SX127X_CAD_DONE
,
/**< Channel activity detection complete */
};
/**
* @brief Power amplifier modes
*
* Default value is SX127X_PA_RFO.
*
* The power amplifier mode depends on the module hardware configuration.
*/
enum
{
SX127X_PA_RFO
=
0
,
/**< RFO HF or RFO LF */
SX127X_PA_BOOST
,
/**< Power amplifier boost (high power) */
};
/**
* @name SX127X device descriptor boolean flags
* @{
...
...
@@ -205,6 +208,7 @@ typedef struct {
gpio_t
dio3_pin
;
/**< Interrupt line DIO3 (CAD done) */
gpio_t
dio4_pin
;
/**< Interrupt line DIO4 (not used) */
gpio_t
dio5_pin
;
/**< Interrupt line DIO5 (not used) */
uint8_t
paselect
;
/**< Power amplifier mode (RFO or PABOOST) */
}
sx127x_params_t
;
/**
...
...
This diff is collapsed.
Click to expand it.
drivers/sx127x/include/sx127x_params.h
+
6
−
1
View file @
9328a1f2
...
...
@@ -60,6 +60,10 @@ extern "C" {
#define SX127X_PARAM_DIO3 GPIO_PIN(1, 4)
/* D5 */
#endif
#ifndef SX127X_PARAM_PASELECT
#define SX127X_PARAM_PASELECT (SX127X_PA_RFO)
#endif
#ifndef SX127X_PARAMS
#define SX127X_PARAMS { .spi = SX127X_PARAM_SPI, \
.nss_pin = SX127X_PARAM_SPI_NSS, \
...
...
@@ -67,7 +71,8 @@ extern "C" {
.dio0_pin = SX127X_PARAM_DIO0, \
.dio1_pin = SX127X_PARAM_DIO1, \
.dio2_pin = SX127X_PARAM_DIO2, \
.dio3_pin = SX127X_PARAM_DIO3 }
.dio3_pin = SX127X_PARAM_DIO3, \
.paselect = SX127X_PARAM_PASELECT }
#endif
/**@}*/
...
...
This diff is collapsed.
Click to expand it.
drivers/sx127x/sx127x_getset.c
+
5
−
15
View file @
9328a1f2
...
...
@@ -707,23 +707,13 @@ void sx127x_set_payload_length(sx127x_t *dev, uint8_t len)
sx127x_reg_write
(
dev
,
SX127X_REG_LR_PAYLOADLENGTH
,
len
);
}
static
inline
uint8_t
sx127x_get_pa_select
(
uint32_t
channel
)
static
inline
uint8_t
sx127x_get_pa_select
(
const
sx127x_t
*
dev
)
{
#if defined(MODULE_SX1272)
(
void
)
channel
;
#if SX1272_DEFAULT_PASELECT
return
SX127X_RF_PACONFIG_PASELECT_RFO
;
#else
return
SX127X_RF_PACONFIG_PASELECT_PABOOST
;
#endif
#else
/* MODULE_SX1276 */
if
(
channel
<
SX127X_RF_MID_BAND_THRESH
)
{
if
(
dev
->
params
.
paselect
==
SX127X_PA_BOOST
)
{
return
SX127X_RF_PACONFIG_PASELECT_PABOOST
;
}
else
{
return
SX127X_RF_PACONFIG_PASELECT_RFO
;
}
#endif
return
SX127X_RF_PACONFIG_PASELECT_RFO
;
}
uint8_t
sx127x_get_tx_power
(
const
sx127x_t
*
dev
)
...
...
@@ -745,7 +735,7 @@ void sx127x_set_tx_power(sx127x_t *dev, int8_t power)
#endif
pa_config
=
((
pa_config
&
SX127X_RF_PACONFIG_PASELECT_MASK
)
|
sx127x_get_pa_select
(
dev
->
settings
.
channel
));
sx127x_get_pa_select
(
dev
));
#if defined(MODULE_SX1276)
/* max power is 14dBm */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment