|
11 | 11 | #include <zephyr/drivers/sensor.h> |
12 | 12 | #include <zephyr/sensing/sensing.h> |
13 | 13 |
|
| 14 | +struct sensing_connection { |
| 15 | + const struct sensing_sensor_info *info; |
| 16 | + const struct sensing_callback_list *cb_list; |
| 17 | + void *userdata; |
| 18 | + enum sensing_sensor_mode mode; |
| 19 | + q31_t attributes[SENSOR_ATTR_COMMON_COUNT]; |
| 20 | + uint32_t attribute_mask; |
| 21 | +} __packed __aligned(4); |
| 22 | + |
| 23 | +#define SENSING_CONNECTION_DT_DEFINE(node_id, target_node_id, type, _cb_list) \ |
| 24 | + SENSING_DMEM STRUCT_SECTION_ITERABLE(sensing_connection, node_id##_sensing_connection) = { \ |
| 25 | + .info = SENSING_SENSOR_INFO_GET(target_node_id, type), \ |
| 26 | + .cb_list = (_cb_list), \ |
| 27 | + } |
| 28 | + |
| 29 | +STRUCT_SECTION_START_EXTERN(sensing_connection); |
| 30 | +STRUCT_SECTION_END_EXTERN(sensing_connection); |
| 31 | + |
14 | 32 | #define SENSING_SENSOR_INFO_DT_NAME(node_id, type) \ |
15 | 33 | _CONCAT(_CONCAT(__sensing_sensor_info_, DEVICE_DT_NAME_GET(node_id)), type) |
16 | 34 |
|
17 | 35 | #define SENSING_SENSOR_INFO_INST_DEFINE_NAMED(node_id, name, prop, idx, _iodev) \ |
18 | | - IF_ENABLED(CONFIG_SENSING_SHELL, (static char node_id##_##idx##_name_buffer[5];)) \ |
| 36 | + IF_ENABLED(CONFIG_SENSING_SHELL, (static char node_id##_##idx##_name_buffer[5];)) \ |
19 | 37 | const STRUCT_SECTION_ITERABLE(sensing_sensor_info, name) = { \ |
20 | 38 | .info = &SENSOR_INFO_DT_NAME(DT_PHANDLE(node_id, dev)), \ |
21 | 39 | .dev = DEVICE_DT_GET(node_id), \ |
22 | 40 | .type = DT_PROP_BY_IDX(node_id, prop, idx), \ |
23 | 41 | .iodev = &(_iodev), \ |
24 | | - IF_ENABLED(CONFIG_SENSING_SHELL, (.shell_name = node_id##_##idx##_name_buffer, )) \ |
25 | | - }; |
| 42 | + IF_ENABLED(CONFIG_SENSING_SHELL, \ |
| 43 | + (.shell_name = node_id##_##idx##_name_buffer, ))}; |
26 | 44 |
|
27 | 45 | #define SENSING_SENSOR_INFO_INST_DEFINE(node_id, prop, idx, _iodev) \ |
28 | 46 | SENSING_SENSOR_INFO_INST_DEFINE_NAMED( \ |
|
0 commit comments