Integrating the ADXL 345 to the Pixhawk through I2C

Hello,

I am trying to integrate an ADXL 345 accelerometer to the Pixhawk through I2C and I am not sure if I should make my own driver for it? Can someone point to the right direction as to how I integrate the sensor to the pixhawk?

A follow up: I plan to integrate 5 of these sensors to the PX4 firmware. When I did this on the teensy/arduino, I used a mux, do I do the same here too?

I am just getting started with the firmware development so any sort of help would go a long way.

Thank you in advance.

First step is to get comfortable building the firmware yourself and running it on your hardware.
https://dev.px4.io/

From there take a look in src/drivers (https://github.com/PX4/Firmware/tree/master/src/drivers). If you search for I2C in that directory you’ll see quite a few examples of other i2c drivers.

Thank you so much for your reply. I was able to build the firmware and upload it on to my pixhawk.
I will look into the example drivers you directed me to and try to write up my own driver.

I do have another dumb question, once I have the driver, do I have to write a module which then talks to the sensor through the pixhawk (and then publishes uOrb messages)?

Thank you again

Your driver would publish the sensor_accel uORB message. For example the lsm303d (accel + mag) publishes here - https://github.com/PX4/Firmware/blob/master/src/drivers/lsm303d/lsm303d.cpp#L699

This is the definition of sensor_accel - https://github.com/PX4/Firmware/blob/master/msg/sensor_accel.msg