I am trying to modify the existing ADS1115 driver to create my own ADS7953 SPI driver. When I run the listener command to listen to the message published by the driver, in the device_id message, Simulator is showing where it should show SPI (similar to other drivers/topics). I am new to PX4 community and any help would be highly appreciated.
Can you share a link to code? You need to make sure the BusCLIArguments
struct is filled out properly. You’ll need to add a new DRV_ADC_DEVTYPE for ADS7953
For example:
extern "C" int ads1115_main(int argc, char *argv[])
{
using ThisDriver = ADS1115;
BusCLIArguments cli{true, false};
cli.default_i2c_frequency = 400000;
cli.i2c_address = 0x48;
const char *verb = cli.parseDefaultArguments(argc, argv);
if (!verb) {
ThisDriver::print_usage();
return -1;
}
BusInstanceIterator iterator(MODULE_NAME, cli, DRV_ADC_DEVTYPE_ADS1115);
if (!strcmp(verb, "start")) {
return ThisDriver::module_start(cli, iterator);
}
if (!strcmp(verb, "stop")) {
return ThisDriver::module_stop(iterator);
}
if (!strcmp(verb, "status")) {
return ThisDriver::module_status(iterator);
}
ThisDriver::print_usage();
return -1;
}