mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #1675 from thomaseichinger/rf231_channel_setting
drivers/at86rf231: handle channel out of range more conveniently
This commit is contained in:
commit
22bf40e85e
@ -173,14 +173,17 @@ uint16_t at86rf231_get_pan(void)
|
||||
return radio_pan;
|
||||
}
|
||||
|
||||
uint8_t at86rf231_set_channel(uint8_t channel)
|
||||
int8_t at86rf231_set_channel(uint8_t channel)
|
||||
{
|
||||
uint8_t cca_state;
|
||||
radio_channel = channel;
|
||||
|
||||
if (channel < RF86RF231_MIN_CHANNEL ||
|
||||
channel > RF86RF231_MAX_CHANNEL) {
|
||||
radio_channel = RF86RF231_MAX_CHANNEL;
|
||||
#if DEVELHELP
|
||||
puts("[at86rf231] channel out of range!");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
cca_state = at86rf231_reg_read(AT86RF231_REG__PHY_CC_CCA) & ~AT86RF231_PHY_CC_CCA_MASK__CHANNEL;
|
||||
|
@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
#ifndef AT86RF231_H_
|
||||
#define AT86RF231_H_
|
||||
|
||||
@ -52,7 +60,7 @@ void at86rf231_rx_irq(void);
|
||||
|
||||
int16_t at86rf231_send(at86rf231_packet_t *packet);
|
||||
|
||||
uint8_t at86rf231_set_channel(uint8_t channel);
|
||||
int8_t at86rf231_set_channel(uint8_t channel);
|
||||
uint8_t at86rf231_get_channel(void);
|
||||
|
||||
uint16_t at86rf231_set_pan(uint16_t pan);
|
||||
|
Loading…
Reference in New Issue
Block a user