Config Tools Pin Label and Identifier

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Config Tools Pin Label and Identifier

跳至解决方案
2,235 次查看
aberger
Contributor V

What is the use case for the pin Label and Identifier in the Config Tools Pins table?

1 解答
1,992 次查看
liborukropec
NXP Employee
NXP Employee

If the pins is given label, the benefit is that it can be used e.g. in filters:

pastedImage_1.png

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

在原帖中查看解决方案

3 回复数
1,992 次查看
liborukropec
NXP Employee
NXP Employee

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

1,992 次查看
aberger
Contributor V

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?

0 项奖励
回复
1,993 次查看
liborukropec
NXP Employee
NXP Employee

If the pins is given label, the benefit is that it can be used e.g. in filters:

pastedImage_1.png

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