Skip to content

Assigning literal values to NUM_DIGITAL_PINS and NUM_ANALOG_INPUTS #206

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

Merged

Conversation

lacklustrlabs
Copy link
Contributor

It turned out that I needed the fix of #140 for a pet project of mine.
So here are the changes I made.

I've compiled every board with this .ino:

#if NUM_DIGITAL_PINS > 4
#else
#error "NUM_DIGITAL_PINS not fixed"
#endif

#if NUM_ANALOG_INPUTS > 1
#else
#error "NUM_ANALOG_INPUTS not fixed"
#endif

void setup() {
}

void loop() {
} 

@fpistm fpistm self-assigned this Jan 23, 2018
@fpistm fpistm self-requested a review January 23, 2018 21:46
@fpistm fpistm added enhancement New feature or request arduino compatibility labels Jan 23, 2018
@fpistm fpistm added this to the Next release milestone Jan 23, 2018
@fpistm
Copy link
Member

fpistm commented Jan 23, 2018

Thanks @lacklustrlabs
First check seems ok. I need to review it more deeper😉
It is the first part of the #140 which require also Ax pins definition review

@lacklustrlabs
Copy link
Contributor Author

imho it would be easiest to add the first PIN_AX variant:

#if NUM_ANALOG_INPUTS > 0
#define PIN_A0 A0
#endif
#if NUM_ANALOG_INPUTS > 1
#define PIN_A1 A1
#endif
...
#if NUM_ANALOG_INPUTS > 18
#define PIN_A18 A18
#endif

I can do that, but the question is where do you want it?

@fpistm
Copy link
Member

fpistm commented Jan 24, 2018

Thanks @lacklustrlabs
I have to check that before doing any change for Ax definition. I would like check how other variant do it.
Anyway, I could merge your PR before doing that.
I have only to review code and made some tests. (firmata, ....)

fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this pull request Jan 26, 2018
Use _Static_assert instead of static_assert
Cosmetic change

Signed-off-by: Frederic Pillon <[email protected]>
lacklustrlabs pushed a commit to lacklustrlabs/Arduino_Core_STM32 that referenced this pull request Jan 26, 2018
Use _Static_assert instead of static_assert
Cosmetic change

Signed-off-by: Frederic Pillon <[email protected]>
@lacklustrlabs lacklustrlabs force-pushed the NUM_DIGITAL_PINS-and-NUM_ANALOG_INPUTS branch 2 times, most recently from 6e74479 to c784d36 Compare January 26, 2018 21:50
@@ -25,14 +25,16 @@
// Include board variant
#include "variant.h"

// Avoid pins number misalignment
_Static_assert(NUM_DIGITAL_PINS==PEND, "NUM_DIGITAL_PINS and PEND differ!");
_Static_assert(NUM_ANALOG_INPUTS==(AEND-A0), "NUM_DIGITAL_PINS and (AEND-A0) differ!");
Copy link
Member

Choose a reason for hiding this comment

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

Sorry made a wrong copy/paste
"NUM_DIGITAL_PINSNUM_ANALOG_INPUTS and (AEND-A0) differ!"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem :)

@lacklustrlabs lacklustrlabs force-pushed the NUM_DIGITAL_PINS-and-NUM_ANALOG_INPUTS branch from c784d36 to f697d25 Compare January 26, 2018 23:14
@fpistm fpistm merged commit 113f9e6 into stm32duino:master Jan 27, 2018
@lacklustrlabs lacklustrlabs deleted the NUM_DIGITAL_PINS-and-NUM_ANALOG_INPUTS branch January 27, 2018 10:41
@fpistm fpistm modified the milestones: Next release, 1.2.0 Mar 15, 2018
benwaffle pushed a commit to benwaffle/Arduino_Core_STM32 that referenced this pull request Apr 10, 2019
…-and-NUM_ANALOG_INPUTS

Assigning literal values to NUM_DIGITAL_PINS and NUM_ANALOG_INPUTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants