Skip to content

Commit 233ec78

Browse files
committed
Squashed 'connectivity/drivers/802.15.4_RF/atmel-rf-driver/' changes from 834c5357c6..ccba775217
ccba775217 Merge pull request ARMmbed#110 from PelionIoT/sync_from_mbed_os 301b184ba4 Update copyright 3c9927a4e8 Sync from Mbed OS 68a243c432 Merge pull request ARMmbed#109 from PelionIoT/IOTTHD-4839 55004765bd Read received packet length in RX done callback git-subtree-dir: connectivity/drivers/802.15.4_RF/atmel-rf-driver git-subtree-split: ccba7752172988f2c50a646af09dd0c1e91d4fc8
1 parent e8bf06a commit 233ec78

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#################################################################################
2+
## Copyright 2020-2021 Pelion.
3+
##
4+
## SPDX-License-Identifier: Apache-2.0
5+
##
6+
## Licensed under the Apache License, Version 2.0 (the "License");
7+
## you may not use this file except in compliance with the License.
8+
## You may obtain a copy of the License at
9+
##
10+
## http://www.apache.org/licenses/LICENSE-2.0
11+
##
12+
## Unless required by applicable law or agreed to in writing, software
13+
## distributed under the License is distributed on an "AS IS" BASIS,
14+
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
## See the License for the specific language governing permissions and
16+
## limitations under the License.
17+
#################################################################################
18+
19+
target_include_directories(mbed-802.15.4-rf
20+
INTERFACE
21+
atmel-rf-driver
22+
source
23+
)
24+
25+
target_sources(mbed-802.15.4-rf
26+
INTERFACE
27+
source/NanostackRfPhyAT86RF215.cpp
28+
source/NanostackRfPhyAtmel.cpp
29+
source/at24mac.cpp
30+
)

source/NanostackRfPhyAT86RF215.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -703,19 +703,20 @@ static void rf_handle_rx_done(void)
703703
rf_state = RF_IDLE;
704704
}
705705
if (rf_read_bbc_register(BBC_PC, rf_module) & FCSOK) {
706-
if (!rf_read_rx_buffer(cur_rx_packet_len, rf_module)) {
706+
uint16_t rx_packet_len = rf_read_rx_frame_length(rf_module);
707+
if (!rf_read_rx_buffer(rx_packet_len, rf_module)) {
707708
uint8_t version = ((rx_buffer[1] & VERSION_FIELD_MASK) >> SHIFT_VERSION_FIELD);
708709
if (((rx_buffer[0] & MAC_FRAME_TYPE_MASK) == MAC_TYPE_ACK) && (version < MAC_FRAME_VERSION_2)) {
709710
rf_handle_ack(rx_buffer[2], rx_buffer[0] & MAC_DATA_PENDING);
710711
} else {
711712
int8_t rssi = (int8_t) rf_read_rf_register(RF_EDV, rf_module);
712713
// Cut CRC bytes
713714
if (mac_mode == IEEE_802_15_4_2011) {
714-
cur_rx_packet_len -= 2;
715+
rx_packet_len -= 2;
715716
} else {
716-
cur_rx_packet_len -= 4;
717+
rx_packet_len -= 4;
717718
}
718-
device_driver.phy_rx_cb(rx_buffer, cur_rx_packet_len, 0xf0, rssi, rf_radio_driver_id);
719+
device_driver.phy_rx_cb(rx_buffer, rx_packet_len, 0xf0, rssi, rf_radio_driver_id);
719720
// If auto ack used, must wait until RF returns to RF_TXPREP state
720721
if ((version != MAC_FRAME_VERSION_2) && (rx_buffer[0] & FC_AR)) {
721722
wait_us(100);

0 commit comments

Comments
 (0)