What is the use case for the pin Label and Identifier in the Config Tools Pins table?
解決済! 解決策の投稿を見る。
If the pins is given label, the benefit is that it can be used e.g. in filters:
Identifiers are used for defines in pin_mux.c so in case there is need to access particular pin, you can use this custom identifier (in menu Edit | Configuration preferences enable "Generate extended information into header file")
/*! @name ADC0_DP1 (number 14), MY_BUTTON
@{ */
#define BOARD_MY_BUTTON_PERIPHERAL ADC0 /*!<@brief Device name: ADC0 */
#define BOARD_MY_BUTTON_SIGNAL SE /*!<@brief ADC0 signal: SE */
#define BOARD_MY_BUTTON_CHANNEL 1 /*!<@brief ADC0 SE channel: 1 */
#define BOARD_MY_BUTTON_PIN_NAME ADC0_DP1 /*!<@brief Pin name */
#define BOARD_MY_BUTTON_LABEL "MY_BUTTON" /*!<@brief Label */
#define BOARD_MY_BUTTON_NAME "MY_BUTTON" /*!<@brief Identifier name */
/* @} */
This can have big benefit if the same application should work on more boards/processors (where the pin can have different name and thus different define) so it is not necessary to change the main application, because you can use constant that is independent on given HW.
It also does the code more readable.
Regards,
Libor
Hello Andy,
see pdf user manual, chapter "3.4.6 Labels and identifiers", here shortly copy pasted:
Labels:
You can define the label of any pin that can be displayed in user interface for ease of identification.
Boards and kits have pre-defined labels. However, it's also possible to define a pin label listed in the Pins and Routed Pins views.
To set\update the Labels and Identifier columns visibility, select Edit > Preferences.
Identifiers:
The pin identifier is used to generate the #define in the pin_mux.h file. However, it's an optional parameter. If the parameter is not defined, the code for #define is not generated. Additionally, you can define multiple identifiers, using the “;” character as a separator. You can also set the identifier by typing it directly into the cell in the Identifier column in the Pins and Routed Pins views.
Regards,
Libor
I did see this section of the Config Tools user manual. But this does not explain how the label and identifier are used in practice. Any examples?
If the pins is given label, the benefit is that it can be used e.g. in filters:
Identifiers are used for defines in pin_mux.c so in case there is need to access particular pin, you can use this custom identifier (in menu Edit | Configuration preferences enable "Generate extended information into header file")
/*! @name ADC0_DP1 (number 14), MY_BUTTON
@{ */
#define BOARD_MY_BUTTON_PERIPHERAL ADC0 /*!<@brief Device name: ADC0 */
#define BOARD_MY_BUTTON_SIGNAL SE /*!<@brief ADC0 signal: SE */
#define BOARD_MY_BUTTON_CHANNEL 1 /*!<@brief ADC0 SE channel: 1 */
#define BOARD_MY_BUTTON_PIN_NAME ADC0_DP1 /*!<@brief Pin name */
#define BOARD_MY_BUTTON_LABEL "MY_BUTTON" /*!<@brief Label */
#define BOARD_MY_BUTTON_NAME "MY_BUTTON" /*!<@brief Identifier name */
/* @} */
This can have big benefit if the same application should work on more boards/processors (where the pin can have different name and thus different define) so it is not necessary to change the main application, because you can use constant that is independent on given HW.
It also does the code more readable.
Regards,
Libor