Utilities¶
-
group
group_utils
Basic utility macros and functions.
Defines
-
CY_UNUSED_PARAMETER
(x)¶ Simple macro to supress the unused parameter warning by casting to void.
-
CY_ASSERT
(x)¶ Utility macro when neither NDEBUG or CY_NO_ASSERT is not declared to check a condition and, if false, trigger a breakpoint.
-
CY_LO8
(x)¶ Get the lower 8 bits of a 16-bit value.
-
CY_HI8
(x)¶ Get the upper 8 bits of a 16-bit value.
-
CY_LO16
(x)¶ Get the lower 16 bits of a 32-bit value.
-
CY_HI16
(x)¶ Get the upper 16 bits of a 32-bit value.
-
CY_SWAP_ENDIAN16
(x)¶ Swap the byte ordering of a 16-bit value.
-
CY_SWAP_ENDIAN32
(x)¶ Swap the byte ordering of a 32-bit value.
-
CY_SWAP_ENDIAN64
(x)¶ Swap the byte ordering of a 64-bit value.
-
CY_GET_REG8
(addr)¶ Reads the 8-bit value from the specified address.
This function can’t be used to access the Core register, otherwise a fault occurs.
- Return
The read value.
- Parameters
addr
: The register address.
-
CY_SET_REG8
(addr, value)¶ Writes an 8-bit value to the specified address.
This function can’t be used to access the Core register, otherwise a fault occurs.
- Parameters
addr
: The register address.value
: The value to write.
-
CY_GET_REG16
(addr)¶ Reads the 16-bit value from the specified address.
- Return
The read value.
- Parameters
addr
: The register address.
-
CY_SET_REG16
(addr, value)¶ Writes the 16-bit value to the specified address.
- Parameters
addr
: The register address.value
: The value to write.
-
CY_GET_REG24
(addr)¶ Reads the 24-bit value from the specified address.
- Return
The read value.
- Parameters
addr
: The register address.
-
CY_SET_REG24
(addr, value)¶ Writes the 24-bit value to the specified address.
- Parameters
addr
: The register address.value
: The value to write.
-
CY_GET_REG32
(addr)¶ Reads the 32-bit value from the specified register.
The address is the little endian order (LSB in lowest address).
- Return
The read value.
- Parameters
addr
: The register address.
-
CY_SET_REG32
(addr, value)¶ Writes the 32-bit value to the specified register.
The address is the little endian order (LSB in lowest address).
- Parameters
addr
: The register address.value
: The value to write.
-
_CLR_SET_FLD32U
(reg, field, value)¶ The macro for setting a register with a name field and value for providing get-clear-modify-write operations.
Returns a resulting value to be assigned to the register.
-
CY_REG32_CLR_SET
(reg, field, value)¶ Uses _CLR_SET_FLD32U macro for providing get-clear-modify-write operations with a name field and value and writes a resulting value to the 32-bit register.
-
_CLR_SET_FLD16U
(reg, field, value)¶ The macro for setting a 16-bit register with a name field and value for providing get-clear-modify-write operations.
Returns a resulting value to be assigned to the 16-bit register.
-
CY_REG16_CLR_SET
(reg, field, value)¶ Uses _CLR_SET_FLD16U macro for providing get-clear-modify-write operations with a name field and value and writes a resulting value to the 16-bit register.
-
_CLR_SET_FLD8U
(reg, field, value)¶ The macro for setting a 8-bit register with a name field and value for providing get-clear-modify-write operations.
Returns a resulting value to be assigned to the 8-bit register.
-
CY_REG8_CLR_SET
(reg, field, value)¶ Uses _CLR_SET_FLD8U macro for providing get-clear-modify-write operations with a name field and value and writes a resulting value to the 8-bit register.
-
_BOOL2FLD
(field, value)¶ Returns a field mask if the value is not false.
Returns 0, if the value is false.
-
_FLD2BOOL
(field, value)¶ Returns true, if the value includes the field mask.
Returns false, if the value doesn’t include the field mask.
-
CY_SYSLIB_DIV_ROUND
(a, b)¶ Calculates a / b with rounding to the nearest integer, a and b must have the same sign.
-
CY_SYSLIB_DIV_ROUNDUP
(a, b)¶ Calculates a / b with rounding up if remainder != 0, both a and b must be positive.
Functions
-
static inline void
CY_HALT
(void)¶ Halt the processor in the debug state.
-