mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-13 10:47:35 +08:00
initial board and platform support for the ModalAI VOXL 2 (POSIX + QuRT)
This commit is contained in:
@@ -91,11 +91,13 @@
|
||||
/* We can't poison clock_settime/clock_gettime because they are
|
||||
* used in DriverFramework. */
|
||||
|
||||
#if !defined(__PX4_NUTTX)
|
||||
#if !defined(__PX4_NUTTX) && !defined(__PX4_QURT)
|
||||
#include <pthread.h>
|
||||
// We can't include this for NuttX otherwise we get conflicts for read/write
|
||||
// symbols in cannode.
|
||||
#endif // !defined(__PX4_NUTTX)
|
||||
// We can't include this for Qurt because it uses it's own thread primitives
|
||||
#endif // !defined(__PX4_NUTTX) && !defined(__PX4_QURT)
|
||||
#define system_pthread_cond_timedwait pthread_cond_timedwait
|
||||
/* We can't poison pthread_cond_timedwait because it seems to be used in the
|
||||
* <string> include. */
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ endif()
|
||||
if(CONFIG_BOARD_IO)
|
||||
set(board_with_io_arg --board-with-io)
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${generated_serial_params_file} ${generated_module_params_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${generated_params_dir}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/serial/generate_config.py
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
menu "MUORB"
|
||||
rsource "*/Kconfig"
|
||||
endmenu #MUORB
|
||||
@@ -0,0 +1,42 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2022 ModalAI, Inc. 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
px4_add_module(
|
||||
MODULE modules__muorb__apps
|
||||
MAIN muorb
|
||||
COMPILE_FLAGS
|
||||
-Wno-cast-align # TODO: fix and enable
|
||||
SRCS
|
||||
uORBAppsProtobufChannel.cpp
|
||||
muorb_main.cpp
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
menuconfig MODULES_MUORB_APPS
|
||||
bool "apps"
|
||||
default n
|
||||
---help---
|
||||
Enable support for muorb apps
|
||||
@@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2022 ModalAI, Inc. 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef FC_SENSOR_H
|
||||
#define FC_SENSOR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef void (*fc_receive_cb)(const char *topic,
|
||||
const uint8_t *data,
|
||||
uint32_t length_in_bytes);
|
||||
typedef void (*fc_advertise_cb)(const char *topic);
|
||||
typedef void (*fc_add_subscription_cb)(const char *topic);
|
||||
typedef void (*fc_remove_subscription_cb)(const char *topic);
|
||||
|
||||
typedef struct {
|
||||
fc_receive_cb rx_callback;
|
||||
fc_advertise_cb ad_callback;
|
||||
fc_add_subscription_cb sub_callback;
|
||||
fc_remove_subscription_cb remove_sub_callback;
|
||||
} fc_callbacks;
|
||||
|
||||
int fc_sensor_initialize(bool enable_debug_messages, fc_callbacks *callbacks);
|
||||
int fc_sensor_advertise(const char *topic);
|
||||
int fc_sensor_subscribe(const char *topic);
|
||||
int fc_sensor_unsubscribe(const char *topic);
|
||||
int fc_sensor_send_data(const char *topic,
|
||||
const uint8_t *data,
|
||||
uint32_t length_in_bytes);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // FC_SENSOR_H
|
||||
@@ -0,0 +1,90 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2022 ModalAI, Inc. 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include "uORBAppsProtobufChannel.hpp"
|
||||
|
||||
extern "C" { __EXPORT int muorb_main(int argc, char *argv[]); }
|
||||
|
||||
static void usage()
|
||||
{
|
||||
PX4_INFO("Usage: muorb 'start', 'stop', 'status'");
|
||||
}
|
||||
|
||||
static bool enable_debug = false;
|
||||
|
||||
int
|
||||
muorb_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 2) {
|
||||
usage();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
// TODO: Add an optional start parameter to control debug messages
|
||||
if (!strcmp(argv[1], "start")) {
|
||||
if (uORB::AppsProtobufChannel::isInstance()) {
|
||||
PX4_WARN("muorb already started");
|
||||
|
||||
} else {
|
||||
// Register the protobuf channel with UORB.
|
||||
uORB::AppsProtobufChannel *channel = uORB::AppsProtobufChannel::GetInstance();
|
||||
|
||||
if (channel) {
|
||||
if (channel->Initialize(enable_debug)) {
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (!strcmp(argv[1], "stop")) {
|
||||
if (uORB::AppsProtobufChannel::isInstance() == false) {
|
||||
PX4_WARN("muorb not running");
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
||||
} else if (!strcmp(argv[1], "status")) {
|
||||
if (uORB::AppsProtobufChannel::isInstance()) {
|
||||
PX4_INFO("muorb initialized");
|
||||
|
||||
} else {
|
||||
PX4_INFO("muorb not running");
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
usage();
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2022 ModalAI, Inc. 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "uORBAppsProtobufChannel.hpp"
|
||||
#include <string.h>
|
||||
|
||||
#include "fc_sensor.h"
|
||||
|
||||
// Initialize the static members
|
||||
uORB::AppsProtobufChannel *uORB::AppsProtobufChannel::_InstancePtr = nullptr;
|
||||
|
||||
void uORB::AppsProtobufChannel::ReceiveCallback(const char *topic,
|
||||
const uint8_t *data,
|
||||
uint32_t length_in_bytes)
|
||||
{
|
||||
if (strcmp(topic, "slpi_debug") == 0) {
|
||||
PX4_INFO("SLPI: %s", (const char *) data);
|
||||
|
||||
} else if (strcmp(topic, "slpi_error") == 0) {
|
||||
PX4_ERR("SLPI: %s", (const char *) data);
|
||||
|
||||
} else {
|
||||
PX4_INFO("Got received data callback for topic %s", topic);
|
||||
}
|
||||
}
|
||||
|
||||
void uORB::AppsProtobufChannel::AdvertiseCallback(const char *topic)
|
||||
{
|
||||
PX4_INFO("Got advertisement callback for topic %s", topic);
|
||||
}
|
||||
|
||||
void uORB::AppsProtobufChannel::SubscribeCallback(const char *topic)
|
||||
{
|
||||
PX4_INFO("Got subscription callback for topic %s", topic);
|
||||
}
|
||||
|
||||
void uORB::AppsProtobufChannel::UnsubscribeCallback(const char *topic)
|
||||
{
|
||||
PX4_INFO("Got remove subscription callback for topic %s", topic);
|
||||
}
|
||||
|
||||
bool uORB::AppsProtobufChannel::Initialize(bool enable_debug)
|
||||
{
|
||||
fc_callbacks cb = {&ReceiveCallback, &AdvertiseCallback,
|
||||
&SubscribeCallback, &UnsubscribeCallback
|
||||
};
|
||||
|
||||
if (fc_sensor_initialize(enable_debug, &cb) != 0) {
|
||||
PX4_ERR("Error calling the muorb protobuf initalize method");
|
||||
|
||||
} else {
|
||||
PX4_INFO("muorb protobuf initalize method succeeded");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2022 ModalAI, Inc. 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _uORBAppsProtobufChannel_hpp_
|
||||
#define _uORBAppsProtobufChannel_hpp_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <px4_platform_common/log.h>
|
||||
|
||||
namespace uORB
|
||||
{
|
||||
class AppsProtobufChannel;
|
||||
}
|
||||
|
||||
class uORB::AppsProtobufChannel
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* static method to get the IChannel Implementor.
|
||||
*/
|
||||
static uORB::AppsProtobufChannel *GetInstance()
|
||||
{
|
||||
if (_InstancePtr == nullptr) {
|
||||
_InstancePtr = new uORB::AppsProtobufChannel();
|
||||
}
|
||||
|
||||
return _InstancePtr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static method to check if there is an instance.
|
||||
*/
|
||||
static bool isInstance()
|
||||
{
|
||||
return (_InstancePtr != nullptr);
|
||||
}
|
||||
|
||||
bool Initialize(bool enable_debug);
|
||||
|
||||
private: // data members
|
||||
static uORB::AppsProtobufChannel *_InstancePtr;
|
||||
|
||||
private://class members.
|
||||
/// constructor.
|
||||
AppsProtobufChannel() {};
|
||||
|
||||
static void ReceiveCallback(const char *topic,
|
||||
const uint8_t *data,
|
||||
uint32_t length_in_bytes);
|
||||
static void AdvertiseCallback(const char *topic);
|
||||
static void SubscribeCallback(const char *topic);
|
||||
static void UnsubscribeCallback(const char *topic);
|
||||
|
||||
};
|
||||
|
||||
#endif /* _uORBAppsProtobufChannel_hpp_ */
|
||||
@@ -0,0 +1,37 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2022 ModalAI, Inc. 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
px4_add_library(modules__muorb__slpi
|
||||
uORBProtobufChannel.cpp
|
||||
)
|
||||
#target_include_directories(modules__muorb__slpi PRIVATE ${PX4_SOURCE_DIR}/src/modules/uORB)
|
||||
@@ -0,0 +1,5 @@
|
||||
menuconfig MODULES_MUORB_SLPI
|
||||
bool "muorb_slpi"
|
||||
default n
|
||||
---help---
|
||||
Enable support for muorb slpi
|
||||
@@ -0,0 +1,64 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2022 ModalAI, Inc. 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "uORBProtobufChannel.hpp"
|
||||
|
||||
// TODO: Move this out of here once we have it placed properly
|
||||
extern "C" void HAP_debug(const char *msg, int level, const char *filename, int line);
|
||||
|
||||
int px4muorb_orb_initialize(fc_func_ptrs *func_ptrs, int32_t clock_offset_us)
|
||||
{
|
||||
HAP_debug("Hello, world!", 1, "test", 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4muorb_topic_advertised(const char *topic_name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4muorb_add_subscriber(const char *topic_name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4muorb_remove_subscriber(const char *topic_name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4muorb_send_topic_data(const char *topic_name, const uint8_t *data,
|
||||
int data_len_in_bytes)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (C) 2022 ModalAI, Inc. 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef _uORBProtobufChannel_hpp_
|
||||
#define _uORBProtobufChannel_hpp_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
//#include <unistd.h>
|
||||
|
||||
// TODO: This has to be defined in the slpi_proc build and in the PX4 build.
|
||||
// Make it accessible from one file to both builds.
|
||||
typedef struct {
|
||||
int (*advertise_func_ptr)(const char *topic_name);
|
||||
int (*subscribe_func_ptr)(const char *topic_name);
|
||||
int (*unsubscribe_func_ptr)(const char *topic_name);
|
||||
int (*topic_data_func_ptr)(const char *name, const uint8_t *data, int data_len_in_bytes);
|
||||
// device::SPI::_config_spi_bus_func_t config_spi_bus;
|
||||
// device::SPI::_spi_transfer_func_t spi_transfer;
|
||||
int (*_config_spi_bus_func_t)();
|
||||
int (*_spi_transfer_func_t)(int, const uint8_t *, uint8_t *, const unsigned);
|
||||
// device::I2C::_config_i2c_bus_func_t config_i2c_bus;
|
||||
// device::I2C::_set_i2c_address_func_t set_i2c_address;
|
||||
// device::I2C::_i2c_transfer_func_t i2c_transfer;
|
||||
int (*_config_i2c_bus_func_t)(uint8_t, uint8_t, uint32_t);
|
||||
int (*_set_i2c_address_func_t)(int, uint8_t);
|
||||
int (*_i2c_transfer_func_t)(int, const uint8_t *, const unsigned, uint8_t *, const unsigned);
|
||||
// open_uart_func_t open_uart_func;
|
||||
// write_uart_func_t write_uart_func;
|
||||
// read_uart_func_t read_uart_func;
|
||||
int (*open_uart_func_t)(uint8_t, uint32_t);
|
||||
int (*write_uart_func_t)(int, const void *, size_t);
|
||||
int (*read_uart_func_t)(int, void *, size_t);
|
||||
int (*register_interrupt_callback)(int (*)(int, void *, void *), void *arg);
|
||||
} fc_func_ptrs;
|
||||
|
||||
extern "C" {
|
||||
|
||||
int px4muorb_orb_initialize(fc_func_ptrs *func_ptrs, int32_t clock_offset_us) __EXPORT;
|
||||
|
||||
int px4muorb_topic_advertised(const char *name) __EXPORT;
|
||||
|
||||
int px4muorb_add_subscriber(const char *name) __EXPORT;
|
||||
|
||||
int px4muorb_remove_subscriber(const char *name) __EXPORT;
|
||||
|
||||
int px4muorb_send_topic_data(const char *name, const uint8_t *data, int data_len_in_bytes) __EXPORT;
|
||||
}
|
||||
|
||||
#endif /* _uORBProtobufChannel_hpp_ */
|
||||
Reference in New Issue
Block a user