Hello @smishra125,
Do you want to clear the port as a way of turning off the LED?
First of all, as an advice I would recommend you take a look at driver fsl_gpio.h and fsl_gpio.c. There you will find functions that work with GPIO. Even if you don't want to use the functions for your application, it is good to have a look and see what the function is doing. For example, you are using B: Byte pin registers for all port GPIO pins for Pin Write, that is good, but look the normal usage of it:
RaulRomero_0-1669746316497.png
[fsl_gpio.h]
Now take a look to what you are doing: gpio->B[1][LED_BLUE] = (1<<LED_BLUE);
Your code should be something like: gpio -> B[1][LED_BLUE]=1; or gpio -> B[1][LED_BLUE]=0; depending on the output you want to have at that moment.
Being that said, there are two ways that you could implement the Toggle on the LEDs, and do the RGB change:
RaulRomero_1-1669746316500.png
[fsl_gpio.h]
In this one, you may have to do a Pin Initialization (whether LED_RED starts ON and others OFF, for example). But the logic it is pretty simple, every time the line it is called: gpio->NOT[1][LED_RED]=(1<<LED_RED); the value of LED_RED would change between ON/OFF (or HIGH/LOW). Look the next example:
RaulRomero_2-1669746316502.png
[Example of NOT usage]
- Through B as Pin Write. In this one, you may change the output between 1 and 0. As follows:
gpio -> B[1][LED_BLUE]=1;
delay_ms(1000);
gpio -> B[1][LED_BLUE]=0;
Best regards, Raul.