Skip to content

Commit

Permalink
pios_adc: remove DevicePinGet.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlyle committed May 9, 2018
1 parent afb2d35 commit e43d93e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
19 changes: 0 additions & 19 deletions flight/PiOS/Common/pios_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,6 @@ int32_t PIOS_ADC_Init(uintptr_t *adc_id, const struct pios_adc_driver *driver, u
return 0;
}

/**
* @brief Gets the ADC value of the given pin of the device
* \param[in] adc_id pointer to the device to read from
* \param[in] device_pin pin from device to be read
* \return the value of the pin or -1 if error
*/
int32_t PIOS_ADC_DevicePinGet(uintptr_t adc_id, uint32_t device_pin)
{
struct pios_adc_dev * adc_dev = (struct pios_adc_dev *) adc_id;

if (!PIOS_ADC_validate(adc_dev)) {
return -1;
}
if (adc_dev->driver->get_pin)
return (adc_dev->driver->get_pin)(adc_dev->lower_id, device_pin);
else
return -1;
}

/**
* @brief Checks if a given pin is available on the given device
* \param[in] adc_id handle of the device to read
Expand Down
1 change: 0 additions & 1 deletion flight/PiOS/inc/pios_adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ struct pios_adc_driver {
};

/* Public Functions */
extern int32_t PIOS_ADC_DevicePinGet(uintptr_t adc_id, uint32_t device_pin);
extern bool PIOS_ADC_Available(uintptr_t adc_id, uint32_t device_pin);
extern int32_t PIOS_ADC_GetChannelRaw(uint32_t channel);
extern float PIOS_ADC_GetChannelVolt(uint32_t channel);
Expand Down
8 changes: 4 additions & 4 deletions flight/targets/flyingpio/fw/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,18 @@ static void generate_status_message(int *resp_len)

resp->valid_messages_recvd = msg_num;

for (int i=0; i<FPPROTO_MAX_RCCHANS; i++) {
for (int i = 0; i < FPPROTO_MAX_RCCHANS; i++) {
if (pios_rcvr_group_map[0]) {
resp->chan_data[i] =
/* 1-offset vs 0-offset grr */
PIOS_RCVR_Read(pios_rcvr_group_map[0], i+1);
PIOS_RCVR_Read(pios_rcvr_group_map[0], i + 1);
} else {
resp->chan_data[i] = PIOS_RCVR_NODRIVER;
}
}

for (int i=0; i<FPPROTO_MAX_ADCCHANS; i++) {
resp->adc_data[i] = PIOS_ADC_DevicePinGet(adc_id, i);
for (int i = 0; i < FPPROTO_MAX_ADCCHANS; i++) {
resp->adc_data[i] = PIOS_ADC_GetChannelRaw(i);
}

flyingpi_calc_crc(&tx_buf, true, resp_len);
Expand Down

0 comments on commit e43d93e

Please sign in to comment.