A mbed library for the RN2483. Heavily based on the Sodaq_RN2483 library for Arduino (https://github.com/SodaqMoja/Sodaq_RN2483). This is currently under-going initial testing, but seems to work! Tested on a NRF51 and FRDM K64F.
Dependents: rn2483-TestProgram
Utils.h
- Committer:
- azazeal88
- Date:
- 2016-12-19
- Revision:
- 8:c4069091afa1
- Parent:
- 0:a8609e6f88f3
File content as of revision 8:c4069091afa1:
/* * Copyright (c) 2016 Dan Knox. All rights reserved. * * This file is part of MicrochipLoRaWAN. * * MicrochipLoRaWAN is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of * the License, or(at your option) any later version. * * MicrochipLoRaWAN is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with MicrochipLoRaWAN. If not, see * <http://www.gnu.org/licenses/>. */ #ifndef _UTILS_h #define _UTILS_h #define BOOL_TO_ONOFF(b) (b ? "on" : "off") #define NIBBLE_TO_HEX_CHAR(i) ((i <= 9) ? ('0' + i) : ('A' - 10 + i)) #define HIGH_NIBBLE(i) ((i >> 4) & 0x0F) #define LOW_NIBBLE(i) (i & 0x0F) #define HEX_CHAR_TO_NIBBLE(c) ((c >= 'A') ? (c - 'A' + 0x0A) : (c - '0')) #define HEX_PAIR_TO_BYTE(h, l) ((HEX_CHAR_TO_NIBBLE(h) << 4) + HEX_CHAR_TO_NIBBLE(l)) #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) #endif