uorb: allow for more than 255 uORB messages

Increased size for ORB_ID from uint8_t to uint16_t

Created a type: orb_id_size_t = uint16_t.
There are still a couple of places where the size
of the ORB_ID is assumed to be less than 16-bits.
The places that I have found are commented regarding
this and can be found with a search on orb_id_size_t.
This commit is contained in:
hskrieg
2022-11-14 11:17:22 -05:00
committed by Beat Küng
parent e9fbb9a3ab
commit 64c21ad428
9 changed files with 26 additions and 16 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ topic_fields = ["%s %s" % (convert_type(field.type, True), field.name) for field
constexpr char __orb_@(name_snake_case)_fields[] = "@( ";".join(topic_fields) );";
@[for topic in topics]@
ORB_DEFINE(@topic, struct @uorb_struct, @(struct_size-padding_end_size), __orb_@(name_snake_case)_fields, static_cast<uint8_t>(ORB_ID::@topic));
ORB_DEFINE(@topic, struct @uorb_struct, @(struct_size-padding_end_size), __orb_@(name_snake_case)_fields, static_cast<orb_id_size_t>(ORB_ID::@topic));
@[end for]
void print_message(const orb_metadata *meta, const @uorb_struct& message)
+1 -1
View File
@@ -76,5 +76,5 @@ const struct orb_metadata *get_orb_meta(ORB_ID id)
return nullptr;
}
return uorb_topics_list[static_cast<uint8_t>(id)];
return uorb_topics_list[static_cast<orb_id_size_t>(id)];
}
+1 -1
View File
@@ -62,7 +62,7 @@ static constexpr size_t orb_topics_count() { return ORB_TOPICS_COUNT; }
*/
extern const struct orb_metadata *const *orb_get_topics() __EXPORT;
enum class ORB_ID : uint8_t {
enum class ORB_ID : orb_id_size_t {
@[for idx, topic_name in enumerate(topic_names_all)]@
@(topic_name) = @(idx),
@[end for]