Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
66047f8
[variant] Group each variant per STM32 series
fpistm Jun 5, 2020
c64a09c
[PIO] Fix variants path changes
fpistm Jul 10, 2020
7011b58
[ThunderPack] Split variant per series
fpistm Jul 16, 2020
99c49a2
Rename PinMap_PWM to PinMap_TIM
fpistm Dec 6, 2020
7469071
Extend Arduino pin naming to the max possibilities
fpistm Dec 5, 2020
4afab84
Clean up old way to define Ax pins definition
fpistm Dec 5, 2020
0a7489d
Introduce all alternative pins per peripheral
fpistm Aug 24, 2020
ff7f85e
Rework analog pin management
fpistm Jan 29, 2021
ac2d9cc
Change Ax constants to an enum
fpistm Jan 25, 2021
0898a85
Remap pin management
fpistm Dec 8, 2020
71108a3
Add Alternate pins (ALTx) management
fpistm Jan 8, 2021
0cafa3c
Definition and comments improvements for pins management
fpistm Jan 25, 2021
da7ef68
Move genpinmap from Arduino_Tools repository
fpistm Feb 19, 2021
e4edbf4
[stm32variant] Update to generate in the core
fpistm Feb 19, 2021
49a09e9
[stm32variant] Use Mcu description
fpistm Feb 19, 2021
4fae0c7
[stm32variant] Add board_entry.txt
fpistm Feb 19, 2021
8ff95b8
[stm32variant] Add option to generate only one family
fpistm Feb 22, 2021
e6ac2bd
[stm32variant] Aggregate generated variant if they are the same
fpistm Mar 1, 2021
66d6408
[stm32variant] Add generic_clock.c generation
fpistm Feb 24, 2021
4fbc7c7
[stm32variant] Comment option to generate from one mcu file
fpistm Mar 8, 2021
677c076
Allow use of a custom peripheral pins file
fpistm Feb 24, 2021
abf08af
[CI] arduino-builder is replaced by arduino-cli
fpistm Mar 9, 2021
d046589
[stm32variant] Change generic variant generation
fpistm Mar 10, 2021
d2674fd
[stm32variant] Fix USB mode when AF is not none
fpistm Mar 27, 2021
cfd7cff
[stm32variant] Rework dirname aggregation
fpistm Mar 30, 2021
0b4c5f7
[stm32variant] Fix ALTx issue with remapped pins
fpistm Apr 8, 2021
b4cdfc8
[stm32variant] Fix AFIO definition for F1
fpistm Apr 8, 2021
8366f41
[stm32variant] Add a README.md
fpistm Apr 15, 2021
20e6e72
[stm32variant] Rename ND by PNUM_NOT_DEFINED
fpistm Apr 15, 2021
b5662d7
Add all generated STM32F0xx generic variant files
fpistm Apr 7, 2021
6b2b23d
Add all generated STM32F1xx generic variant files
fpistm Apr 7, 2021
b78ebe7
Add all generated STM32F2xx generic variant files
fpistm Apr 7, 2021
e0cfa88
Add all generated STM32F3xx generic variant files
fpistm Apr 7, 2021
046afd7
Add all generated STM32F4xx generic variant files
fpistm Apr 7, 2021
0b3dac6
Add all generated STM32F7xx generic variant files
fpistm Apr 7, 2021
4d23012
Add all generated STM32G0xx generic variant files
fpistm Apr 7, 2021
ec30479
Add all generated STM32G4xx generic variant files
fpistm Apr 7, 2021
2f7d688
Add all generated STM32H7xx generic variant files
fpistm Apr 7, 2021
e0157b7
Add all generated STM32L0xx generic variant files
fpistm Apr 7, 2021
b9e45d1
Add all generated STM32L1xx generic variant files
fpistm Apr 7, 2021
f1685bd
Add all generated STM32L4xx generic variant files
fpistm Apr 7, 2021
b04d918
Add all generated STM32L5xx generic variant files
fpistm Apr 7, 2021
7c2fddd
Add all generated STM32MP1xx generic variant files
fpistm Apr 7, 2021
f3f7c43
Add all generated STM32WBxx generic variant files
fpistm Apr 7, 2021
d71f287
Add all generated STM32WLxx generic variant files
fpistm Apr 7, 2021
7a95366
Update variant header management
fpistm Mar 11, 2021
d61905e
[variant] Add Generic L4xx
fpistm Apr 6, 2021
24c724a
[variant] Add Generic G4xx
ABOSTM Apr 7, 2021
55c761f
[variant] Add support of board B-G431B-ESC1
owennewo Mar 23, 2021
606b131
[variant] Add Generic G0xx
fpistm Apr 7, 2021
2a78e9d
Add Aurora One Variant
jhleekr Sep 15, 2020
cfd0b17
Add Nucleo G031K8 and generic G031Kx
fpistm Mar 15, 2021
503f79e
[variant] Update Generic F0xx
fpistm Jan 22, 2021
9234b65
Add Generic F042Cx
seeers Mar 10, 2021
6a45026
Added NUCLEO_F070RB
gbmhunter Sep 10, 2020
51b7236
[variant] Update Generic MP1xx
fpistm Jan 27, 2021
db9b6ed
[variant] Add Generic F2xx
fpistm Mar 14, 2021
b20c5ed
[variant] Add Generic L5xx and Nucleo L552ZE-Q
fpistm Mar 14, 2021
1920959
[variant] Add Generic WBxx
fpistm Mar 14, 2021
5bd495f
[variant] Add Generic L1xx
fpistm Mar 15, 2021
4f033ba
[variant] Update Generic H7xx
fpistm Mar 15, 2021
f79a926
Added Generic H743Vx
vladkozlov69 Sep 25, 2020
30ddea4
Enable HAL MDMA by default
fpistm Mar 16, 2021
7a3a084
[variant] Add Generic F7xx
ABOSTM Mar 16, 2021
d3438df
[variant] Add Generic L0xx
ABOSTM Mar 18, 2021
2315591
Add Generic L010RB
mkals Mar 23, 2021
87bb2ed
[variant] Add Generic F3xx
ABOSTM Mar 23, 2021
f4d5b62
[Variant] Add DISCO F303VC
dnandha Mar 25, 2021
0bc6d02
[Variant] Add OLIMEXINO-STM32F3
Stanimir-Petev Mar 25, 2021
51e9a15
[variant] Add Generic F4xx
ABOSTM Mar 26, 2021
0496974
BlackPill F401CC: add USER_BTN on PA0
ABOSTM Apr 2, 2021
9207aaa
[variant] Add STM32F407ZGT6 Mini and Generic_F407Zx
dds90 Apr 2, 2021
7582527
BLACK_F407ZX: invert PF9 and PF10 in digitalPin[]
ABOSTM Apr 6, 2021
f17e7be
[variant] Add Generic F1xx
ABOSTM Apr 9, 2021
6a94738
[variant] Add Generic F100Cx
mcer12 Apr 13, 2021
cbbb14c
[PIO]Fix variant header and path changes
fpistm Mar 12, 2021
1e38015
[CI] Update configuration to build only one generic per variant
fpistm Mar 16, 2021
ba52cf2
[variant] Remove board_template
fpistm Apr 15, 2021
088209c
Group system IP clock enable in separate function called at init
ABOSTM Apr 16, 2021
f8ddc9c
Manage dualpad analog switch
ABOSTM Apr 16, 2021
7ec57a1
[CI] Update core configuration
fpistm Apr 15, 2021
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
Prev Previous commit
Next Next commit
Definition and comments improvements for pins management
Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed Apr 2, 2021
commit 0cafa3c73012009a904d8f1036e65c4c1ac0526f
6 changes: 3 additions & 3 deletions cores/arduino/pins_arduino.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ bool digitalpinIsAnalogInput(uint32_t pin)
{
bool ret = false;
#if NUM_ANALOG_INPUTS > 0
if ((pin & PANA) == PANA) {
if ((pin & PNUM_ANALOG_BASE) == PNUM_ANALOG_BASE) {
ret = true;
} else {
for (uint32_t i = 0; i < NUM_ANALOG_INPUTS; i++) {
Expand All @@ -100,9 +100,9 @@ uint32_t digitalPinToAnalogInput(uint32_t pin)
{
uint32_t ret = NUM_ANALOG_INPUTS;
#if NUM_ANALOG_INPUTS > 0
if ((pin & PANA) == PANA) {
if ((pin & PNUM_ANALOG_BASE) == PNUM_ANALOG_BASE) {
/* PYn = Ax */
ret = (pin & PANA_IDX) | (pin & ALTX_MASK);
ret = (pin & PNUM_ANALOG_INDEX) | (pin & ALTX_MASK);
} else {
for (uint32_t i = 0; i < NUM_ANALOG_INPUTS; i++) {
if (analogInputPin[i] == (pin & PNUM_MASK)) {
Expand Down
18 changes: 12 additions & 6 deletions cores/arduino/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@
#include "pins_arduino_analog.h"
#include "pins_arduino_digital.h"

/* Pin number */
#define PNUM_MASK 0xFF
/*
* Pin number mask
* allows to retrieve the pin number without ALTx
*/
#define PNUM_MASK 0xFF

/* Pin not defined */
#define ND NUM_DIGITAL_PINS

/* Avoid PortName issue */
_Static_assert(LastPort <= 0x0F, "PortName must be less than 16");
Expand Down Expand Up @@ -90,9 +96,9 @@ extern const uint32_t analogInputPin[];
/* Note: Analog pin is also a digital pin */
#define digitalPinToPinName(p) ((((uint32_t)(p) & PNUM_MASK) < NUM_DIGITAL_PINS) ? \
(PinName)(digitalPin[(uint32_t)(p) & PNUM_MASK] | ((p) & ALTX_MASK)) : \
(((uint32_t)(p) & PANA) == PANA) && \
(((uint32_t)(p) & PNUM_ANALOG_BASE) == PNUM_ANALOG_BASE) && \
(((uint32_t)(p) & PNUM_MASK) < NUM_ANALOG_INTERNAL_FIRST) ? \
(PinName)(digitalPin[analogInputPin[(p) & PANA_IDX]] | ((p) & ALTX_MASK)) : NC)
(PinName)(digitalPin[analogInputPin[(p) & PNUM_ANALOG_INDEX]] | ((p) & ALTX_MASK)) : NC)
#else
#define digitalPinToPinName(p) ((((uint32_t)(p) & PNUM_MASK) < NUM_DIGITAL_PINS) ? \
(PinName)(digitalPin[(uint32_t)(p) & PNUM_MASK] | ((p) & ALTX_MASK)) : NC)
Expand All @@ -106,9 +112,9 @@ uint32_t pinNametoDigitalPin(PinName p);
/* Non contiguous analog pins definition in digitalPin array */
#define analogInputToDigitalPin(p) ((((uint32_t)(p) & PNUM_MASK) < NUM_ANALOG_INPUTS) ? \
analogInputPin[(uint32_t)(p) & PNUM_MASK] | ((uint32_t)(p) & ALTX_MASK) : \
(((uint32_t)(p) & PANA) == PANA) && \
(((uint32_t)(p) & PNUM_ANALOG_BASE) == PNUM_ANALOG_BASE) && \
(((uint32_t)(p) & PNUM_MASK) < NUM_ANALOG_INTERNAL_FIRST) ? \
analogInputPin[(p) & PANA_IDX] | ((uint32_t)(p) & ALTX_MASK) : (uint32_t)NC)
analogInputPin[(p) & PNUM_ANALOG_INDEX] | ((uint32_t)(p) & ALTX_MASK) : (uint32_t)NC)
#else/* No analog pin defined */
#define analogInputToDigitalPin(p) (NUM_DIGITAL_PINS)
#endif /* NUM_ANALOG_INPUTS > 0 */
Expand Down
23 changes: 17 additions & 6 deletions cores/arduino/pins_arduino_analog.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,29 @@
#include "variant.h"
#include "PinNames.h"

/* Analog */
#define PANA 0xC0
/* Analog index */
#define PANA_IDX 0x3F
/*
* Pin number Analog base
* To check if a pin number is an analog pin:
* ((p & PNUM_ANALOG_BASE) == PNUM_ANALOG_BASE)
* if true then p is an analog pin number
* else not
*/
#define PNUM_ANALOG_BASE 0xC0
/*
* Pin number Analog index
* allows to retrieve the pin number index of an analog pin
* in the analogInputPin[] array:
* analogInputPin[p & PNUM_ANALOG_INDEX]
*/
#define PNUM_ANALOG_INDEX 0x3F

/* Arduino analog pins */
#ifndef NUM_ANALOG_INPUTS
#define NUM_ANALOG_INPUTS 0
#endif

/* Analog internal pin numbers follow the analog pin number */
#define NUM_ANALOG_INTERNAL_FIRST (PANA + NUM_ANALOG_INPUTS)
#define NUM_ANALOG_INTERNAL_FIRST (PNUM_ANALOG_BASE + NUM_ANALOG_INPUTS)

/* ADC internal channels (not a pins) */
/* Only used for analogRead() */
Expand All @@ -46,7 +57,7 @@
/* If NUM_ANALOG_INPUTS is not defined there is no analog pins defined. */
/* Anyway ADC internal channels are always available. */
#if NUM_ANALOG_INPUTS > 0
#define PIN_A0 PANA
#define PIN_A0 PNUM_ANALOG_BASE
#if NUM_ANALOG_INPUTS > 1
#define PIN_A1 (PIN_A0 + 1)
#endif
Expand Down
28 changes: 14 additions & 14 deletions cores/arduino/stm32/PinNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ extern "C" {
#endif

// Alternative possibilities which use other HW peripheral instances
#define ALT0 0x000
#define ALT1 0x100
#define ALT2 0x200
#define ALT3 0x300
#define ALT4 0x400
#define ALT5 0x500
#define ALT6 0x600
#define ALT7 0x700
#define ALT0 0x000
#define ALT1 0x100
#define ALT2 0x200
#define ALT3 0x300
#define ALT4 0x400
#define ALT5 0x500
#define ALT6 0x600
#define ALT7 0x700
// ALTX mask
#define ALTX_MASK 0x700
#define ALTX_MASK 0x700

// Specific pinmap definition
// Analog internal
#define PANAINT 0x1000
#define PNAME_ANALOG_INTERNAL_BASE 0x1000
// Dual pad pin
// Direct channels are connected to analog I/Os
// (PY_C) to optimize ADC performance.
#define PDUAL 0x2000
#define PDUAL 0x2000
// Remap pin
#define PREMAP 0x3000
#define PREMAP 0x3000
// PinName mask
#define PNAME_MASK 0xFF
#define PNAME_MASK 0xFF

typedef enum {
// Not connected
Expand Down Expand Up @@ -251,7 +251,7 @@ typedef enum {
PZ_15 = (PortZ << 4) + 0x0F,
#endif
// Specific pin name
PADC_BASE = PANAINT,
PADC_BASE = PNAME_ANALOG_INTERNAL_BASE,
#if defined(ADC_CHANNEL_TEMPSENSOR) || defined(ADC_CHANNEL_TEMPSENSOR_ADC1)
PADC_TEMP,
#endif
Expand Down
8 changes: 6 additions & 2 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,12 @@ ALT5 LITERAL1
ALT6 LITERAL1
ALT7 LITERAL1
ATLX_MASK LITERAL1
PANA LITERAL1
PANAINT LITERAL1
ND LITERAL1
PNUM_MASK LITERAL1
PNUM_ANALOG_BASE LITERAL1
PNUM_ANALOG_INDEX LITERAL1
PNAME_MASK LITERAL1
PNAME_ANALOG_INTERNAL_BASE LITERAL1
PDUAL LITERAL1
PREMAP LITERAL1

Expand Down