Skip to content

PR #206 review #1

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions cores/arduino/pins_arduino_var.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@
// 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!");

#ifdef __cplusplus
extern "C" {
#endif

#define NOT_AN_INTERRUPT NC // -1
#define DEND NUM_DIGITAL_PINS

#ifdef __cplusplus
static_assert(NUM_DIGITAL_PINS==((uint32_t)PEND));
static_assert(NUM_ANALOG_INPUTS==((uint32_t)(AEND-A0)));
#endif

// Convert a digital pin number Dxx to a PinName PX_n
// Note: Analog pin is also a digital pin.
#define digitalPinToPinName(p) (((uint32_t)p < NUM_DIGITAL_PINS) ? digitalPin[p] : NC)
Expand Down
6 changes: 3 additions & 3 deletions variants/DISCO_F100RB/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ enum {
PB1_2,//D62/A15 = D15
PEND
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 63
#define NUM_DIGITAL_PINS 63

enum {
A_START_AFTER = D46,
Expand All @@ -116,7 +116,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 16
#define NUM_ANALOG_INPUTS 16

// On-board LED pin number
#define LED_BUILTIN PC9
Expand Down
4 changes: 2 additions & 2 deletions variants/DISCO_F407VG/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 87
#define NUM_DIGITAL_PINS 87

enum {
A_START_AFTER = D78,
Expand All @@ -141,7 +141,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 8
#define NUM_ANALOG_INPUTS 8

// On-board LED pin number
#define LED_BUILTIN PD12
Expand Down
4 changes: 2 additions & 2 deletions variants/DISCO_F746NG/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 25
#define NUM_DIGITAL_PINS 25

enum {
A_START_AFTER = D15,
Expand All @@ -73,7 +73,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 6
#define NUM_ANALOG_INPUTS 6

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/DISCO_L072CZ_LRWAN1/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 33
#define NUM_DIGITAL_PINS 33

enum {
A_START_AFTER = D25,
Expand All @@ -83,7 +83,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 7
#define NUM_ANALOG_INPUTS 7

// On-board LED pin number
#define LED_BUILTIN PA5
Expand Down
4 changes: 2 additions & 2 deletions variants/DISCO_L475VG_IOT/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 85
#define NUM_DIGITAL_PINS 85

enum {
A_START_AFTER = D68,
Expand All @@ -143,7 +143,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 16
#define NUM_ANALOG_INPUTS 16

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_F030R8/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 61
#define NUM_DIGITAL_PINS 61

enum {
A_START_AFTER = D48,
Expand All @@ -116,7 +116,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 12
#define NUM_ANALOG_INPUTS 12

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_F091RC/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 58
#define NUM_DIGITAL_PINS 58

enum {
A_START_AFTER = D45,
Expand All @@ -113,7 +113,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 12
#define NUM_ANALOG_INPUTS 12

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_F103RB/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 60
#define NUM_DIGITAL_PINS 60

enum {
A_START_AFTER = D45,
Expand All @@ -115,7 +115,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 14
#define NUM_ANALOG_INPUTS 14

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_F207ZG/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 96
#define NUM_DIGITAL_PINS 96

// Enum defining Arduino style alias for analog pin number --> Ax
enum {
Expand All @@ -160,7 +160,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 18
#define NUM_ANALOG_INPUTS 18

// On-board LED pin number
#define LED_BUILTIN PB0
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_F302R8/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 58
#define NUM_DIGITAL_PINS 58

enum {
A_START_AFTER = D45,
Expand All @@ -113,7 +113,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 12
#define NUM_ANALOG_INPUTS 12

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_F303K8/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 23
#define NUM_DIGITAL_PINS 23

enum {
A_START_AFTER = D13,
Expand All @@ -71,7 +71,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 7
#define NUM_ANALOG_INPUTS 7

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_F303RE/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 60
#define NUM_DIGITAL_PINS 60

enum {
A_START_AFTER = D45,
Expand All @@ -115,7 +115,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 14
#define NUM_ANALOG_INPUTS 14

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_F401RE/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 59
#define NUM_DIGITAL_PINS 59

enum {
A_START_AFTER = D45,
Expand All @@ -114,7 +114,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 13
#define NUM_ANALOG_INPUTS 13

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_F411RE/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 59
#define NUM_DIGITAL_PINS 59

enum {
A_START_AFTER = D45,
Expand All @@ -114,7 +114,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 13
#define NUM_ANALOG_INPUTS 13

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_F429ZI/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 96
#define NUM_DIGITAL_PINS 96

enum {
A_START_AFTER = D77,
Expand All @@ -146,7 +146,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 18
#define NUM_ANALOG_INPUTS 18

// On-board LED pin number
#define LED_BUILTIN PB0
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_F446RE/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 60
#define NUM_DIGITAL_PINS 60

enum {
A_START_AFTER = D45,
Expand All @@ -115,7 +115,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 14
#define NUM_ANALOG_INPUTS 14

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_L031K6/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 23
#define NUM_DIGITAL_PINS 23

enum {
A_START_AFTER = D13,
Expand All @@ -83,7 +83,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 7
#define NUM_ANALOG_INPUTS 7

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_L053R8/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 58
#define NUM_DIGITAL_PINS 58

enum {
A_START_AFTER = D45,
Expand All @@ -113,7 +113,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 12
#define NUM_ANALOG_INPUTS 12

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_L152RE/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 63
#define NUM_DIGITAL_PINS 63

enum {
A_START_AFTER = D45,
Expand All @@ -118,7 +118,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 17
#define NUM_ANALOG_INPUTS 17


// On-board LED pin number
Expand Down
4 changes: 2 additions & 2 deletions variants/NUCLEO_L432KC/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ enum {
};

// This must be a literal with the same value as PEND
#define NUM_DIGITAL_PINS 23
#define NUM_DIGITAL_PINS 23

enum {
A_START_AFTER = D13,
Expand All @@ -71,7 +71,7 @@ enum {
};

// This must be a literal with the same value as AEND-A0
#define NUM_ANALOG_INPUTS 7
#define NUM_ANALOG_INPUTS 7

// On-board LED pin number
#define LED_BUILTIN 13
Expand Down
Loading