Skip to content
Snippets Groups Projects
Commit 9e8b1edb authored by Kees Bakker's avatar Kees Bakker
Browse files

drivers/ads101x: eliminate casts

A helper variable is added, and now all type casts are not needed anymore.
parent b77c802f
No related branches found
No related tags found
No related merge requests found
...@@ -33,18 +33,19 @@ ...@@ -33,18 +33,19 @@
static int read_adc(const void *dev, phydat_t *res) static int read_adc(const void *dev, phydat_t *res)
{ {
const ads101x_t *mydev = dev;
/* Change the mux channel */ /* Change the mux channel */
ads101x_set_mux_gain((const ads101x_t *)dev, ads101x_set_mux_gain(mydev, mydev->params.mux_gain);
((ads101x_t *)dev)->params.mux_gain);
/* Read raw value */ /* Read raw value */
if (ads101x_read_raw((const ads101x_t *)dev, res->val) < 0) { if (ads101x_read_raw(mydev, res->val) < 0) {
return ECANCELED; return ECANCELED;
} }
/* Special case for 2.048V */ /* Special case for 2.048V */
/* (this is the fixed FSR of ADS1013 and ADS1113) */ /* (this is the fixed FSR of ADS1013 and ADS1113) */
if ((((ads101x_t *)dev)->params.mux_gain & ADS101X_PGA_MASK) if ((mydev->params.mux_gain & ADS101X_PGA_MASK)
== ADS101X_PGA_FSR_2V048) { == ADS101X_PGA_FSR_2V048) {
/* LSB == 62.5uV to LSB == 100uV */ /* LSB == 62.5uV to LSB == 100uV */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment