Bluenet
5.7.0
Bluenet, firmware for nRF52 smart home devices
|
#include <ble/cs_Nordic.h>
#include <logging/cs_Logger.h>
#include <string>
#include "protocol/cs_ErrorCodes.h"
#include "structs/cs_PacketsInternal.h"
Go to the source code of this file.
Namespaces | |
namespace | CsUtils |
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 29, 2014 License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed) | |
Macros | |
#define | CS_ROUND_UP_TO_MULTIPLE_OF(num, multiple) (((num + multiple - 1) / multiple) * multiple) |
Macro that rounds up to the next multiple of given number. More... | |
#define | CS_ROUND_UP_TO_MULTIPLE_OF_POWER_OF_2(num, multiple) ((num + multiple - 1) & -multiple) |
Macro that rounds up to the next multiple of given number that is a power of 2. More... | |
Functions | |
uint16_t | CsUtils::convertEndian16 (uint16_t val) |
Convert a short (uint16_t) from LSB (little-endian) to MSB (big-endian) and vice versa. More... | |
uint32_t | CsUtils::convertEndian32 (uint32_t val) |
Convert an integer (uint32_t) from LSB (little-endian) to MSB (big-endian) and vice versa. More... | |
template<class T , size_t N> | |
constexpr auto | CsUtils::ArraySize (T(&)[N]) |
Get number of items in an array. More... | |
template<typename T > | |
void | CsUtils::printAddress (T *arr, uint16_t len, uint8_t verbosity=SERIAL_DEBUG, bool addNewLine=true) |
void | CsUtils::print_heap (const std::string &msg) |
void | CsUtils::print_stack (const std::string &msg) |
template<typename T > | |
bool | CsUtils::isBitSet (const T value, uint8_t bit) |
template<typename T > | |
bool | CsUtils::setBit (T &value, uint8_t bit) |
template<typename T > | |
bool | CsUtils::clearBit (T &value, uint8_t bit) |
template<typename T > | |
constexpr T | CsUtils::lowestBitSet (T value) |
Returns the index of the lowest bit set in given value. More... | |
bool | CsUtils::isNewer (uint8_t previousValue, uint8_t newValue) |
Returns true when newValue is newer than previousValue, for a value that is increased all the time and overflows. More... | |
static cs_ret_code_t | CsUtils::findAdvType (uint8_t type, uint8_t *advData, uint8_t advLen, cs_data_t *foundData) |
Parses advertisement data, providing length and location of the field in case matching data is found. More... | |
constexpr uint16_t | CsUtils::stringLen (const char *str, uint16_t maxSize) |
Gets the string length of a null terminated constant string. More... | |
uint32_t | CsUtils::getInterruptLevel () |
#define CS_ROUND_UP_TO_MULTIPLE_OF | ( | num, | |
multiple | |||
) | (((num + multiple - 1) / multiple) * multiple) |
Macro that rounds up to the next multiple of given number.
Does not work for negative values.
#define CS_ROUND_UP_TO_MULTIPLE_OF_POWER_OF_2 | ( | num, | |
multiple | |||
) | ((num + multiple - 1) & -multiple) |
Macro that rounds up to the next multiple of given number that is a power of 2.
Also works for negative values.