Skip to content

Commit

Permalink
Squashed 'connectivity/drivers/802.15.4_RF/atmel-rf-driver/' changes …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
artokin committed Dec 8, 2021
1 parent e8bf06a commit 233ec78
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
30 changes: 30 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#################################################################################
## Copyright 2020-2021 Pelion.
##
## SPDX-License-Identifier: Apache-2.0
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
#################################################################################

target_include_directories(mbed-802.15.4-rf
INTERFACE
atmel-rf-driver
source
)

target_sources(mbed-802.15.4-rf
INTERFACE
source/NanostackRfPhyAT86RF215.cpp
source/NanostackRfPhyAtmel.cpp
source/at24mac.cpp
)
9 changes: 5 additions & 4 deletions source/NanostackRfPhyAT86RF215.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,19 +703,20 @@ static void rf_handle_rx_done(void)
rf_state = RF_IDLE;
}
if (rf_read_bbc_register(BBC_PC, rf_module) & FCSOK) {
if (!rf_read_rx_buffer(cur_rx_packet_len, rf_module)) {
uint16_t rx_packet_len = rf_read_rx_frame_length(rf_module);
if (!rf_read_rx_buffer(rx_packet_len, rf_module)) {
uint8_t version = ((rx_buffer[1] & VERSION_FIELD_MASK) >> SHIFT_VERSION_FIELD);
if (((rx_buffer[0] & MAC_FRAME_TYPE_MASK) == MAC_TYPE_ACK) && (version < MAC_FRAME_VERSION_2)) {
rf_handle_ack(rx_buffer[2], rx_buffer[0] & MAC_DATA_PENDING);
} else {
int8_t rssi = (int8_t) rf_read_rf_register(RF_EDV, rf_module);
// Cut CRC bytes
if (mac_mode == IEEE_802_15_4_2011) {
cur_rx_packet_len -= 2;
rx_packet_len -= 2;
} else {
cur_rx_packet_len -= 4;
rx_packet_len -= 4;
}
device_driver.phy_rx_cb(rx_buffer, cur_rx_packet_len, 0xf0, rssi, rf_radio_driver_id);
device_driver.phy_rx_cb(rx_buffer, rx_packet_len, 0xf0, rssi, rf_radio_driver_id);
// If auto ack used, must wait until RF returns to RF_TXPREP state
if ((version != MAC_FRAME_VERSION_2) && (rx_buffer[0] & FC_AR)) {
wait_us(100);
Expand Down

0 comments on commit 233ec78

Please sign in to comment.