mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-15 06:00:35 +08:00
I2C changes for upstream NuttX per trasaction freq control
This commit is contained in:
committed by
Lorenz Meier
parent
0177e250f4
commit
dcc2d1c3d1
+12
-10
@@ -46,14 +46,17 @@
|
||||
#error "Devices not supported in ROS"
|
||||
|
||||
#elif defined (__PX4_NUTTX)
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Building for NuttX
|
||||
*/
|
||||
#include <px4_config.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/i2c.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <chip.h>
|
||||
@@ -64,7 +67,8 @@
|
||||
|
||||
#define px4_i2c_msg_t i2c_msg_s
|
||||
|
||||
typedef struct i2c_dev_s px4_i2c_dev_t;
|
||||
typedef struct i2c_master_s px4_i2c_dev_t;
|
||||
__END_DECLS
|
||||
|
||||
#elif defined(__PX4_POSIX)
|
||||
#include <stdint.h>
|
||||
@@ -74,11 +78,13 @@ typedef struct i2c_dev_s px4_i2c_dev_t;
|
||||
#define I2C_M_NORESTART 0x0080 /* message should not begin with (re-)start of transfer */
|
||||
|
||||
// NOTE - This is a copy of the NuttX i2c_msg_s structure
|
||||
|
||||
typedef struct {
|
||||
uint16_t addr; /* Slave address */
|
||||
uint16_t flags; /* See I2C_M_* definitions */
|
||||
uint8_t *buffer;
|
||||
int length;
|
||||
uint32_t frequency; /* I2C frequency */
|
||||
uint16_t addr; /* Slave address (7- or 10-bit) */
|
||||
uint16_t flags; /* See I2C_M_* definitions */
|
||||
uint8_t *buffer; /* Buffer to be transferred */
|
||||
ssize_t length; /* Length of the buffer in bytes */
|
||||
} px4_i2c_msg_t;
|
||||
|
||||
// NOTE - This is a copy of the NuttX i2c_ops_s structure
|
||||
@@ -86,10 +92,6 @@ typedef struct {
|
||||
const struct px4_i2c_ops_t *ops; /* I2C vtable */
|
||||
} px4_i2c_dev_t;
|
||||
|
||||
// FIXME - Empty defines for I2C ops
|
||||
// Original version commented out
|
||||
//#define I2C_SETFREQUENCY(d,f) ((d)->ops->setfrequency(d,f))
|
||||
#define I2C_SETFREQUENCY(d,f)
|
||||
//#define SPI_SELECT(d,id,s) ((d)->ops->select(d,id,s))
|
||||
#define SPI_SELECT(d,id,s)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user