Skip to content

drivers/analog: fix adc ads1115 driver#18286

Merged
linguini1 merged 1 commit intoapache:masterfrom
tiiuae:fix-ads1115-driver
Feb 3, 2026
Merged

drivers/analog: fix adc ads1115 driver#18286
linguini1 merged 1 commit intoapache:masterfrom
tiiuae:fix-ads1115-driver

Conversation

@arikimari
Copy link
Contributor

@arikimari arikimari commented Jan 30, 2026

Summary

Fix reg write function so that it works with all platfroms

  • platfroms that that does not support I2C_M_NOSTART flag
  • function always writes 3 bytes, this implementation is more efficient,
    no need for to two separate i2c messages
    Remove one unused static function (causing compile warning)
    Fix documentation of channels

Impact

Platforms using ads1115 driver from Nuttx

Testing

Custom nxp93 hw with ads1115 adc

Test code:

_ads1115 = ads1115_initialize(imx9_i2cbus_initialize(2),
                                   CONFIG_ADC_ADS1115_ADDR);
if (ads1115 != NULL)
  {
    adc_msg.am_channel = 6;
    adc_msg.am_data = 0;
    ads1115->ad_ops->ao_ioctl(ads1115,ANIOC_ADS1115_READ_CHANNEL,
                                     (long unsigned int)&adc_msg);
    _alert("ads1115 adc channel 6 value: %d\n", adc_msg.am_data);_

Output of this is:

ads1115 adc channel 6 value: 8778

Value is correct for this channel 6 (voltage is so that value should be about 8800)

@arikimari arikimari requested a review from linguini1 as a code owner January 30, 2026 13:12
@github-actions github-actions bot added the Size: S The size of the change in this PR is small label Jan 30, 2026
Signed-off-by: Ari Kimari <ari.kimari@tii.ae>

Fix write reg to work with all platforms
Fix compile warnings
@acassis
Copy link
Contributor

acassis commented Jan 30, 2026

@arikimari please fix:

❌ Missing git commit message
Used config files:
1: .codespellrc
Some checks failed. For contributing guidelines, see:
https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md
Error: Process completed with exit code 1.

Copy link
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is good, but please provide some information about how you tested and some logs of the results.

@arikimari
Copy link
Contributor Author

The change is good, but please provide some information about how you tested and some logs of the results.

Test code added and logs from results

@linguini1 linguini1 merged commit f126e75 into apache:master Feb 3, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants