Changing Ardupilot IMU of linux board General

HI …
Iam traying to change ardupilot code to work with any IMU that support SPI protocol
but i have problem when make change in AP_InertialSensor exact on AP_InertialSensor_MPU9150
becuase that is mpu is 8 bit register address and i have mpu has 16 bit register address need it to work
and i have detect that spi drive is shared between more than sensor .
can i solve this problem? or
can i create new library for my new MPU to support it and how i can use spi driver to write 16 bit register address and recive 16 bit register data like the funcation on arduino spi.transfer16()
and how i can set spi setting like arduino spi mod spi clock spi begin dataOrder and speedMaximum that are
work for my new MPU? and thank you to all who will help.

Did you looked at the WIKI ?
I suggest you start here:

thank you so much for your answer.
i can change and use any imu with 8 bit address via spi by changing user define address like
#define MPUREG_WHOAMI 0x75
but now i have imu with 16 bit address i need to use it that it is address should be like
#define MPUREG_WHOAMI 0x0075
can i solve this problem? i hope to get solution?

There is a HAL (Hardware abstraction layer) so all the drivers are generic. I’ve never heard of a 16bit whoami, are you sure the 9150 needs that? The 9150 is 8bit. Speaking of that, there’s already a 6000, 6500, 9250, 9255, 20608, and 20602 driver in the AP_IntertialSensor_Invensense.cpp file, why not add the 9150 to it? Should be just a couple lines! All the Invensense drivers are similar which is why they’re all in 1 file.

Also, I see in the 9150 register map that WHO_AM_I, along with all other registers, are 8bit.

I think what you’re asking for is to ignore the HAL and do it “from scratch” which I highly advise against. But, the function you’re looking for is _dev->transfer()

which is used here to read the FIFO.

You’re not in arduino land here, especially when running linux. Keep in mind that each SPI bus has it’s own thread.

thank you .
i know there is HAL and all drivers in HAL are for imu of 8 bits but the IMU i have worked with it
is ADIS16488 MEMS and i have tried to turn it on by connect it via spi so the first thing i have do it
is make change on ready HAL to make interface so the problems is 16 bit register map of ADIS16488.
Can you help me to use this ADIS16488 with linux ardupilot ?
iam working to make my own open source hardware can any one help me?