Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards/b-l072z-lrwan1: add missing adc feature #20733

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

gzordrai
Copy link
Contributor

@gzordrai gzordrai commented Jun 6, 2024

Contribution description

This pull request adds the missing ADC feature for the b-l072z-lrwan1 board.

Testing procedure

I took a boards/b-l072z-lrwan1 board and added USEMODULE += periph_adc to the Makefile.
I connected an analog sensor to the A0, A2, and PA5 ports (ADCIN_0, ADCIN_4 and ADCIN_5) and checked if I could read values correctly.
ADCIN_2 and ADCIN_3 are used by ST-Link, but I can still read values from them.

#include <stdio.h>
#include <string.h>

#include "periph/adc.h"

#define NUM_LINES 5

int main(void)
{
    adc_t lines[NUM_LINES];
    int sample;

    for (int i = 0; i < NUM_LINES; i++)
        lines[i] = ADC_LINE(i);

    while (1)
    {
        for (int i = 0; i < NUM_LINES; i++) {
            sample = adc_sample(lines[i], ADC_RES_12BIT);

            printf("Sample (%i): %i\n", i, sample);
        }
    }

    return 0;
}

Output:

2024-06-06 02:02:08,260 # Sample (0): 2374
2024-06-06 02:02:08,261 # Sample (1): 4095
2024-06-06 02:02:08,263 # Sample (2): 4047
2024-06-06 02:02:08,264 # Sample (3): 372
2024-06-06 02:02:08,266 # Sample (4): 45
2024-06-06 02:02:08,267 # Sample (0): 2373
2024-06-06 02:02:08,269 # Sample (1): 4095
2024-06-06 02:02:08,270 # Sample (2): 4050
2024-06-06 02:02:08,272 # Sample (3): 370
2024-06-06 02:02:08,273 # Sample (4): 48

Issues/PRs references

Resolve 20732.

@github-actions github-actions bot added the Area: boards Area: Board ports label Jun 6, 2024
@aabadie aabadie enabled auto-merge June 6, 2024 06:15
@aabadie aabadie added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 6, 2024
@riot-ci
Copy link

riot-ci commented Jun 6, 2024

Murdock results

✔️ PASSED

c6d7b13 boards/b-l072z-lrwan1: add missing adc feature

Success Failures Total Runtime
550 0 550 04m:40s

Artifacts

@aabadie aabadie added this pull request to the merge queue Jun 6, 2024
Merged via the queue into RIOT-OS:master with commit 947c5a1 Jun 6, 2024
27 checks passed
@mguetschow mguetschow added this to the Release 2024.07 milestone Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

boards/b-l072z-lrwan1 missing adc feature
4 participants