Skip to content

Commit a7c3065

Browse files
committed
changed eirp to signed, deleted unnecessary defines in driver
1 parent 42655fc commit a7c3065

File tree

3 files changed

+4
-51
lines changed

3 files changed

+4
-51
lines changed

stack/framework/hal/chips/netdev_driver/netdev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,9 @@ void hw_radio_enable_preloading(bool enable)
355355
netdev->driver->set(netdev, NETOPT_PRELOADING, &netopt_enable, sizeof(netopt_enable_t));
356356
}
357357

358-
void hw_radio_set_tx_power(uint8_t eirp)
358+
void hw_radio_set_tx_power(int8_t eirp)
359359
{
360-
netdev->driver->set(netdev, NETOPT_TX_POWER, &eirp, sizeof(uint8_t));
360+
netdev->driver->set(netdev, NETOPT_TX_POWER, &eirp, sizeof(int8_t));
361361
}
362362

363363
void hw_radio_set_rx_timeout(uint32_t timeout)

stack/framework/hal/chips/sx127x/sx127x.c

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -53,53 +53,6 @@
5353
#define FG_THRESHOLD 32
5454
#define FIFO_AVAILABLE_SPACE FIFO_SIZE - FG_THRESHOLD
5555

56-
// modulation settings
57-
// lo rate
58-
// BR 0x0D05 => 9600.960 bps
59-
#define BITRATEMSB_L 0x0D
60-
#define BITRATELSB_L 0x05
61-
// Fdev => 4.8 kHz
62-
#define FDEVMSB_L 0x00
63-
#define FDEVLSB_L 0x4F
64-
// Carson's rule: 2 x fm + 2 x fd = 9.600 + 2 x 4.800 = 19.2 kHz
65-
// assuming 1 ppm crystals gives max error of: 2 * 1 ppm * 868 = 1.736 kHz
66-
// => BW > 19.2 + 1.736 kHz => > 20.936 kHZ.
67-
// This results in 10.468 kHz on a single sideband.
68-
// Closest possible value is 10.4 kHz. This is an actual ppm of 0.92. ((2 << 3) | 5)
69-
// Other possibility is 12.5 kHz. This is an actual ppm of 3.34. ((1 << 3) | 5)
70-
#define RXBW_L ((2 << 3) | 5) // TODO validate sensitivity / xtal accuracy tradeoff
71-
72-
// normal rate
73-
// BR 0x0240 => 55555.55555 bps
74-
#define BITRATEMSB_N 0x02
75-
#define BITRATELSB_N 0x40
76-
// Fdev => 49.988 kHz
77-
#define FDEVMSB_N 0x03
78-
#define FDEVLSB_N 0x33
79-
// data rate 55.542 kBaud
80-
// Carson's rule: 2 x fm + 2 x fd = 55.555 + 2 x 50 = 155.555 kHz
81-
// assuming 1 ppm crystals gives max error of: 2 * 1 ppm * 868 = 1.736 kHz
82-
// => BW > 155.555 + 1.736 => 157.291 kHz.
83-
// This results in 78.646 kHz on a single sideband.
84-
// Closest possible value is 83.3 kHz. This is an actual ppm of 6.36.
85-
// TODO bit too high, next step is 200, validate sensitivity / xtal accuracy tradeoff
86-
#define RXBW_N ((2 << 3) | 2)
87-
88-
// hi rate
89-
// BR 0x00C0 => 166666.667 bps
90-
#define BITRATEMSB_H 0x00
91-
#define BITRATELSB_H 0xC0
92-
// Fdev => 41.667 kHz
93-
#define FDEVMSB_H 0x02
94-
#define FDEVLSB_H 0xAA
95-
// Carson's rule: 2 x fm + 2 x fd = 166.667 + 2 x 41.667 = 250 kHz
96-
// assuming 1 ppm crystals gives max error of: 2 * 1 ppm * 868 = 1.736 kHz
97-
// => BW > 250 + 1.736 kHz => 251.736 kHz.
98-
// This results in 125.868 kHz on a single sideband.
99-
// Closest possible value is 125 kHz. This is an actual ppm of 0. ((0 << 3) | 2)
100-
// Other possibility is 166.7 kHz. This is an actual ppm of 48.04. ((2 << 3) | 1)
101-
#define RXBW_H ((0 << 3) | 2) // TODO validate sensitivity / xtal accuracy tradeoff
102-
10356
#if defined(FRAMEWORK_LOG_ENABLED) && defined(FRAMEWORK_PHY_LOG_ENABLED)
10457
#define DPRINT(...) log_print_stack_string(LOG_STACK_PHY, __VA_ARGS__)
10558
#define DPRINT_DATA(...) log_print_data(__VA_ARGS__)
@@ -932,7 +885,7 @@ void hw_radio_enable_preloading(bool enable) {
932885
enable_preloading = enable;
933886
}
934887

935-
void hw_radio_set_tx_power(uint8_t eirp) { // TODO signed
888+
void hw_radio_set_tx_power(int8_t eirp) { // TODO signed
936889
if(eirp < -5) {
937890
eirp = -5;
938891
DPRINT("The given eirp is too low, adjusted to %d dBm, offset excluded", eirp);

stack/framework/hal/inc/hwradio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ bool hw_radio_is_rx(void);
447447
void hw_radio_enable_refill(bool enable);
448448
void hw_radio_enable_preloading(bool enable);
449449

450-
void hw_radio_set_tx_power(uint8_t eirp); // TODO signed
450+
void hw_radio_set_tx_power(int8_t eirp); // TODO signed
451451

452452
void hw_radio_set_rx_timeout(uint32_t timeout);
453453

0 commit comments

Comments
 (0)