mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
gnrc/lorawan: support for single channel gateways
tmp1
This commit is contained in:
parent
a06268a5ca
commit
5d489957ab
@ -27,9 +27,19 @@ extern "C" {
|
||||
|
||||
/**
|
||||
* @brief Default LoRaWAN channels
|
||||
*
|
||||
* @note It is possible to use a single channel, e.g., when using a single or
|
||||
* dual channel gateway, by defining the macro `GNRC_LORAWAN_SINGLE_CHANNEL`
|
||||
* during compilation, which specifies the single channel frequency to be used.
|
||||
* For example:
|
||||
* ```
|
||||
* CFLAGS='-DGNRC_LORAWAN_SINGLE_CHANNEL=868100000UL'
|
||||
* ```
|
||||
*/
|
||||
static const uint32_t gnrc_lorawan_default_channels[] = {
|
||||
#if (IS_ACTIVE(CONFIG_LORAMAC_REGION_EU_868))
|
||||
#if defined(GNRC_LORAWAN_SINGLE_CHANNEL)
|
||||
GNRC_LORAWAN_SINGLE_CHANNEL
|
||||
#elif (IS_ACTIVE(CONFIG_LORAMAC_REGION_EU_868) || defined(DOXYGEN))
|
||||
868100000UL,
|
||||
868300000UL,
|
||||
868500000UL
|
||||
@ -40,6 +50,7 @@ static const uint32_t gnrc_lorawan_default_channels[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#define GNRC_LORAWAN_DEFAULT_CHANNELS_NUMOF \
|
||||
ARRAY_SIZE(gnrc_lorawan_default_channels) /**< Number of default channels */
|
||||
|
||||
|
@ -111,15 +111,17 @@ uint32_t gnrc_lorawan_pick_channel(gnrc_lorawan_t *mac)
|
||||
|
||||
void gnrc_lorawan_process_cflist(gnrc_lorawan_t *mac, uint8_t *cflist)
|
||||
{
|
||||
/* TODO: Check CFListType to 0 */
|
||||
for (unsigned i = GNRC_LORAWAN_DEFAULT_CHANNELS_NUMOF; i < 8; i++) {
|
||||
le_uint32_t cl;
|
||||
cl.u32 = 0;
|
||||
memcpy(&cl, cflist, GNRC_LORAWAN_CFLIST_ENTRY_SIZE);
|
||||
mac->channel[i] = byteorder_ltohl(cl) * 100;
|
||||
mac->channel_mask |= 1 << i;
|
||||
cflist += GNRC_LORAWAN_CFLIST_ENTRY_SIZE;
|
||||
DEBUG("gnrc_lorawan_region: Mac -> Channel %u %" PRIu32 " \n", i, mac->channel[i]);
|
||||
if (!IS_USED(GNRC_LORAWAN_SINGLE_CHANNEL)) {
|
||||
/* TODO: Check CFListType to 0 */
|
||||
for (unsigned i = GNRC_LORAWAN_DEFAULT_CHANNELS_NUMOF; i < 8; i++) {
|
||||
le_uint32_t cl;
|
||||
cl.u32 = 0;
|
||||
memcpy(&cl, cflist, GNRC_LORAWAN_CFLIST_ENTRY_SIZE);
|
||||
mac->channel[i] = byteorder_ltohl(cl) * 100;
|
||||
mac->channel_mask |= 1 << i;
|
||||
cflist += GNRC_LORAWAN_CFLIST_ENTRY_SIZE;
|
||||
DEBUG("gnrc_lorawan_region: Mac -> Channel %u %" PRIu32 " \n", i, mac->channel[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user