Skip to content

Commit

Permalink
libevents: update submodule
Browse files Browse the repository at this point in the history
And remove obsolete libevents_definitions.h
  • Loading branch information
bkueng authored and dagar committed Apr 29, 2024
1 parent 9dc7719 commit 547209e
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 58 deletions.
48 changes: 0 additions & 48 deletions platforms/common/include/libevents_definitions.h

This file was deleted.

8 changes: 4 additions & 4 deletions platforms/common/include/px4_platform_common/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#endif

#include <events/events_generated.h>
#include <libevents_definitions.h>
#include <uORB/topics/event.h>

#include <stdint.h>

Expand Down Expand Up @@ -93,7 +93,7 @@ constexpr unsigned sizeofArguments(const T &t, const Args &... args)
/**
* publish/send an event
*/
void send(EventType &event);
void send(event_s &event);

/**
* Generate event ID from an event name
Expand All @@ -109,7 +109,7 @@ constexpr uint32_t ID(const char (&name)[N])
template<typename... Args>
inline void send(uint32_t id, const LogLevels &log_levels, const char *message, Args... args)
{
EventType e{};
event_s e{};
e.log_levels = ((uint8_t)log_levels.internal << 4) | (uint8_t)log_levels.external;
e.id = id;
static_assert(util::sizeofArguments(args...) <= sizeof(e.arguments), "Too many arguments");
Expand All @@ -120,7 +120,7 @@ inline void send(uint32_t id, const LogLevels &log_levels, const char *message,

inline void send(uint32_t id, const LogLevels &log_levels, const char *message)
{
EventType e{};
event_s e{};
e.log_levels = ((uint8_t)log_levels.internal << 4) | (uint8_t)log_levels.external;
e.id = id;
CONSOLE_PRINT_EVENT(e.log_level_external, e.id, message);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/events/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static uint16_t event_sequence{events::initial_event_sequence};
namespace events
{

void send(EventType &event)
void send(event_s &event)
{
event.timestamp = hrt_absolute_time();

Expand Down
2 changes: 1 addition & 1 deletion src/lib/events/events_ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@

#define EVENTSIOCSEND _EVENTSIOC(1)
typedef struct eventiocsend {
events::EventType &event;
event_s &event;
} eventiocsend_t;
2 changes: 1 addition & 1 deletion src/lib/events/usr_events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
namespace events
{

void send(EventType &event)
void send(event_s &event)
{
eventiocsend_t data = {event};
boardctl(EVENTSIOCSEND, reinterpret_cast<unsigned long>(&data));
Expand Down
2 changes: 1 addition & 1 deletion src/modules/commander/HealthAndArmingChecks/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ bool Report::report(bool is_armed, bool force)

// send all events
int offset = 0;
events::EventType event;
event_s event;

for (int i = 0; i < max_num_events && offset < _next_buffer_idx; ++i) {
EventBufferHeader *header = (EventBufferHeader *)(_event_buffer + offset);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/commander/HealthAndArmingChecks/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ bool Report::addEvent(uint32_t event_id, const events::LogLevels &log_levels, co
Args... args)
{
constexpr unsigned args_size = events::util::sizeofArguments(modes, args...);
static_assert(args_size <= sizeof(events::EventType::arguments), "Too many arguments");
static_assert(args_size <= sizeof(event_s::arguments), "Too many arguments");
unsigned total_size = sizeof(EventBufferHeader) + args_size;

if (total_size > sizeof(_event_buffer) - _next_buffer_idx) {
Expand Down

0 comments on commit 547209e

Please sign in to comment.