Change MBED_STATIC_ASSERTs version for built-in

pull/13085/head
pea-pod 2020-06-08 22:52:36 -05:00
parent 78c8d84214
commit 507181d262
30 changed files with 109 additions and 105 deletions

View File

@ -141,7 +141,7 @@ struct Duration {
Duration(Duration<OtherRep, OtherTB, OtherRange, OtherF> other) :
duration(clamp(other.value() * (OtherTB / TB)))
{
MBED_STATIC_ASSERT(OtherTB >= TB && (OtherTB % TB) == 0, "Incompatible units");
static_assert(OtherTB >= TB && (OtherTB % TB) == 0, "Incompatible units");
}
/**

View File

@ -431,7 +431,7 @@ protected:
// Conversion function for network stacks
NetworkStack *nsapi_create_stack(nsapi_stack_t *stack)
{
MBED_STATIC_ASSERT(sizeof stack->_stack_buffer >= sizeof(NetworkStackWrapper),
"The nsapi_stack_t stack buffer must fit a NetworkStackWrapper");
static_assert(sizeof stack->_stack_buffer >= sizeof(NetworkStackWrapper),
"The nsapi_stack_t stack buffer must fit a NetworkStackWrapper");
return new (stack->_stack_buffer) NetworkStackWrapper;
}

View File

@ -23,8 +23,8 @@ namespace mbed {
SingletonPtr<PlatformMutex> mbed_crc_mutex;
MBED_STATIC_ASSERT(MBED_CRC_TABLE_SIZE == 0 || MBED_CRC_TABLE_SIZE == 16 || MBED_CRC_TABLE_SIZE == 256,
"Configuration setting drivers.crc-table-size must be set to 0, 16 or 256");
static_assert(MBED_CRC_TABLE_SIZE == 0 || MBED_CRC_TABLE_SIZE == 16 || MBED_CRC_TABLE_SIZE == 256,
"Configuration setting drivers.crc-table-size must be set to 0, 16 or 256");
#if MBED_CRC_TABLE_SIZE > 0

View File

@ -106,10 +106,10 @@ static void equeue_tick_update()
void equeue_tick_init()
{
MBED_STATIC_ASSERT(sizeof(equeue_timer) >= sizeof(ALIAS_TIMER),
"The equeue_timer buffer must fit the class Timer");
MBED_STATIC_ASSERT(sizeof(equeue_ticker) >= sizeof(ALIAS_TICKER),
"The equeue_ticker buffer must fit the class Ticker");
static_assert(sizeof(equeue_timer) >= sizeof(ALIAS_TIMER),
"The equeue_timer buffer must fit the class Timer");
static_assert(sizeof(equeue_ticker) >= sizeof(ALIAS_TICKER),
"The equeue_ticker buffer must fit the class Ticker");
ALIAS_TIMER *timer = new (equeue_timer) ALIAS_TIMER;
ALIAS_TICKER *ticker = new (equeue_ticker) ALIAS_TICKER;
@ -156,7 +156,7 @@ void equeue_mutex_unlock(equeue_mutex_t *m)
#include "rtos/EventFlags.h"
MBED_STATIC_ASSERT(sizeof(equeue_sema_t) == sizeof(rtos::EventFlags), "equeue_sema_t / rtos::EventFlags mismatch");
static_assert(sizeof(equeue_sema_t) == sizeof(rtos::EventFlags), "equeue_sema_t / rtos::EventFlags mismatch");
int equeue_sema_create(equeue_sema_t *s)
{

View File

@ -55,7 +55,7 @@ namespace v1 {
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
defaults(defaults)
{
MBED_STATIC_ASSERT(
static_assert(
sizeof(CaseType) == sizeof(Case),
"CaseType and Case should have the same size"
);
@ -69,7 +69,7 @@ namespace v1 {
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
defaults(defaults)
{
MBED_STATIC_ASSERT(
static_assert(
sizeof(CaseType) == sizeof(Case),
"CaseType and Case should have the same size"
);
@ -83,7 +83,7 @@ namespace v1 {
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
defaults(defaults)
{
MBED_STATIC_ASSERT(
static_assert(
sizeof(CaseType) == sizeof(Case),
"CaseType and Case should have the same size"
);
@ -98,7 +98,7 @@ namespace v1 {
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
defaults(defaults)
{
MBED_STATIC_ASSERT(
static_assert(
sizeof(CaseType) == sizeof(Case),
"CaseType and Case should have the same size"
);
@ -122,7 +122,7 @@ namespace v1 {
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
defaults(defaults)
{
MBED_STATIC_ASSERT(
static_assert(
sizeof(CaseType) == sizeof(Case),
"CaseType and Case should have the same size"
);
@ -137,7 +137,7 @@ namespace v1 {
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
defaults(defaults)
{
MBED_STATIC_ASSERT(
static_assert(
sizeof(CaseType) == sizeof(Case),
"CaseType and Case should have the same size"
);
@ -153,7 +153,7 @@ namespace v1 {
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
defaults(defaults)
{
MBED_STATIC_ASSERT(
static_assert(
sizeof(CaseType) == sizeof(Case),
"CaseType and Case should have the same size"
);

View File

@ -42,8 +42,8 @@ static const PinList ff_arduino_list = {
ff_arduino_pins
};
MBED_STATIC_ASSERT(sizeof(ff_arduino_pins) / sizeof(ff_arduino_pins[0]) == sizeof(ff_arduino_names) / sizeof(ff_arduino_names[0]),
"Arrays must have the same length");
static_assert(sizeof(ff_arduino_pins) / sizeof(ff_arduino_pins[0]) == sizeof(ff_arduino_names) / sizeof(ff_arduino_names[0]),
"Arrays must have the same length");
const PinList *pinmap_ff_arduino_pins()
{

View File

@ -33,7 +33,7 @@
#endif
#define MBED_MPU_RAM_START (MBED_MPU_ROM_END + 1)
MBED_STATIC_ASSERT(
static_assert(
MBED_MPU_ROM_END == 0x04000000 - 1 ||
MBED_MPU_ROM_END == 0x08000000 - 1 ||
MBED_MPU_ROM_END == 0x0C000000 - 1 ||

View File

@ -33,8 +33,8 @@
#endif
#define MBED_MPU_RAM_START (MBED_MPU_ROM_END + 1)
MBED_STATIC_ASSERT(MBED_MPU_ROM_END <= 0x20000000 - 1,
"Unsupported value for MBED_MPU_ROM_END");
static_assert(MBED_MPU_ROM_END <= 0x20000000 - 1,
"Unsupported value for MBED_MPU_ROM_END");
void mbed_mpu_init()
{

View File

@ -23,7 +23,6 @@
#include <mstd_memory>
#include <mstd_type_traits>
#include <mstd_utility>
#include "platform/mbed_assert.h"
#include "platform/mbed_atomic.h"
#include "platform/mbed_critical.h"
#include "platform/CriticalSectionLock.h"
@ -477,7 +476,7 @@ protected:
*/
template<typename T, typename A = atomic_container_t<T>>
struct AtomicBaseInt {
MBED_STRUCT_STATIC_ASSERT(sizeof(T) == sizeof(A), "AtomicBaseInt size mismatch");
static_assert(sizeof(T) == sizeof(A), "AtomicBaseInt size mismatch");
using value_type = T;
AtomicBaseInt() noexcept = default;
constexpr AtomicBaseInt(T v) noexcept : u(A(v))

View File

@ -70,12 +70,12 @@ class CircularBuffer {
public:
CircularBuffer() : _head(0), _tail(0), _full(false)
{
MBED_STATIC_ASSERT(
static_assert(
internal::is_unsigned<CounterType>::value,
"CounterType must be unsigned"
);
MBED_STATIC_ASSERT(
static_assert(
(sizeof(CounterType) >= sizeof(uint32_t)) ||
(BufferSize < (((uint64_t) 1) << (sizeof(CounterType) * 8))),
"Invalid BufferSize for the CounterType"

View File

@ -249,7 +249,7 @@ struct Span {
*/
static const index_type extent = Extent;
MBED_STATIC_ASSERT(Extent >= 0, "Invalid extent for a Span");
static_assert(Extent >= 0, "Invalid extent for a Span");
/**
* Construct an empty Span.
@ -262,7 +262,7 @@ struct Span {
Span() :
_data(NULL)
{
MBED_STATIC_ASSERT(
static_assert(
Extent == 0,
"Cannot default construct a static-extent Span (unless Extent is 0)"
);
@ -333,7 +333,7 @@ struct Span {
Span(const Span<OtherElementType, Extent> &other):
_data(other.data())
{
MBED_STATIC_ASSERT(
static_assert(
(span_detail::is_convertible<OtherElementType (*)[1], ElementType (*)[1]>::value),
"OtherElementType(*)[] should be convertible to ElementType (*)[]"
);
@ -440,7 +440,7 @@ struct Span {
template<ptrdiff_t Count>
Span<element_type, Count> first() const
{
MBED_STATIC_ASSERT(
static_assert(
(0 <= Count) && (Count <= Extent),
"Invalid subspan extent"
);
@ -459,7 +459,7 @@ struct Span {
template<ptrdiff_t Count>
Span<element_type, Count> last() const
{
MBED_STATIC_ASSERT(
static_assert(
(0 <= Count) && (Count <= Extent),
"Invalid subspan extent"
);
@ -484,11 +484,11 @@ struct Span {
Span<element_type, Count == SPAN_DYNAMIC_EXTENT ? Extent - Offset : Count>
subspan() const
{
MBED_STATIC_ASSERT(
static_assert(
0 <= Offset && Offset <= Extent,
"Invalid subspan offset"
);
MBED_STATIC_ASSERT(
static_assert(
(Count == SPAN_DYNAMIC_EXTENT) ||
(0 <= Count && (Count + Offset) <= Extent),
"Invalid subspan count"
@ -678,7 +678,7 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
Span(const Span<OtherElementType, OtherExtent> &other):
_data(other.data()), _size(other.size())
{
MBED_STATIC_ASSERT(
static_assert(
(span_detail::is_convertible<OtherElementType (*)[1], ElementType (*)[1]>::value),
"OtherElementType(*)[] should be convertible to ElementType (*)[]"
);

View File

@ -17,6 +17,7 @@
#ifndef MBED_ASSERT_H
#define MBED_ASSERT_H
#include <assert.h>
#include "platform/mbed_toolchain.h"
#ifdef __cplusplus
@ -70,6 +71,10 @@ do { \
} while (0)
#endif
// ARM Compiler 6 currently fails to define `static_assert` in assert.h; correct for this
#if !defined __cplusplus && !defined static_assert
#define static_assert _Static_assert
#endif
/** MBED_STATIC_ASSERT
* Declare compile-time assertions, results in compile-time error if condition is false

View File

@ -64,7 +64,7 @@
* master branch code
*/
#define MBED_VERSION_CHECK(major, minor, patch) do { \
MBED_STATIC_ASSERT((MBED_VERSION >= MBED_ENCODE_VERSION((major),(minor),(patch))), "Incompatible mbed-os version detected!!"); \
static_assert((MBED_VERSION >= MBED_ENCODE_VERSION((major),(minor),(patch))), "Incompatible mbed-os version detected!!"); \
} while(0)
#endif

View File

@ -23,8 +23,8 @@
#include "platform/internal/CThunkBase.h"
MBED_STATIC_ASSERT(MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX < 256, "MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX must be less than 256");
MBED_STATIC_ASSERT(MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX > 0, "MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX must be greater than 0");
static_assert(MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX < 256, "MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX must be less than 256");
static_assert(MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX > 0, "MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX must be greater than 0");
#define ENABLE_N(N) ((MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX & N) ? 1 : 0)

View File

@ -337,7 +337,7 @@ void SysTimer<Period, IRQ>::handler()
#if MBED_CONF_RTOS_PRESENT
/* Whatever the OS wants (in case it isn't 1ms) */
MBED_STATIC_ASSERT(1000000 % OS_TICK_FREQ == 0, "OS_TICK_FREQ must be a divisor of 1000000 for correct tick calculations");
static_assert(1000000 % OS_TICK_FREQ == 0, "OS_TICK_FREQ must be a divisor of 1000000 for correct tick calculations");
#define OS_TICK_US (1000000 / OS_TICK_FREQ)
#if OS_TICK_US != 1000
template class SysTimer<std::ratio_multiply<std::ratio<OS_TICK_US>, std::micro>>;

View File

@ -20,10 +20,10 @@
#include "platform/mbed_critical.h"
/* Inline bool implementations in the header use uint8_t versions to manipulate the bool */
MBED_STATIC_ASSERT(sizeof(bool) == sizeof(uint8_t), "Surely bool is a byte");
static_assert(sizeof(bool) == sizeof(uint8_t), "Surely bool is a byte");
/* Inline implementations in the header use uint32_t versions to manipulate pointers */
MBED_STATIC_ASSERT(sizeof(void *) == sizeof(uint32_t), "Alas, pointers must be 32-bit");
static_assert(sizeof(void *) == sizeof(uint32_t), "Alas, pointers must be 32-bit");
#define DO_MBED_LOCKED_OP(name, OP, retValue, T, fn_suffix) \

View File

@ -510,7 +510,7 @@ extern "C" std::FILE *fdopen(int fildes, const char *mode)
{
// This is to avoid scanf and the bloat it brings.
char buf[1 + sizeof fildes]; /* @(integer) */
MBED_STATIC_ASSERT(sizeof buf == 5, "Integers should be 4 bytes.");
static_assert(sizeof buf == 5, "Integers should be 4 bytes.");
buf[0] = '@';
memcpy(buf + 1, &fildes, sizeof fildes);

View File

@ -22,36 +22,36 @@
// multiple asserts are used to guarantee no conflicts occur in generated labels
// Test for static asserts in global context
MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char),
"An int must be larger than char");
MBED_STATIC_ASSERT(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
MBED_STATIC_ASSERT(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
static_assert(sizeof(int) >= sizeof(char),
"An int must be larger than char");
static_assert(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
static_assert(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
struct test {
int dummy;
// Test for static asserts in struct context
MBED_STRUCT_STATIC_ASSERT(sizeof(int) >= sizeof(char),
"An int must be larger than char");
MBED_STRUCT_STATIC_ASSERT(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
MBED_STRUCT_STATIC_ASSERT(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
static_assert(sizeof(int) >= sizeof(char),
"An int must be larger than char");
static_assert(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
static_assert(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
};
MBED_STATIC_ASSERT(sizeof(struct test) == sizeof(int),
"Static assertions should not change the size of a struct");
static_assert(sizeof(struct test) == sizeof(int),
"Static assertions should not change the size of a struct");
void doit_c(void)
{
// Test for static asserts in function context
MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char),
"An int must be larger than char");
MBED_STATIC_ASSERT(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
MBED_STATIC_ASSERT(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
static_assert(sizeof(int) >= sizeof(char),
"An int must be larger than char");
static_assert(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
static_assert(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
}

View File

@ -22,43 +22,43 @@
// multiple asserts are used to guarantee no conflicts occur in generated labels
// Test for static asserts in global context
MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char),
"An int must be larger than char");
MBED_STATIC_ASSERT(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
MBED_STATIC_ASSERT(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
static_assert(sizeof(int) >= sizeof(char),
"An int must be larger than char");
static_assert(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
static_assert(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
struct test {
int dummy;
// Test for static asserts in struct context
MBED_STRUCT_STATIC_ASSERT(sizeof(int) >= sizeof(char),
"An int must be larger than char");
MBED_STRUCT_STATIC_ASSERT(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
MBED_STRUCT_STATIC_ASSERT(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
static_assert(sizeof(int) >= sizeof(char),
"An int must be larger than char");
static_assert(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
static_assert(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char),
"An int must be larger than char");
MBED_STATIC_ASSERT(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
MBED_STATIC_ASSERT(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
static_assert(sizeof(int) >= sizeof(char),
"An int must be larger than char");
static_assert(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
static_assert(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
};
MBED_STATIC_ASSERT(sizeof(struct test) == sizeof(int),
"Static assertions should not change the size of a struct");
static_assert(sizeof(struct test) == sizeof(int),
"Static assertions should not change the size of a struct");
void doit_c(void)
{
// Test for static asserts in function context
MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char),
"An int must be larger than char");
MBED_STATIC_ASSERT(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
MBED_STATIC_ASSERT(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
static_assert(sizeof(int) >= sizeof(char),
"An int must be larger than char");
static_assert(2 + 2 == 4,
"Hopefully the universe is mathematically consistent");
static_assert(THE_ANSWER == 42,
"Said Deep Thought, with infinite majesty and calm");
}

View File

@ -57,7 +57,7 @@ namespace rtos {
*/
template<typename T, uint32_t pool_sz>
class MemoryPool : private mbed::NonCopyable<MemoryPool<T, pool_sz> > {
MBED_STATIC_ASSERT(pool_sz > 0, "Invalid memory pool size. Must be greater than 0.");
static_assert(pool_sz > 0, "Invalid memory pool size. Must be greater than 0.");
public:
/** Create and Initialize a memory pool.
*

View File

@ -31,12 +31,12 @@
#if MBED_CONF_RTOS_PRESENT
#define ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos))
MBED_STATIC_ASSERT(ALIGN_UP(0, 8) == 0, "ALIGN_UP macro error");
MBED_STATIC_ASSERT(ALIGN_UP(1, 8) == 8, "ALIGN_UP macro error");
static_assert(ALIGN_UP(0, 8) == 0, "ALIGN_UP macro error");
static_assert(ALIGN_UP(1, 8) == 8, "ALIGN_UP macro error");
#define ALIGN_DOWN(pos, align) ((pos) - ((pos) % (align)))
MBED_STATIC_ASSERT(ALIGN_DOWN(7, 8) == 0, "ALIGN_DOWN macro error");
MBED_STATIC_ASSERT(ALIGN_DOWN(8, 8) == 8, "ALIGN_DOWN macro error");
static_assert(ALIGN_DOWN(7, 8) == 0, "ALIGN_DOWN macro error");
static_assert(ALIGN_DOWN(8, 8) == 8, "ALIGN_DOWN macro error");
namespace rtos {

View File

@ -264,8 +264,8 @@ SDBlockDevice::SDBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName c
_card_type = SDCARD_NONE;
// Set default to 100kHz for initialisation and 1MHz for data transfer
MBED_STATIC_ASSERT(((MBED_CONF_SD_INIT_FREQUENCY >= 100000) && (MBED_CONF_SD_INIT_FREQUENCY <= 400000)),
"Initialization frequency should be between 100KHz to 400KHz");
static_assert(((MBED_CONF_SD_INIT_FREQUENCY >= 100000) && (MBED_CONF_SD_INIT_FREQUENCY <= 400000)),
"Initialization frequency should be between 100KHz to 400KHz");
_init_sck = MBED_CONF_SD_INIT_FREQUENCY;
_transfer_sck = hz;
@ -285,8 +285,8 @@ SDBlockDevice::SDBlockDevice(const spi_pinmap_t &spi_pinmap, PinName cs, uint64_
_card_type = SDCARD_NONE;
// Set default to 100kHz for initialisation and 1MHz for data transfer
MBED_STATIC_ASSERT(((MBED_CONF_SD_INIT_FREQUENCY >= 100000) && (MBED_CONF_SD_INIT_FREQUENCY <= 400000)),
"Initialization frequency should be between 100KHz to 400KHz");
static_assert(((MBED_CONF_SD_INIT_FREQUENCY >= 100000) && (MBED_CONF_SD_INIT_FREQUENCY <= 400000)),
"Initialization frequency should be between 100KHz to 400KHz");
_init_sck = MBED_CONF_SD_INIT_FREQUENCY;
_transfer_sck = hz;

View File

@ -49,9 +49,9 @@ const uint32_t gau32ClkSrcTbl[] = {__HXT, __LXT, 0UL, __LIRC, 0UL, __HIRC48, 0UL
/* The configuration of TDB internal storage area defined in "partition_M2351_mem.h"
* must match "tdb_internal/mbed_lib.json", so it can pass to linker files for
* memory layout check. */
MBED_STATIC_ASSERT(NU_TDB_INTERNAL_STORAGE_START == MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS,
static_assert(NU_TDB_INTERNAL_STORAGE_START == MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS,
"NU_TDB_INTERNAL_STORAGE_START must be equal to MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS");
MBED_STATIC_ASSERT(NU_TDB_INTERNAL_STORAGE_SIZE == MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE,
static_assert(NU_TDB_INTERNAL_STORAGE_SIZE == MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE,
"NU_TDB_INTERNAL_STORAGE_SIZE must be equal to MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE");
#endif

View File

@ -161,7 +161,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
GPIO_T *gpio_base = NU_PORT_BASE(port_index);
/* We assume BSP has such coding so that we can easily add/remove either irq type. */
MBED_STATIC_ASSERT(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
static_assert(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
"GPIO_INT_BOTH_EDGE must be bitwise OR of GPIO_INT_RISING and GPIO_INT_FALLING");
uint32_t irq_type;
switch (event) {

View File

@ -157,7 +157,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
GPIO_T *gpio_base = NU_PORT_BASE(port_index);
/* We assume BSP has such coding so that we can easily add/remove either irq type. */
MBED_STATIC_ASSERT(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
static_assert(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
"GPIO_INT_BOTH_EDGE must be bitwise OR of GPIO_INT_RISING and GPIO_INT_FALLING");
uint32_t irq_type;
switch (event) {

View File

@ -158,7 +158,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
GPIO_T *gpio_base = NU_PORT_BASE(port_index);
/* We assume BSP has such coding so that we can easily add/remove either irq type. */
MBED_STATIC_ASSERT(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
static_assert(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
"GPIO_INT_BOTH_EDGE must be bitwise OR of GPIO_INT_RISING and GPIO_INT_FALLING");
uint32_t irq_type;
switch (event) {

View File

@ -154,7 +154,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
GPIO_T *gpio_base = NU_PORT_BASE(port_index);
/* We assume BSP has such coding so that we can easily add/remove either irq type. */
MBED_STATIC_ASSERT(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
static_assert(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
"GPIO_INT_BOTH_EDGE must be bitwise OR of GPIO_INT_RISING and GPIO_INT_FALLING");
uint32_t irq_type;
switch (event) {

View File

@ -161,7 +161,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
GPIO_T *gpio_base = NU_PORT_BASE(port_index);
/* We assume BSP has such coding so that we can easily add/remove either irq type. */
MBED_STATIC_ASSERT(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
static_assert(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
"GPIO_INT_BOTH_EDGE must be bitwise OR of GPIO_INT_RISING and GPIO_INT_FALLING");
uint32_t irq_type;
switch (event) {

View File

@ -176,7 +176,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
GPIO_T *gpio_base = NU_PORT_BASE(port_index);
/* We assume BSP has such coding so that we can easily add/remove either irq type. */
MBED_STATIC_ASSERT(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
static_assert(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
"GPIO_INT_BOTH_EDGE must be bitwise OR of GPIO_INT_RISING and GPIO_INT_FALLING");
uint32_t irq_type;
switch (event) {

View File

@ -160,7 +160,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
GPIO_T *gpio_base = NU_PORT_BASE(port_index);
/* We assume BSP has such coding so that we can easily add/remove either irq type. */
MBED_STATIC_ASSERT(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
static_assert(GPIO_INT_BOTH_EDGE == (GPIO_INT_RISING | GPIO_INT_FALLING),
"GPIO_INT_BOTH_EDGE must be bitwise OR of GPIO_INT_RISING and GPIO_INT_FALLING");
uint32_t irq_type;
switch (event) {