arduino / arduino/ArduinoCore-samd

What is the purpose of PINCOUNT_fn

Open
#531 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

In commit a536cc8 the function `PINCOUNT_fn` was introduced with a very limited commit description "make PINS_COUNT dynamic". Forgive my ignorance, but I don't see anything dynamic in the implementation.

```
extern "C" {
unsigned int PINCOUNT_fn() {
return (sizeof(g_APinDescription) / sizeof(g_APinDescription[0]));
}
}
```

Why is it necessary to repeat the implementation for every variant? Why not put it in `wiring_private.c` or something?

And look at the modifications in all the `variants.h`. The function is declared twice? In commit 92efd745 a second declaraion was added. Why?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading commit a536cc8 and commit 92efd745, then inspect PINCOUNT_fn in each variant and its declarations in the variants.h files. Compare those implementations with wiring_private.c to determine why the function is repeated and declared twice. Done means documenting the intended purpose and deciding whether the duplication or declarations should change.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.