-
Notifications
You must be signed in to change notification settings - Fork 1k
Analog pins definition clean up #800
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
Conversation
Looks good to me! |
df1ac73
to
5103588
Compare
7d07dce
to
7451cb8
Compare
@MCUdude |
Sorry, I've been on a business trip for a while, but I'm back home tonight. I'll get into it in a day or two |
7451cb8
to
2acfa13
Compare
2acfa13
to
27c126a
Compare
@MCUdude |
Just had a quick look at the code. So this means that if |
No it works for all |
I'm trying to wrap my head around how this works, but I'm struggling. Would you like to give a short explanation of how it's able to determine the difference between: analogRead(4); // Digital pin 4
analogRead(4); // Analog channel 4
analogRead(A4); // Analog pin 4 And I'll assume that the analog pins aren't reserved for analog use only? |
|
Using |
OK, so analogRead will necessarily not support Arduino digital pin numbers (since it may/will conflict with analog channel numbers), but rather analog channel number (0..15), analog pin number (A0..A15) and PYx. Here's the 16 first pins of the generic F401Rx pinout. Is this the correct way of defining them? // | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL |
// |---------|--------|-----------|----------|------------------------|-----------|
#define PA0 A0 // | 0 | A0 | | | | |
#define PA1 A1 // | 1 | A1 | | | | |
#define PA2 A2 // | 2 | A2 | USART2_TX | | | |
#define PA3 A3 // | 3 | A3 | USART2_RX | | | |
#define PA4 A4 // | 4 | A4 | | | SPI1_SS, (SPI3_SS) | |
#define PA5 A5 // | 5 | A5 | | | SPI1_SCK | |
#define PA6 A6 // | 6 | A6 | | | SPI1_MISO | |
#define PA7 A7 // | 7 | A7 | | | SPI1_MOSI | |
#define PA8 8 // | 8 | | | TWI3_SCL | | |
#define PA9 9 // | 9 | | USART1_TX | | | |
#define PA10 10 // | 10 | | USART1_RX | | | |
#define PA11 11 // | 11 | | USART6_TX | | | |
#define PA12 12 // | 12 | | USART6_RX | | | |
#define PA13 13 // | 13 | | | | | SWD_SWDIO |
#define PA14 14 // | 14 | | | | | SWD_SWCLK |
#define PA15 15 // | 15 | | | | SPI1_SS, (SPI3_SS) | | With the following analogInPin table: // Analog (Ax) pin number array
const uint32_t analogInPin[] = {
0, // A0
1, // A1
2, // A2
3, // A3
4, // A4
5, // A5
6, // A6
7, // A7
16, // A8
17, // A9
31, // A10
32, // A11
33, // A12
34, // A13
35, // A14
36 // A15
} |
yes this is like this. |
Great! I'll push some changes to #784 to reflect these changes. BTW this PR looks good to me! |
1a97546
to
a692737
Compare
AEND was used by firmata and kept for backward compatibility with Firmata. It could be now safely removed as Firmata does not use it anymore. Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]> Co-Authored-By: MCUdude <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
b75e4c0
to
3c8e21d
Compare
Firmata compatibility: |
stm32duino#800 introduced a regression on analog pins Ax usage as CS pin. Signed-off-by: Frederic Pillon <[email protected]>
#800 introduced a regression on analog pins Ax usage as CS pin. Signed-off-by: Frederic Pillon <[email protected]>
This PR allows to define non contiguous analog pins.
Based on @MCUdude works.
After several investigations, it is not possible to provide a generic way to define non contiguous analog pins.This PR simply clean the analog pins definition
Finally, found a way to fit all requirements.