|
Hello Nazila,
Answer to your Qn. 2).
We have a total of 64 GPIOs in FX3, divided into two sets of 32 each. In structure, CyU3PIoMatrixConfig_t,
gpioSimpleEn[2] is an array of two 32 bit elements. gpioSimpleEn[0] represents the first (32) set of Gpios.
gpioSimpleEn[1] represents second (32) set of GPIOs.
Now in order to enable, GPIO 45:
GPIO 45 belongs to second set. Thus taking gpioSimpleEn[1]. In the second set it is 13 pin from the right.
[31,30,29,28,...................4,3,2,1,0 ] => first set of GPIOs represented by gpioSimpleEn[0].
[63,62,.................45,44,43,42,,41,40,39,38,37,36,35,34,33,32] => seconde set of GPIOs represnted by gpioSimpleEn[1].
So, as you can see, in order to enable 45th GPIO pin, you have to left shift 1 thirteen times.
Thus
io_cfg.gpioSimpleEn[1] = (1 << (45 - 32)); /* Enable GPIO 45 */
= (1 << 13);
Qn.1) Now regarding the difference between the GPIO definintion using IOConfig matrix (CyU3PDeviceConfigureIOMatrix API) and CyU3PDeviceGpioOverride API is clear from API guide. The CyU3PDeviceConfigureIOMatrix API checks for validity of the configuration, whereas the override API does not. Also IO matrix cannot be dynamically changed and needs to be invoked during the device initialization, in the main function itself. I will check further for any other notable difference between them, and will let you know if so.
|