Common PLATFORM_HEADER Configuration#

Compiler and Platform specific definitions and typedefs common to all platforms.

platform-common.h provides PLATFORM_HEADER defaults and common definitions. This head should never be included directly, it should only be included by the specific PLATFORM_HEADER used by your platform.

See platform-common.h for source code.

Generic Types#

#define

An alias for one, used for clarity.

#define

An alias for zero, used for clarity.

#define
NULL ((void *)0)

The null pointer.

Bit Manipulation Macros#

#define
BIT (x)

Useful to reference a single bit of a byte.

#define
BIT32 (x)

Useful to reference a single bit of an uint32_t type.

#define
SETBIT (reg, bit)

Sets bit in the reg register or byte.

#define
SETBITS (reg, bits)

Sets the bits in the reg register or the byte as specified in the bitmask bits.

#define
CLEARBIT (reg, bit)

Clears a bit in the reg register or byte.

#define
CLEARBITS (reg, bits)

Clears the bits in the reg register or byte as specified in the bitmask bits.

#define
READBIT (reg, bit)

Returns the value of bit within the register or byte reg.

#define
READBITS (reg, bits)

Returns the value of the bitmask bits within the register or byte reg.

Byte Manipulation Macros#

#define

Returns the low byte of the 16-bit value n as an uint8_t.

#define

Returns the high byte of the 16-bit value n as an uint8_t.

#define
HIGH_LOW_TO_INT (high, low)

Returns the value built from the two uint8_t values high and low.

#define
INT8U_TO_INT32U (byte3, byte2, byte1, byte0)

Returns the value built from the four uint8_t as an uint32_t.

#define
BYTE_0 (n)

Returns the low byte of the 32-bit value n as an uint8_t.

#define
BYTE_1 (n)

Returns the second byte of the 32-bit value n as an uint8_t.

#define
BYTE_2 (n)

Returns the third byte of the 32-bit value n as an uint8_t.

#define
BYTE_3 (n)

Returns the high byte of the 32-bit value n as an uint8_t.

#define
BYTE_4 (n)

Returns the fifth byte of the 64-bit value n as an uint8_t.

#define
BYTE_5 (n)

Returns the sixth byte of the 64-bit value n as an uint8_t.

#define
BYTE_6 (n)

Returns the seventh byte of the 64-bit value n as an uint8_t.

#define
BYTE_7 (n)

Returns the high byte of the 64-bit value n as an uint8_t.

#define

Returns the number of entries in an array.

Time Manipulation Macros#

#define
elapsedTimeInt8u (oldTime, newTime)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define
elapsedTimeInt16u (oldTime, newTime)

Returns the elapsed time between two 16 bit values. Result may not be valid if the time samples differ by more than 32767.

#define
elapsedTimeInt32u (oldTime, newTime)

Returns the elapsed time between two 32 bit values. Result may not be valid if the time samples differ by more than 2147483647.

#define

Returns true if t1 is greater than t2. Can only account for 1 wrap around of the variable before it is wrong.

#define

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define

Returns true if t1 is greater than t2. Can only account for 1 wrap around of the variable before it is wrong.

#define

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define
MAX_INT32U_VALUE (0xFFFFFFFFUL)

Returns true if t1 is greater than t2. Can only account for 1 wrap around of the variable before it is wrong.

#define
HALF_MAX_INT32U_VALUE (0x80000000UL)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

#define

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.

Miscellaneous Macros#

#define
#define
DEBUG_LEVEL BASIC_DEBUG

Set debug level based on whether DEBUG or DEBUG_STRIPPED are defined.

#define
STATIC_ASSERT (__condition, __errorstr)

Disable static assertions on compilers that don't support them.

Macros#

#define
MEMSET (d, v, l)

Friendly convenience macro pointing to the C Stdlib functions.

#define
MEMCOPY (d, s, l)
#define
MEMMOVE (d, s, l)
#define
MEMPGMCOPY (d, s, l)
#define
MEMCOMPARE (s0, s1, l)
#define
MEMPGMCOMPARE (s0, s1, l)

Generic Types Documentation#

TRUE#

#define TRUE
Value:
1

An alias for one, used for clarity.


Definition at line 209 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

FALSE#

#define FALSE
Value:
0

An alias for zero, used for clarity.


Definition at line 214 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

NULL#

#define NULL
Value:
((void *)0)

The null pointer.


Definition at line 221 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

Bit Manipulation Macros Documentation#

BIT#

#define BIT
Value:
(x)

Useful to reference a single bit of a byte.


Definition at line 234 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

BIT32#

#define BIT32
Value:
(x)

Useful to reference a single bit of an uint32_t type.


Definition at line 239 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

SETBIT#

#define SETBIT
Value:
(reg, bit)

Sets bit in the reg register or byte.

Note

  • Assuming reg is an IO register, some platforms (such as the AVR) can implement this in a single atomic operation.


Definition at line 246 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

SETBITS#

#define SETBITS
Value:
(reg, bits)

Sets the bits in the reg register or the byte as specified in the bitmask bits.

Note

  • This is never a single atomic operation.


Definition at line 253 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

CLEARBIT#

#define CLEARBIT
Value:
(reg, bit)

Clears a bit in the reg register or byte.

Note

  • Assuming reg is an IO register, some platforms (such as the AVR) can implement this in a single atomic operation.


Definition at line 260 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

CLEARBITS#

#define CLEARBITS
Value:
(reg, bits)

Clears the bits in the reg register or byte as specified in the bitmask bits.

Note

  • This is never a single atomic operation.


Definition at line 267 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

READBIT#

#define READBIT
Value:
(reg, bit)

Returns the value of bit within the register or byte reg.


Definition at line 272 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

READBITS#

#define READBITS
Value:
(reg, bits)

Returns the value of the bitmask bits within the register or byte reg.


Definition at line 278 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

Byte Manipulation Macros Documentation#

LOW_BYTE#

#define LOW_BYTE
Value:
(n)

Returns the low byte of the 16-bit value n as an uint8_t.


Definition at line 292 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

HIGH_BYTE#

#define HIGH_BYTE
Value:
(n)

Returns the high byte of the 16-bit value n as an uint8_t.


Definition at line 297 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

HIGH_LOW_TO_INT#

#define HIGH_LOW_TO_INT
Value:
( \
((uint16_t) (((uint16_t) (high)) << 8)) \
+ ((uint16_t) ((low) & 0xFF)) \
)

Returns the value built from the two uint8_t values high and low.


Definition at line 303 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

INT8U_TO_INT32U#

#define INT8U_TO_INT32U
Value:
( \
(((uint32_t) (byte3)) << 24) \
+ (((uint32_t) (byte2)) << 16) \
+ (((uint32_t) (byte1)) << 8) \
+ ((uint32_t) ((byte0) & 0xFF)) \
)

Returns the value built from the four uint8_t as an uint32_t.


Definition at line 311 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

BYTE_0#

#define BYTE_0
Value:
(n)

Returns the low byte of the 32-bit value n as an uint8_t.


Definition at line 321 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

BYTE_1#

#define BYTE_1
Value:
(n)

Returns the second byte of the 32-bit value n as an uint8_t.


Definition at line 326 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

BYTE_2#

#define BYTE_2
Value:
(n)

Returns the third byte of the 32-bit value n as an uint8_t.


Definition at line 331 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

BYTE_3#

#define BYTE_3
Value:
(n)

Returns the high byte of the 32-bit value n as an uint8_t.


Definition at line 336 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

BYTE_4#

#define BYTE_4
Value:
(n)

Returns the fifth byte of the 64-bit value n as an uint8_t.


Definition at line 341 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

BYTE_5#

#define BYTE_5
Value:
(n)

Returns the sixth byte of the 64-bit value n as an uint8_t.


Definition at line 346 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

BYTE_6#

#define BYTE_6
Value:
(n)

