mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 00:13:35 +08:00
platforms: remove unnecessary i2c platform abstraction
This commit is contained in:
@@ -182,7 +182,7 @@ I2C::transfer(const uint8_t *send, const unsigned send_len, uint8_t *recv, const
|
||||
do {
|
||||
DEVICE_DEBUG("transfer out %p/%u in %p/%u", send, send_len, recv, recv_len);
|
||||
|
||||
px4_i2c_msg_t msgv[2] {};
|
||||
i2c_msg_s msgv[2] {};
|
||||
unsigned msgs = 0;
|
||||
|
||||
if (send_len > 0) {
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
#include "../CDev.hpp"
|
||||
|
||||
#include <px4_platform_common/i2c.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
|
||||
#if !defined(CONFIG_I2C)
|
||||
# error I2C support requires CONFIG_I2C
|
||||
@@ -113,7 +113,7 @@ protected:
|
||||
|
||||
private:
|
||||
uint32_t _frequency{0};
|
||||
px4_i2c_dev_t *_dev{nullptr};
|
||||
i2c_master_s *_dev{nullptr};
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ I2C::transfer(const uint8_t *send, const unsigned send_len, uint8_t *recv, const
|
||||
|
||||
if (recv_len > 0) {
|
||||
msgv[msgs].addr = get_device_address();
|
||||
msgv[msgs].flags = I2C_M_READ;
|
||||
msgv[msgs].flags = I2C_M_RD;
|
||||
msgv[msgs].buf = recv;
|
||||
msgv[msgs].len = recv_len;
|
||||
msgs++;
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
|
||||
#include "../CDev.hpp"
|
||||
|
||||
#include <px4_platform_common/i2c.h>
|
||||
|
||||
namespace device __EXPORT
|
||||
{
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ I2C::init()
|
||||
|
||||
// Open the actual I2C device
|
||||
char dev_path[16] {};
|
||||
snprintf(dev_path, sizeof(dev_path), "/dev/iic-%i", get_device_bus());
|
||||
snprintf(dev_path, sizeof(dev_path), DEV_FS_I2C_DEVICE_TYPE_STRING"%i", get_device_bus());
|
||||
_fd = ::open(dev_path, O_RDWR);
|
||||
|
||||
if (_fd < 0) {
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
|
||||
#include "../CDev.hpp"
|
||||
|
||||
#include <px4_platform_common/i2c.h>
|
||||
|
||||
namespace device __EXPORT
|
||||
{
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/module.h>
|
||||
#include <px4_platform_common/getopt.h>
|
||||
#include <px4_platform_common/i2c.h>
|
||||
|
||||
namespace i2cdetect
|
||||
{
|
||||
@@ -80,7 +79,7 @@ int detect(int bus)
|
||||
do {
|
||||
uint8_t send_data = 0;
|
||||
uint8_t recv_data = 0;
|
||||
px4_i2c_msg_t msgv[2];
|
||||
i2c_msg_s msgv[2] {};
|
||||
|
||||
// send
|
||||
msgv[0].frequency = 100000;
|
||||
|
||||
Reference in New Issue
Block a user