PX4 System:Expunge the nuttx adc structure from the system

This PR is preliminary ground work for FMUv5.

   PX4 does not use the NuttX adc driver. But used the same format
   for the data returned by the nuttx ADC driver.

   There was a fixme:in src/platforms/px4_adc.h "this needs to be
   a px4_adc_msg_s type" With this PR the need for
   src/platforms/px4_adc.h goes away as the driver drv_adc.h now
   describes the px4_adc_msg_t.
This commit is contained in:
David Sidrane
2017-07-17 22:28:29 +02:00
committed by Lorenz Meier
parent d92377a6e6
commit 4349f49610
13 changed files with 50 additions and 101 deletions
+8 -4
View File
@@ -122,7 +122,7 @@ private:
perf_counter_t _sample_perf;
unsigned _channel_count;
adc_msg_s *_samples; /**< sample buffer */
px4_adc_msg_t *_samples; /**< sample buffer */
orb_advert_t _to_system_power;
orb_advert_t _to_adc_report;
@@ -168,7 +168,11 @@ ADC::ADC(uint32_t channels) :
}
}
_samples = new adc_msg_s[_channel_count];
if (_channel_count > PX4_MAX_ADC_CHANNELS) {
PX4_ERR("PX4_MAX_ADC_CHANNELS is too small:is %d needed:%d", PX4_MAX_ADC_CHANNELS, _channel_count);
}
_samples = new px4_adc_msg_t[_channel_count];
/* prefill the channel numbers in the sample array */
if (_samples != nullptr) {
@@ -265,7 +269,7 @@ ADC::ioctl(file *filp, int cmd, unsigned long arg)
ssize_t
ADC::read(file *filp, char *buffer, size_t len)
{
const size_t maxsize = sizeof(adc_msg_s) * _channel_count;
const size_t maxsize = sizeof(px4_adc_msg_t) * _channel_count;
if (len > maxsize) {
len = maxsize;
@@ -441,7 +445,7 @@ test(void)
}
for (unsigned i = 0; i < 50; i++) {
adc_msg_s data[12];
px4_adc_msg_t data[PX4_MAX_ADC_CHANNELS];
ssize_t count = read(fd, data, sizeof(data));
if (count < 0) {