arduino / arduino/Arduino

change analog reference options from enum to #define constants

Open
#4,759 0 comments 0 reactions 0 assignees View on GitHub
Component: Core feature request
Dominant language
Java
Stars
14.6k
Forks
7k
PR merge metrics
No merged PRs in 30d

Description

Currently, on platforms that have multiple choices for source of the analog reference voltage, the possible choices are defined in an enum (this example from Zero):

```
typedef enum _eAnalogReference
{
AR_DEFAULT,
AR_INTERNAL,
AR_EXTERNAL,
AR_INTERNAL1V0,
AR_INTERNAL1V65,
AR_INTERNAL2V23
} eAnalogReference ;
```

It has been suggested that this is less useful than #define values, because it can not checked at compile time (in attempts at platform-independent code) with #ifdef

http://forum.arduino.cc/index.php?topic=387409.msg2671892#msg2671892

Contributor guide

Open the contributing guide

Research direction

Locate the platform-specific analog reference declarations and usages, starting with the Zero example shown in the issue. Compare all supported reference choices and verify that the declarations use compile-time-testable constants and that affected platform code still compiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.