mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 19:07:45 +08:00
libevents: update submodule
And remove obsolete libevents_definitions.h
This commit is contained in:
@@ -1,48 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This header defines the events::EventType type.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <uORB/topics/event.h>
|
|
||||||
|
|
||||||
namespace events
|
|
||||||
{
|
|
||||||
using EventType = event_s;
|
|
||||||
} // namespace events
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <events/events_generated.h>
|
#include <events/events_generated.h>
|
||||||
#include <libevents_definitions.h>
|
#include <uORB/topics/event.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ constexpr unsigned sizeofArguments(const T &t, const Args &... args)
|
|||||||
/**
|
/**
|
||||||
* publish/send an event
|
* publish/send an event
|
||||||
*/
|
*/
|
||||||
void send(EventType &event);
|
void send(event_s &event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate event ID from an event name
|
* Generate event ID from an event name
|
||||||
@@ -109,7 +109,7 @@ constexpr uint32_t ID(const char (&name)[N])
|
|||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void send(uint32_t id, const LogLevels &log_levels, const char *message, Args... 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.log_levels = ((uint8_t)log_levels.internal << 4) | (uint8_t)log_levels.external;
|
||||||
e.id = id;
|
e.id = id;
|
||||||
static_assert(util::sizeofArguments(args...) <= sizeof(e.arguments), "Too many arguments");
|
static_assert(util::sizeofArguments(args...) <= sizeof(e.arguments), "Too many arguments");
|
||||||
@@ -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)
|
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.log_levels = ((uint8_t)log_levels.internal << 4) | (uint8_t)log_levels.external;
|
||||||
e.id = id;
|
e.id = id;
|
||||||
CONSOLE_PRINT_EVENT(e.log_level_external, e.id, message);
|
CONSOLE_PRINT_EVENT(e.log_level_external, e.id, message);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ static uint16_t event_sequence{events::initial_event_sequence};
|
|||||||
namespace events
|
namespace events
|
||||||
{
|
{
|
||||||
|
|
||||||
void send(EventType &event)
|
void send(event_s &event)
|
||||||
{
|
{
|
||||||
event.timestamp = hrt_absolute_time();
|
event.timestamp = hrt_absolute_time();
|
||||||
|
|
||||||
|
|||||||
@@ -47,5 +47,5 @@
|
|||||||
|
|
||||||
#define EVENTSIOCSEND _EVENTSIOC(1)
|
#define EVENTSIOCSEND _EVENTSIOC(1)
|
||||||
typedef struct eventiocsend {
|
typedef struct eventiocsend {
|
||||||
events::EventType &event;
|
event_s &event;
|
||||||
} eventiocsend_t;
|
} eventiocsend_t;
|
||||||
|
|||||||
+1
-1
Submodule src/lib/events/libevents updated: 59f7f5c0ec...8d5c44661b
@@ -44,7 +44,7 @@
|
|||||||
namespace events
|
namespace events
|
||||||
{
|
{
|
||||||
|
|
||||||
void send(EventType &event)
|
void send(event_s &event)
|
||||||
{
|
{
|
||||||
eventiocsend_t data = {event};
|
eventiocsend_t data = {event};
|
||||||
boardctl(EVENTSIOCSEND, reinterpret_cast<unsigned long>(&data));
|
boardctl(EVENTSIOCSEND, reinterpret_cast<unsigned long>(&data));
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ bool Report::report(bool is_armed, bool force)
|
|||||||
|
|
||||||
// send all events
|
// send all events
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
events::EventType event;
|
event_s event;
|
||||||
|
|
||||||
for (int i = 0; i < max_num_events && offset < _next_buffer_idx; ++i) {
|
for (int i = 0; i < max_num_events && offset < _next_buffer_idx; ++i) {
|
||||||
EventBufferHeader *header = (EventBufferHeader *)(_event_buffer + offset);
|
EventBufferHeader *header = (EventBufferHeader *)(_event_buffer + offset);
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ bool Report::addEvent(uint32_t event_id, const events::LogLevels &log_levels, co
|
|||||||
Args... args)
|
Args... args)
|
||||||
{
|
{
|
||||||
constexpr unsigned args_size = events::util::sizeofArguments(modes, 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;
|
unsigned total_size = sizeof(EventBufferHeader) + args_size;
|
||||||
|
|
||||||
if (total_size > sizeof(_event_buffer) - _next_buffer_idx) {
|
if (total_size > sizeof(_event_buffer) - _next_buffer_idx) {
|
||||||
|
|||||||
Reference in New Issue
Block a user