Same as the previous one but this time we handle two leds and use the gpio_port_toggle_bits to toggle up to two leds at the same time

/* Include libraries */
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>

/*define pin access for port toggle function*/
#define LED0_PIN  (1 << 9)
#define LED1_PIN  (1 << 7)

/* get the node identifier from its label, in this case will be gpio@50400 for port 2 */
#define GPIO2_NODE DT_NODELABEL( gpio2 )

int main( void )
{
    /* Get the device descriptor for port 2 */
    const struct device *gpio2 = DEVICE_DT_GET( GPIO2_NODE );
    
    /* Configure pin 7 and 9 as output */
    gpio_pin_configure( gpio, 7, GPIO_OUTPUT);
    gpio_pin_configure( gpio, 9, GPIO_OUTPUT);
    
    while(1)
    {
        /* Toggle pin 7 and 9 from port 2 using a port function */
        gpio_pin_toggle( gpio, (LED0_PIN | LED1_PIN) );
        /* 500ms Delay */
        k_msleep( 500 );
    }
    return 0;
}

prj.conf

# Disable optimizations
CONFIG_NO_OPTIMIZATIONS=y
# Include GPIO driver in system config ( Kconfig )
CONFIG_GPIO=y