Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Helper macros for printing Q values.

Extends the existing inttypes headers for print formatting. More...

Macros

#define PRIq(precision)   "s%" PRIu32 ".%0" STRINGIFY(precision) PRIu32
 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.

Useage:

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)    "s%" PRIu32 ".%0" STRINGIFY(precision) PRIu32

#include <zephyr/dsp/print_format.h>

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