mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 01:13:38 +08:00
Voxl2: add qurt i2c driver support and first i2c driver voxlpm
This commit is contained in:
@@ -41,7 +41,7 @@ if (${PX4_PLATFORM} STREQUAL "nuttx")
|
||||
list(APPEND SRCS_PLATFORM nuttx/SPI.cpp)
|
||||
endif()
|
||||
elseif((${PX4_PLATFORM} MATCHES "qurt"))
|
||||
# list(APPEND SRCS_PLATFORM qurt/I2C.cpp)
|
||||
list(APPEND SRCS_PLATFORM qurt/I2C.cpp)
|
||||
list(APPEND SRCS_PLATFORM qurt/SPI.cpp)
|
||||
list(APPEND SRCS_PLATFORM qurt/uart.c)
|
||||
elseif(UNIX AND NOT APPLE) #TODO: add linux PX4 platform type
|
||||
|
||||
@@ -42,8 +42,11 @@
|
||||
|
||||
#include "I2C.hpp"
|
||||
|
||||
#include <dev_fs_lib_i2c.h>
|
||||
#if defined(CONFIG_I2C)
|
||||
|
||||
#include <px4_platform_common/time.h>
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
#include <px4_platform_common/i2c_spi_buses.h>
|
||||
|
||||
namespace device
|
||||
{
|
||||
@@ -69,6 +72,11 @@ I2C::I2C(uint8_t device_type, const char *name, const int bus, const uint16_t ad
|
||||
PX4_INFO("*** I2C Device ID 0x%x %d", _device_id.devid, _device_id.devid);
|
||||
}
|
||||
|
||||
I2C::I2C(const I2CSPIDriverConfig &config)
|
||||
: I2C(config.devid_driver_index, config.module_name, config.bus, config.i2c_address, config.bus_frequency)
|
||||
{
|
||||
}
|
||||
|
||||
I2C::~I2C()
|
||||
{
|
||||
}
|
||||
@@ -157,3 +165,5 @@ I2C::transfer(const uint8_t *send, const unsigned send_len, uint8_t *recv, const
|
||||
}
|
||||
|
||||
} // namespace device
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,11 +37,14 @@
|
||||
* Base class for devices connected via I2C.
|
||||
*/
|
||||
|
||||
#ifndef _DEVICE_I2C_H
|
||||
#define _DEVICE_I2C_H
|
||||
#pragma once
|
||||
|
||||
#include <px4_arch/i2c_hw_description.h>
|
||||
#include "../CDev.hpp"
|
||||
#include <px4_platform_common/i2c.h>
|
||||
|
||||
#if defined(CONFIG_I2C)
|
||||
|
||||
struct I2CSPIDriverConfig;
|
||||
|
||||
namespace device __EXPORT
|
||||
{
|
||||
@@ -92,6 +95,7 @@ protected:
|
||||
* @param frequency I2C bus frequency for the device (currently not used)
|
||||
*/
|
||||
I2C(uint8_t device_type, const char *name, const int bus, const uint16_t address, const uint32_t frequency);
|
||||
I2C(const I2CSPIDriverConfig &config);
|
||||
virtual ~I2C();
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user