Zephyr API 3.6.99
Loading...
Searching...
No Matches
Helper macros for printing Q values.

Macros

#define PRIq(precision)
 Insert Q value format string.
 
#define PRIq_arg(q, precision, shift)
 Insert Q value arguments to print format.
 

Detailed Description

Extends the existing inttypes headers for print formatting. Usage:

printk("Value=%" PRIq "\n", PRIq_arg(value, 6, 2));
#define PRIq(precision)
Insert Q value format string.
Definition print_format.h:30
#define PRIq_arg(q, precision, shift)
Insert Q value arguments to print format.
Definition print_format.h:58
static void printk(const char *fmt,...)
Print kernel debugging message.
Definition printk.h:51

For a Q value representing 0.5, the expected output will be: "Value=2.000000"

Macro Definition Documentation

◆ PRIq

#define PRIq ( precision)

#include <zephyr/dsp/print_format.h>

Value:
"s%" PRIu32 ".%0" STRINGIFY(precision) PRIu32
#define STRINGIFY(s)
Definition common.h:134
#define PRIu32
Definition inttypes.h:60

Insert Q value format string.

◆ PRIq_arg

#define PRIq_arg ( q,
precision,
shift )

#include <zephyr/dsp/print_format.h>

Value:
((q) < 0 ? "-" : ""), (uint32_t)__PRIq_arg_get_int(q, shift), \
(uint32_t)__PRIq_arg_get_frac(q, precision, shift)
__UINT32_TYPE__ uint32_t
Definition stdint.h:90

Insert Q value arguments to print format.

Parameters
[in]qThe q value
[in]precisionNumber of decimal points to print
[in]shiftThe "scale" to shift q by