Skip to content

Commit

Permalink
modules: canopennode: use zephyr/dsp/types.h for float32_t/float64_t
Browse files Browse the repository at this point in the history
Include the zephyr/dsp/types.h header for float32_t/float64_t type
definitions to avoid conflicts with other subsystems including this header.

Add compile-time asserts to ensure the typedefs meet the requirements of
the CANopenNode module.

Fixes: #63896

Signed-off-by: Henrik Brix Andersen <[email protected]>
(cherry picked from commit c9da682)
  • Loading branch information
henrikbrixandersen authored and jgl-meta committed Nov 21, 2023
1 parent b3fd79a commit 9242edc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/canopennode/CO_driver_target.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ extern "C" {
#include <zephyr/types.h>
#include <zephyr/device.h>
#include <zephyr/toolchain.h>
#include <zephyr/dsp/types.h> /* float32_t, float64_t */

/* Use static variables instead of calloc() */
#define CO_USE_GLOBALS
Expand All @@ -46,12 +47,13 @@ extern "C" {
#endif

typedef bool bool_t;
typedef float float32_t;
typedef long double float64_t;
typedef char char_t;
typedef unsigned char oChar_t;
typedef unsigned char domain_t;

BUILD_ASSERT(sizeof(float32_t) >= 4);
BUILD_ASSERT(sizeof(float64_t) >= 8);

typedef struct canopen_rx_msg {
uint8_t data[8];
uint16_t ident;
Expand Down

0 comments on commit 9242edc

Please sign in to comment.