- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
readVal = Cy_GPIO_Read(P12_0_PORT, P12_2_PIN);
readVal = Cy_GPIO_Read((GPIO_PRT_Type *)base , pin);
The MCU I use is CY8c6136.
I am using Cy_GPIO_Read().
- readVal = Cy_GPIO_Read(P12_0_PORT, P12_2_PIN);
I can do this when I know the port information of the corresponding pin.
If I do not know the port information of the pin, I am wondering how to enter the port information.
Port mapping is done in modus_toolbox,
This problem occurred while porting from another MCU.
May I get some information about this?
thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
air,
Using "Device Configurator" you select and assign a pin name. (See example below.)
This pin name can be used as a port and pin name substitute (Alias) using the Cy_GPIO_xxxx() function calls. In the case above for P13[7] there are three Aliases.
As an example, you would then use this Alias as a means to reference the pin. (See code example below.)
readVal = Cy_GPIO_Read(CYBSP_USER_LED_PORT_NUM, CYBSP_USER_LED_PIN_NUM);
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
air,
Using "Device Configurator" you select and assign a pin name. (See example below.)
This pin name can be used as a port and pin name substitute (Alias) using the Cy_GPIO_xxxx() function calls. In the case above for P13[7] there are three Aliases.
As an example, you would then use this Alias as a means to reference the pin. (See code example below.)
readVal = Cy_GPIO_Read(CYBSP_USER_LED_PORT_NUM, CYBSP_USER_LED_PIN_NUM);
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What I wanted to know is how to know the port name by pin name.
For example, using CYHAL_GET_PORT
or __STATIC_INLINE GPIO_PRT_Type* Cy_GPIO_PortToAddr(uint32_t portNum);
Is the expression below correct?
static uint8_t in_gpio_read(void *port, uint32_t pin)
{
return (uint8_t)(Cy_GPIO_Read(Cy_GPIO_PortToAddr(pin), pin));
}
thanks.