Returns the seventh byte of the 64-bit value n as an uint8_t.


Definition at line 351 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

BYTE_7#

#define BYTE_7
Value:
(n)

Returns the high byte of the 64-bit value n as an uint8_t.


Definition at line 356 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

COUNTOF#

#define COUNTOF
Value:
(a)

Returns the number of entries in an array.


Definition at line 361 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

Time Manipulation Macros Documentation#

elapsedTimeInt8u#

#define elapsedTimeInt8u
Value:
(oldTime, newTime)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 376 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

elapsedTimeInt16u#

#define elapsedTimeInt16u
Value:
(oldTime, newTime)

Returns the elapsed time between two 16 bit values. Result may not be valid if the time samples differ by more than 32767.


Definition at line 383 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

elapsedTimeInt32u#

#define elapsedTimeInt32u
Value:
(oldTime, newTime)

Returns the elapsed time between two 32 bit values. Result may not be valid if the time samples differ by more than 2147483647.


Definition at line 390 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

MAX_INT8U_VALUE#

#define MAX_INT8U_VALUE
Value:
(0xFF)

Returns true if t1 is greater than t2. Can only account for 1 wrap around of the variable before it is wrong.


Definition at line 397 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

HALF_MAX_INT8U_VALUE#

#define HALF_MAX_INT8U_VALUE
Value:
(0x80)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 398 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

timeGTorEqualInt8u#

#define timeGTorEqualInt8u
Value:
(t1, t2)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 399 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

MAX_INT16U_VALUE#

#define MAX_INT16U_VALUE
Value:
(0xFFFF)

Returns true if t1 is greater than t2. Can only account for 1 wrap around of the variable before it is wrong.


Definition at line 406 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

HALF_MAX_INT16U_VALUE#

#define HALF_MAX_INT16U_VALUE
Value:
(0x8000)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 407 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

timeGTorEqualInt16u#

#define timeGTorEqualInt16u
Value:
(t1, t2)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 408 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

MAX_INT32U_VALUE#

#define MAX_INT32U_VALUE
Value:
(0xFFFFFFFFUL)

Returns true if t1 is greater than t2. Can only account for 1 wrap around of the variable before it is wrong.


Definition at line 415 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

HALF_MAX_INT32U_VALUE#

#define HALF_MAX_INT32U_VALUE
Value:
(0x80000000UL)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 416 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

timeGTorEqualInt32u#

#define timeGTorEqualInt32u
Value:
(t1, t2)

Returns the elapsed time between two 8 bit values. Result may not be valid if the time samples differ by more than 127.


Definition at line 417 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

Miscellaneous Macros Documentation#

UNUSED_VAR#

#define UNUSED_VAR
Value:
(x)

@description Useful macro for avoiding compiler warnings related to unused function arguments or unused variables.


Definition at line 435 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

DEBUG_LEVEL#

#define DEBUG_LEVEL
Value:
BASIC_DEBUG

Set debug level based on whether DEBUG or DEBUG_STRIPPED are defined.


Definition at line 457 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

STATIC_ASSERT#

#define STATIC_ASSERT

Disable static assertions on compilers that don't support them.


Definition at line 465 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

Macro Definition Documentation#

MEMSET#

#define MEMSET
Value:
(d, v, l)

Friendly convenience macro pointing to the C Stdlib functions.


Definition at line 187 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

MEMCOPY#

#define MEMCOPY
Value:
(d, s, l)

Definition at line 188 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

MEMMOVE#

#define MEMMOVE
Value:
(d, s, l)

Definition at line 189 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

MEMPGMCOPY#

#define MEMPGMCOPY
Value:
(d, s, l)

Definition at line 190 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

MEMCOMPARE#

#define MEMCOMPARE
Value:
(s0, s1, l)

Definition at line 191 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h

MEMPGMCOMPARE#

#define MEMPGMCOMPARE
Value:
(s0, s1, l)

Definition at line 192 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/generic/compiler/platform-common.h