10-02-2017, 11:32 AM
(This post was last modified: 10-02-2017, 11:40 AM by MarkHaysHarris777.)
hi Artyom,
To put it in a positive way, its not so much an inconvenience ( hard-coded ) ( rigid mapping ) as it is not quite so flexible. In other words, if you account for the three possible ways of specifying pin schemes ( from the user perspective ) the system tool becomes 'more' convenient because it is 'more' flexible. For instance:
#define 32 PHYS_PI2-BUS
#define 33 PHYS_PI5-BUS
#define 34 PADS
#define 35 GPIONUM
int pinNumberingScheme(int pin_scheme);
ie; pinNumberingScheme(PHYS_PI5-BUS);
...
This function is not necessary: int gpio_calculate_pin_number (int pin_number)
... because the pinNumberingScheme() function takes care of it. From here on the user only needs to specify the pin as the physical pin number, an int, which is in fact the actual physical number of the pin.
On the other hand consider please:
ie; pinNumberingScheme(PADS);
... from here on the user need only specify the pad nam|num 2_C7 (as an example) rather than PiP5+ pin 5.
or please consider:
ie; pinNumberingScheme(GPIONUM);
... from here on the user need only specify the pin number as the converted GPIO## based on the calculation from pad nam|num to GPIO##. ( name2gpio.sh ) (from the datasheet, and the User Manual).
Being able to specify a pinNumberingScheme() from a user perspective allows for more flexible code, because the user does not need to do any mapping, converting, nor calculating... because the tool does all of that for the user; BUT, the user has the flexibility of specifying the number scheme that 'they' are comfortable with. As I said before sometimes it might be convenient to specify actual physical pin numbers, and sometimes it might be nice to just plug in the pad nam|num instead !
edit: PS... keep in mind that there are two buses on the Rock64, as well the PineA64+, which means that physical pins pertain to either one of two buses! While, the pad nam|num is regardless of the bus ! In other words, the PADS configuration takes into account which bus we are talking about as well as pin number.
To put it in a positive way, its not so much an inconvenience ( hard-coded ) ( rigid mapping ) as it is not quite so flexible. In other words, if you account for the three possible ways of specifying pin schemes ( from the user perspective ) the system tool becomes 'more' convenient because it is 'more' flexible. For instance:
#define 32 PHYS_PI2-BUS
#define 33 PHYS_PI5-BUS
#define 34 PADS
#define 35 GPIONUM
int pinNumberingScheme(int pin_scheme);
ie; pinNumberingScheme(PHYS_PI5-BUS);
...
This function is not necessary: int gpio_calculate_pin_number (int pin_number)
... because the pinNumberingScheme() function takes care of it. From here on the user only needs to specify the pin as the physical pin number, an int, which is in fact the actual physical number of the pin.
On the other hand consider please:
ie; pinNumberingScheme(PADS);
... from here on the user need only specify the pad nam|num 2_C7 (as an example) rather than PiP5+ pin 5.
or please consider:
ie; pinNumberingScheme(GPIONUM);
... from here on the user need only specify the pin number as the converted GPIO## based on the calculation from pad nam|num to GPIO##. ( name2gpio.sh ) (from the datasheet, and the User Manual).
Being able to specify a pinNumberingScheme() from a user perspective allows for more flexible code, because the user does not need to do any mapping, converting, nor calculating... because the tool does all of that for the user; BUT, the user has the flexibility of specifying the number scheme that 'they' are comfortable with. As I said before sometimes it might be convenient to specify actual physical pin numbers, and sometimes it might be nice to just plug in the pad nam|num instead !
edit: PS... keep in mind that there are two buses on the Rock64, as well the PineA64+, which means that physical pins pertain to either one of two buses! While, the pad nam|num is regardless of the bus ! In other words, the PADS configuration takes into account which bus we are talking about as well as pin number.
marcushh777
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )