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

Analog pins definition #37

Closed
fpistm opened this issue Jun 23, 2017 · 1 comment
Closed

Analog pins definition #37

fpistm opened this issue Jun 23, 2017 · 1 comment
Assignees
Labels
enhancement New feature or request help wanted 🙏 Extra attention is needed question ❓ Usually converted as a discussion

Comments

@fpistm
Copy link
Member

fpistm commented Jun 23, 2017

Hi all,
I would like to open a discussion around the analog pins definition Ax
Currently, we mainly defined A0 to A5 but STM2 MCU provide more than 6 ADC.
And in PinMap_ADC we make available more than A0-A5.
So, constant NUM_ANALOG_INPUTS is not aligned.

Questions are:
Is it required to define more than A0 to A5 by default ?
If not then, only comment the other pins in PinMap_ADC.
If yes, extend the Ax to the same number of pins defined in PinMap_ADC. This will imply to duplicate some pin definitions in digital_arduino array or reordering it.

Furthermore, after discussion with Arduino developper, the AnalogRead(A0) == AnalogRead(0) should be the same while AnalogWrite(0) == AnalogWrite(D0).

For constant value, it should be changed to not use sizeof to avoid issue:

#define NUM_ANALOG_INPUTS       (AEND - A0)

Any feedback are welcome here on in the stm32duino forum dedicated topics

Note: I took as example the Nucleo F429ZI but it is valid far all variant.

@fpistm fpistm added help wanted 🙏 Extra attention is needed question ❓ Usually converted as a discussion labels Jun 23, 2017
@fpistm fpistm added the enhancement New feature or request label Jun 25, 2017
fpistm added a commit that referenced this issue Jun 26, 2017
analogRead(A0) == analogRead(0)
analogWrite(A0) != analogWrite(0) == analogWrite(D0)
All pins available in PinMap_ADC are available with Ax alias
Fix #37

Move pin functions to pins_arduino.c to avoid duplicated code.
Pin functions naming alignement.

Move init() function to pins_arduino.c to avoid duplicated code
and define it as weak.

Minor clean of unused code.
Remove usb flags for variants w/o usb.
Serialx under switch.Disable by default

Now, variant files only contain source which differ for each variants.

Signed-off-by: Frederic Pillon <[email protected]>
@fpistm fpistm self-assigned this Jun 26, 2017
@fpistm
Copy link
Member Author

fpistm commented Jun 26, 2017

AnalogRead(A0) == AnalogRead(0)
AnalogWrite(A0) != AnalogWrite(0) == AnalogWrite(D0)
All pins available in PinMap_ADC are available with Ax alias
So NUM_ANALOG_INPUTS is aligned with PinMap_ADC.

Iterate starting from 0 on analogRead(i) is now functionnal (as expected in several sketches/libraries)

fpistm added a commit that referenced this issue Jun 26, 2017
analogRead(A0) == analogRead(0)
analogWrite(A0) != analogWrite(0) == analogWrite(D0)
All pins available in PinMap_ADC are available with Ax alias
Fix #37

Move pin functions to pins_arduino.c to avoid duplicated code.
Pin functions naming alignement.

Move init() function to pins_arduino.c to avoid duplicated code
and define it as weak.

Minor clean of unused code.
Remove usb flags for variants w/o usb.
Serialx under switch.Disable by default

Now, variant files only contain source which differ for each variants.

Signed-off-by: Frederic Pillon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted 🙏 Extra attention is needed question ❓ Usually converted as a discussion
Projects
None yet
Development

No branches or pull requests

1 participant