drivers/analog: Run all wireless drivers through tools/nxstyle, correcting as many complaints as possible.
This commit is contained in:
parent
2a83c0808c
commit
cbde36e406
@ -104,6 +104,7 @@ static const struct adc_callback_s g_adc_callback =
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: adc_open
|
||||
*
|
||||
@ -493,7 +494,7 @@ static void adc_notify(FAR struct adc_dev_s *dev)
|
||||
* then wake them up now.
|
||||
*/
|
||||
|
||||
adc_pollnotify(dev, POLLIN);
|
||||
adc_pollnotify(dev, POLLIN);
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
|
@ -75,11 +75,11 @@ struct ads1242_dev_s
|
||||
static void ads1242_lock(FAR struct spi_dev_s *spi);
|
||||
static void ads1242_unlock(FAR struct spi_dev_s *spi);
|
||||
static void ads1242_reset(FAR struct ads1242_dev_s *dev);
|
||||
static void ads1242_performSelfGainCalibration(
|
||||
static void ads1242_perform_selfgain_calibration(
|
||||
FAR struct ads1242_dev_s *dev);
|
||||
static void ads1242_performSelfOffsetCalibration(
|
||||
static void ads1242_perform_selfoffset_calibration(
|
||||
FAR struct ads1242_dev_s *dev);
|
||||
static void ads1242_performSystemOffsetCalibration(
|
||||
static void ads1242_perform_systemoffset_calibration(
|
||||
FAR struct ads1242_dev_s *dev);
|
||||
static void ads1242_read_conversion_result(FAR struct ads1242_dev_s *dev,
|
||||
FAR uint32_t *conversion_result);
|
||||
@ -168,19 +168,22 @@ static void ads1242_reset(FAR struct ads1242_dev_s *dev)
|
||||
{
|
||||
ads1242_lock(dev->spi);
|
||||
|
||||
SPI_SELECT(dev->spi, 0, true); /* Set nADC_SPI_CS to low which selects the ADS1242 */
|
||||
SPI_SEND(dev->spi, ADS1242_CMD_RESET);/* Issue reset command */
|
||||
SPI_SELECT(dev->spi, 0, false); /* Set nADC_SPI_CS to high which deselects the ADS1242 */
|
||||
up_mdelay(100); /* Wait a little so the device has time to perform a proper reset */
|
||||
SPI_SELECT(dev->spi, 0, true); /* Set nADC_SPI_CS to low which
|
||||
* selects the ADS1242 */
|
||||
SPI_SEND(dev->spi, ADS1242_CMD_RESET); /* Issue reset command */
|
||||
SPI_SELECT(dev->spi, 0, false); /* Set nADC_SPI_CS to high which
|
||||
* deselects the ADS1242 */
|
||||
up_mdelay(100); /* Wait a little so the device has
|
||||
* time to perform a proper reset */
|
||||
|
||||
ads1242_unlock(dev->spi);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ads1242_performSelfGainCalibration
|
||||
* Name: ads1242_perform_selfgain_calibration
|
||||
****************************************************************************/
|
||||
|
||||
static void ads1242_performSelfGainCalibration(FAR struct ads1242_dev_s *dev)
|
||||
static void ads1242_perform_selfgain_calibration(FAR struct ads1242_dev_s *dev)
|
||||
{
|
||||
ads1242_lock(dev->spi);
|
||||
|
||||
@ -192,10 +195,10 @@ static void ads1242_performSelfGainCalibration(FAR struct ads1242_dev_s *dev)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ads1242_performSelfOffsetCalibration
|
||||
* Name: ads1242_perform_selfoffset_calibration
|
||||
****************************************************************************/
|
||||
|
||||
static void ads1242_performSelfOffsetCalibration(FAR struct ads1242_dev_s *dev)
|
||||
static void ads1242_perform_selfoffset_calibration(FAR struct ads1242_dev_s *dev)
|
||||
{
|
||||
ads1242_lock(dev->spi);
|
||||
|
||||
@ -207,11 +210,11 @@ static void ads1242_performSelfOffsetCalibration(FAR struct ads1242_dev_s *dev)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ads1242_performSystemOffsetCalibration
|
||||
* Name: ads1242_perform_systemoffset_calibration
|
||||
****************************************************************************/
|
||||
|
||||
static void
|
||||
ads1242_performSystemOffsetCalibration(FAR struct ads1242_dev_s *dev)
|
||||
ads1242_perform_systemoffset_calibration(FAR struct ads1242_dev_s *dev)
|
||||
{
|
||||
ads1242_lock(dev->spi);
|
||||
|
||||
@ -247,9 +250,9 @@ static void ads1242_read_conversion_result(FAR struct ads1242_dev_s *dev,
|
||||
* 3rd Byte = LSB
|
||||
*/
|
||||
|
||||
*conversion_result |= ((uint32_t)(SPI_SEND(dev->spi, 0xFF))) << 16;
|
||||
*conversion_result |= ((uint32_t)(SPI_SEND(dev->spi, 0xFF))) << 8;
|
||||
*conversion_result |= ((uint32_t)(SPI_SEND(dev->spi, 0xFF))) << 0;
|
||||
*conversion_result |= ((uint32_t)(SPI_SEND(dev->spi, 0xff))) << 16;
|
||||
*conversion_result |= ((uint32_t)(SPI_SEND(dev->spi, 0xff))) << 8;
|
||||
*conversion_result |= ((uint32_t)(SPI_SEND(dev->spi, 0xff))) << 0;
|
||||
|
||||
SPI_SELECT(dev->spi, 0, false);
|
||||
|
||||
@ -306,7 +309,7 @@ static void ads1242_read_reg(FAR struct ads1242_dev_s *dev,
|
||||
|
||||
up_udelay(50 * dev->osc_period_us);
|
||||
|
||||
*reg_value = SPI_SEND(dev->spi, 0xFF);
|
||||
*reg_value = SPI_SEND(dev->spi, 0xff);
|
||||
|
||||
SPI_SELECT(dev->spi, 0, false);
|
||||
|
||||
@ -335,15 +338,16 @@ static void ads1242_set_gain(FAR struct ads1242_dev_s *dev,
|
||||
|
||||
/* It is necessary to perform a offset calibration after setting the gain */
|
||||
|
||||
ads1242_performSelfOffsetCalibration(dev);
|
||||
ads1242_perform_selfoffset_calibration(dev);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ads1242_set_positive_input
|
||||
****************************************************************************/
|
||||
|
||||
static void ads1242_set_positive_input(FAR struct ads1242_dev_s *dev,
|
||||
ADS1242_POSITIVE_INPUT_SELECTION const pos_in_sel)
|
||||
static void
|
||||
ads1242_set_positive_input(FAR struct ads1242_dev_s *dev,
|
||||
ADS1242_POSITIVE_INPUT_SELECTION const pos_in_sel)
|
||||
{
|
||||
uint8_t mux_reg_value = 0;
|
||||
|
||||
@ -362,8 +366,9 @@ static void ads1242_set_positive_input(FAR struct ads1242_dev_s *dev,
|
||||
* Name: ads1242_set_negative_input
|
||||
****************************************************************************/
|
||||
|
||||
static void ads1242_set_negative_input(FAR struct ads1242_dev_s *dev,
|
||||
ADS1242_NEGATIVE_INPUT_SELECTION const neg_in_sel)
|
||||
static void
|
||||
ads1242_set_negative_input(FAR struct ads1242_dev_s *dev,
|
||||
ADS1242_NEGATIVE_INPUT_SELECTION const neg_in_sel)
|
||||
{
|
||||
uint8_t mux_reg_value = 0;
|
||||
|
||||
@ -384,7 +389,7 @@ static void ads1242_set_negative_input(FAR struct ads1242_dev_s *dev,
|
||||
|
||||
static bool ads1242_is_data_ready(FAR struct ads1242_dev_s *dev)
|
||||
{
|
||||
uint8_t acr_reg_value = 0xFF;
|
||||
uint8_t acr_reg_value = 0xff;
|
||||
|
||||
ads1242_read_reg(dev, ADS1242_REG_ACR, &acr_reg_value);
|
||||
return (acr_reg_value & ADS1242_REG_ACR_BIT_nDRDY) == 0;
|
||||
@ -397,19 +402,19 @@ static bool ads1242_is_data_ready(FAR struct ads1242_dev_s *dev)
|
||||
#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_INFO)
|
||||
static void ads1242_print_regs(FAR struct ads1242_dev_s *dev, char const *msg)
|
||||
{
|
||||
uint8_t setup_reg_value = 0;
|
||||
uint8_t mux_reg_value = 0;
|
||||
uint8_t acr_reg_value = 0;
|
||||
uint8_t setup_reg_value = 0;
|
||||
uint8_t mux_reg_value = 0;
|
||||
uint8_t acr_reg_value = 0;
|
||||
|
||||
ainfo("%s\n", msg);
|
||||
ainfo("%s\n", msg);
|
||||
|
||||
ads1242_read_reg(dev, ADS1242_REG_SETUP, &setup_reg_value);
|
||||
ads1242_read_reg(dev, ADS1242_REG_MUX, &mux_reg_value);
|
||||
ads1242_read_reg(dev, ADS1242_REG_ACR, &acr_reg_value);
|
||||
ads1242_read_reg(dev, ADS1242_REG_SETUP, &setup_reg_value);
|
||||
ads1242_read_reg(dev, ADS1242_REG_MUX, &mux_reg_value);
|
||||
ads1242_read_reg(dev, ADS1242_REG_ACR, &acr_reg_value);
|
||||
|
||||
ainfo("SETUP %02X\n", setup_reg_value);
|
||||
ainfo("MUX %02X\n", mux_reg_value);
|
||||
ainfo("ACR %02X\n", acr_reg_value);
|
||||
ainfo("SETUP %02X\n", setup_reg_value);
|
||||
ainfo("MUX %02X\n", mux_reg_value);
|
||||
ainfo("ACR %02X\n", acr_reg_value);
|
||||
}
|
||||
#endif /* CONFIG_DEBUG_FEATURES && CONFIG_DEBUG_INFO */
|
||||
|
||||
@ -425,7 +430,7 @@ static int ads1242_open(FAR struct file *filep)
|
||||
ads1242_reset(priv);
|
||||
up_mdelay(100);
|
||||
|
||||
ads1242_performSelfGainCalibration(priv);
|
||||
ads1242_perform_selfgain_calibration(priv);
|
||||
up_mdelay(100);
|
||||
|
||||
/* SPEED = 1 -> fMod = fOsc / 256 (fMod = Modulator Clock Speed)
|
||||
@ -436,7 +441,7 @@ static int ads1242_open(FAR struct file *filep)
|
||||
ads1242_write_reg(priv, ADS1242_REG_ACR,
|
||||
ADS1242_REG_ACR_BIT_SPEED | ADS1242_REG_ACR_BIT_BUFEN);
|
||||
|
||||
ads1242_performSelfOffsetCalibration(priv);
|
||||
ads1242_perform_selfoffset_calibration(priv);
|
||||
up_mdelay(100);
|
||||
|
||||
#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_INFO)
|
||||
@ -445,6 +450,7 @@ static int ads1242_open(FAR struct file *filep)
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ads1242_close
|
||||
****************************************************************************/
|
||||
@ -543,7 +549,7 @@ static int ads1242_ioctl (FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case ANIOC_ADS2142_DO_SYSTEM_OFFSET_CALIB:
|
||||
{
|
||||
ads1242_performSystemOffsetCalibration(priv);
|
||||
ads1242_perform_systemoffset_calibration(priv);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -193,11 +193,13 @@ static uint8_t getspsreg(uint16_t sps)
|
||||
3, 7, 12, 20, 27, 40, 55, 80,
|
||||
300, 750, 1500, 3000, 5000, 10000, 20000, 65535,
|
||||
};
|
||||
|
||||
static const unsigned char sps_reg[] =
|
||||
{
|
||||
0x03, 0x13, 0x23, 0x33, 0x43, 0x53, 0x63, 0x72,
|
||||
0x82, 0x92, 0xa1, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0,
|
||||
};
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
|
@ -143,7 +143,7 @@ static void comp_pollnotify(FAR struct comp_dev_s *dev,
|
||||
|
||||
static void comp_semtake(FAR sem_t *sem)
|
||||
{
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
do
|
||||
{
|
||||
@ -224,7 +224,7 @@ static int comp_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
||||
fds->priv = NULL;
|
||||
}
|
||||
|
||||
errout:
|
||||
errout:
|
||||
nxsem_post(&dev->ad_sem);
|
||||
return ret;
|
||||
}
|
||||
@ -389,7 +389,7 @@ static ssize_t comp_read(FAR struct file *filep, FAR char *buffer, size_t buflen
|
||||
|
||||
/****************************************************************************
|
||||
* Name: comp_ioctl
|
||||
****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static int comp_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
|
@ -100,6 +100,7 @@ static const struct file_operations dac_fops =
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: dac_open
|
||||
*
|
||||
@ -264,7 +265,8 @@ static int dac_xmit(FAR struct dac_dev_s *dev)
|
||||
* Name: dac_write
|
||||
************************************************************************************/
|
||||
|
||||
static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer, size_t buflen)
|
||||
static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer,
|
||||
size_t buflen)
|
||||
{
|
||||
FAR struct inode *inode = filep->f_inode;
|
||||
FAR struct dac_dev_s *dev = inode->i_private;
|
||||
@ -318,8 +320,8 @@ static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer, size_t
|
||||
|
||||
while ((buflen - nsent) >= msglen)
|
||||
{
|
||||
/* Check if adding this new message would over-run the drivers ability to enqueue
|
||||
* xmit data.
|
||||
/* Check if adding this new message would over-run the drivers ability
|
||||
* to enqueue xmit data.
|
||||
*/
|
||||
|
||||
nexttail = fifo->af_tail + 1;
|
||||
@ -386,27 +388,30 @@ static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer, size_t
|
||||
else if (msglen == 4)
|
||||
{
|
||||
fifo->af_buffer[fifo->af_tail].am_channel = buffer[nsent];
|
||||
fifo->af_buffer[fifo->af_tail].am_data = *(uint32_t *)&buffer[nsent];
|
||||
fifo->af_buffer[fifo->af_tail].am_data &= 0xffffff00;
|
||||
fifo->af_buffer[fifo->af_tail].am_data =
|
||||
*(FAR uint32_t *)&buffer[nsent];
|
||||
fifo->af_buffer[fifo->af_tail].am_data &= 0xffffff00;
|
||||
}
|
||||
else if (msglen == 3)
|
||||
{
|
||||
fifo->af_buffer[fifo->af_tail].am_channel = buffer[nsent];
|
||||
fifo->af_buffer[fifo->af_tail].am_data = (*(uint16_t *)&buffer[nsent+1]);
|
||||
fifo->af_buffer[fifo->af_tail].am_data <<= 16;
|
||||
fifo->af_buffer[fifo->af_tail].am_data =
|
||||
(*(FAR uint16_t *)&buffer[nsent + 1]);
|
||||
fifo->af_buffer[fifo->af_tail].am_data <<= 16;
|
||||
}
|
||||
else if (msglen == 2)
|
||||
{
|
||||
fifo->af_buffer[fifo->af_tail].am_channel = 0;
|
||||
fifo->af_buffer[fifo->af_tail].am_data = (*(uint16_t *)&buffer[nsent]);
|
||||
fifo->af_buffer[fifo->af_tail].am_data <<= 16;
|
||||
fifo->af_buffer[fifo->af_tail].am_data =
|
||||
(*(FAR uint16_t *)&buffer[nsent]);
|
||||
fifo->af_buffer[fifo->af_tail].am_data <<= 16;
|
||||
}
|
||||
else if (msglen == 1)
|
||||
{
|
||||
{
|
||||
fifo->af_buffer[fifo->af_tail].am_channel = 0;
|
||||
fifo->af_buffer[fifo->af_tail].am_data = buffer[nsent];
|
||||
fifo->af_buffer[fifo->af_tail].am_data <<= 24;
|
||||
}
|
||||
}
|
||||
|
||||
/* Increment the tail of the circular buffer */
|
||||
|
||||
|
@ -71,8 +71,8 @@
|
||||
|
||||
#define LMP92001_REG_TEST 0x01U
|
||||
|
||||
#define LMP92001_REG_ID 0x0EU
|
||||
#define LMP92001_REG_VER 0x0FU
|
||||
#define LMP92001_REG_ID 0x0eU
|
||||
#define LMP92001_REG_VER 0x0fU
|
||||
|
||||
#define LMP92001_REG_SGEN 0x10U
|
||||
#define LMP92001_REG_SGPI 0x11U
|
||||
@ -85,9 +85,9 @@
|
||||
#define LMP92001_REG_CINH 0x17U
|
||||
#define LMP92001_REG_CINL 0x18U
|
||||
#define LMP92001_REG_CAD1 0x19U
|
||||
#define LMP92001_REG_CAD2 0x1AU
|
||||
#define LMP92001_REG_CAD3 0x1BU
|
||||
#define LMP92001_REG_CTRIG 0x1CU
|
||||
#define LMP92001_REG_CAD2 0x1aU
|
||||
#define LMP92001_REG_CAD3 0x1bU
|
||||
#define LMP92001_REG_CTRIG 0x1cU
|
||||
|
||||
#define LMP92001_REG_ADC1 0x20U
|
||||
#define LMP92001_REG_ADC2 0x21U
|
||||
@ -99,12 +99,12 @@
|
||||
#define LMP92001_REG_ADC8 0x27U
|
||||
#define LMP92001_REG_ADC9 0x28U
|
||||
#define LMP92001_REG_ADC10 0x29U
|
||||
#define LMP92001_REG_ADC11 0x2AU
|
||||
#define LMP92001_REG_ADC12 0x2BU
|
||||
#define LMP92001_REG_ADC13 0x2CU
|
||||
#define LMP92001_REG_ADC14 0x2DU
|
||||
#define LMP92001_REG_ADC15 0x2EU
|
||||
#define LMP92001_REG_ADC16 0x2FU
|
||||
#define LMP92001_REG_ADC11 0x2aU
|
||||
#define LMP92001_REG_ADC12 0x2bU
|
||||
#define LMP92001_REG_ADC13 0x2cU
|
||||
#define LMP92001_REG_ADC14 0x2dU
|
||||
#define LMP92001_REG_ADC15 0x2eU
|
||||
#define LMP92001_REG_ADC16 0x2fU
|
||||
#define LMP92001_REG_ADC17 0x30U
|
||||
|
||||
#define LMP92001_REG_LIH1 0x40U
|
||||
@ -117,8 +117,8 @@
|
||||
#define LMP92001_REG_LIL2 0x47U
|
||||
#define LMP92001_REG_LIL3 0x48U
|
||||
#define LMP92001_REG_LIL9 0x49U
|
||||
#define LMP92001_REG_LIL10 0x4AU
|
||||
#define LMP92001_REG_LIL11 0x4BU
|
||||
#define LMP92001_REG_LIL10 0x4aU
|
||||
#define LMP92001_REG_LIL11 0x4bU
|
||||
|
||||
#define LMP92001_REG_CREF 0x66U
|
||||
|
||||
@ -132,17 +132,17 @@
|
||||
#define LMP92001_REG_DAC8 0x87U
|
||||
#define LMP92001_REG_DAC9 0x88U
|
||||
#define LMP92001_REG_DAC10 0x89U
|
||||
#define LMP92001_REG_DAC11 0x8AU
|
||||
#define LMP92001_REG_DAC12 0x8BU
|
||||
#define LMP92001_REG_DAC11 0x8aU
|
||||
#define LMP92001_REG_DAC12 0x8bU
|
||||
|
||||
#define LMP92001_REG_DALL 0x90U
|
||||
|
||||
#define LMP92001_REG_BLK0 0xF0U
|
||||
#define LMP92001_REG_BLK1 0xF1U
|
||||
#define LMP92001_REG_BLK2 0xF2U
|
||||
#define LMP92001_REG_BLK3 0xF3U
|
||||
#define LMP92001_REG_BLK4 0xF4U
|
||||
#define LMP92001_REG_BLK5 0xF5U
|
||||
#define LMP92001_REG_BLK0 0xf0U
|
||||
#define LMP92001_REG_BLK1 0xf1U
|
||||
#define LMP92001_REG_BLK2 0xf2U
|
||||
#define LMP92001_REG_BLK3 0xf3U
|
||||
#define LMP92001_REG_BLK4 0xf4U
|
||||
#define LMP92001_REG_BLK5 0xf5U
|
||||
|
||||
#define LMP92001_SGEN_BUSY (1 << 7U)
|
||||
#define LMP92001_SGEN_RDYN (1 << 6U)
|
||||
@ -419,7 +419,7 @@ static int lmp92001_i2c_read(FAR struct lmp92001_dev_s *priv,
|
||||
/* Then perform the transfer. */
|
||||
|
||||
ret = I2C_TRANSFER(priv->i2c, msg, 2);
|
||||
if (ret < 0)
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("LMP92001 I2C transfer failed: %d", ret);
|
||||
return ret;
|
||||
@ -492,7 +492,7 @@ static int lmp92001_dac_updateall(FAR struct lmp92001_dev_s *priv,
|
||||
|
||||
buffer[0] = LMP92001_REG_DALL;
|
||||
buffer[1] = (uint8_t)(value >> 8U);
|
||||
buffer[2] = (uint8_t)(value & 0xFFU);
|
||||
buffer[2] = (uint8_t)(value & 0xffu);
|
||||
|
||||
ret = lmp92001_i2c_write(priv, buffer, BUFFER_SIZE);
|
||||
if (ret < 0)
|
||||
@ -607,15 +607,15 @@ static int lmp92001_dac_send(FAR struct dac_dev_s *dev,
|
||||
*/
|
||||
|
||||
buffer[0] = (msg->am_channel - 1) + LMP92001_REG_DAC1;
|
||||
buffer[1] = (uint8_t)(msg->am_data >> 8U);
|
||||
buffer[2] = (uint8_t)(msg->am_data & 0xFFU);
|
||||
buffer[1] = (uint8_t)(msg->am_data >> 8u);
|
||||
buffer[2] = (uint8_t)(msg->am_data & 0xffu);
|
||||
|
||||
ret = lmp92001_i2c_write(priv, buffer, BUFFER_SIZE);
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("LMP92001 DAC send failed: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
{
|
||||
aerr("LMP92001 DAC send failed: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
dac_txdone(&g_dacdev);
|
||||
|
||||
@ -795,9 +795,9 @@ static int lmp92001_adc_enablechannel(FAR struct lmp92001_dev_s *priv,
|
||||
return ret;
|
||||
}
|
||||
|
||||
cad1 |= channels & 0x000FFU;
|
||||
cad2 |= (channels >> 8U) & 0x000FFU;
|
||||
cad3 |= (channels >> 16U) & 0x1U;
|
||||
cad1 |= channels & 0x000ffu;
|
||||
cad2 |= (channels >> 8u) & 0x000ffu;
|
||||
cad3 |= (channels >> 16u) & 0x1u;
|
||||
|
||||
if (cad1 > 0)
|
||||
{
|
||||
@ -1363,7 +1363,6 @@ static int lmp92001_gpio_readpin(FAR struct ioexpander_dev_s *dev,
|
||||
*value = (bool)(regval >> pin) & 1U;
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -234,7 +234,7 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg)
|
||||
int i;
|
||||
uint16_t command;
|
||||
uint16_t data;
|
||||
int32_t dataToPost;
|
||||
int32_t postdata;
|
||||
int ret = OK;
|
||||
|
||||
if (cmd == ANIOC_TRIGGER)
|
||||
@ -250,7 +250,7 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg)
|
||||
if (i < priv->channel_config_count)
|
||||
{
|
||||
command = priv->channel_config[i].analog_multiplexer_config |
|
||||
priv->channel_config[i].analog_inputMode;
|
||||
priv->channel_config[i].analog_inputmode;
|
||||
command = command << 8;
|
||||
}
|
||||
else
|
||||
@ -265,18 +265,21 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg)
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
if (priv->channel_config[i-1].analog_inputMode == LTC1867L_UNIPOLAR ||
|
||||
(priv->channel_config[i-1].analog_inputMode == LTC1867L_BIPOLAR &&
|
||||
if (priv->channel_config[i - 1].analog_inputmode ==
|
||||
LTC1867L_UNIPOLAR ||
|
||||
(priv->channel_config[i - 1].analog_inputmode ==
|
||||
LTC1867L_BIPOLAR &&
|
||||
data >= 0 && data <= 0x7fff))
|
||||
{
|
||||
dataToPost = data;
|
||||
postdata = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
dataToPost = -(0xffff - data) - 1;
|
||||
postdata = -(0xffff - data) - 1;
|
||||
}
|
||||
|
||||
priv->cb->au_receive(dev, priv->channel_config[i-1].channel, dataToPost);
|
||||
priv->cb->au_receive(dev, priv->channel_config[i - 1].channel,
|
||||
postdata);
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,7 +321,7 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg)
|
||||
|
||||
int ltc1867l_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
|
||||
unsigned int devno,
|
||||
FAR struct ltc1867l_channel_config_s* channel_config,
|
||||
FAR struct ltc1867l_channel_config_s *channel_config,
|
||||
int channel_config_count)
|
||||
{
|
||||
FAR struct ltc1867l_dev_s *adcpriv;
|
||||
|
@ -83,6 +83,7 @@ static const struct file_operations opamp_fops =
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: opamp_open
|
||||
*
|
||||
@ -191,7 +192,7 @@ static int opamp_close(FAR struct file *filep)
|
||||
|
||||
/****************************************************************************
|
||||
* Name: opamp_ioctl
|
||||
****************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static int opamp_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
|
@ -55,6 +55,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The PGA112/PGA113 have a three-wire SPI digital interface; the
|
||||
* PGA116/PGA117 have a four-wire SPI digital interface. The PGA116/117 also
|
||||
* have daisy-chain capability (The PGA112/PGA113 can be used as the last device
|
||||
|
@ -101,7 +101,7 @@ begin_packed_struct struct ltc1867l_channel_config_s
|
||||
{
|
||||
uint8_t channel; /* This will be the channel number returned in struct adc_msg_s for a conversion */
|
||||
enum ltc1867l_analog_multiplexer_config_e analog_multiplexer_config; /* Analog multiplexer configuration */
|
||||
enum ltc1867l_analog_input_mode_e analog_inputMode; /* Analog input mode */
|
||||
enum ltc1867l_analog_input_mode_e analog_inputmode; /* Analog input mode */
|
||||
} end_packed_struct;
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user