Renesas/RX65N/MiniWinTest/src/smc_gen/r_gpio_rx/src/r_gpio_rx.c
/***********************************************************************************************************************
* Function Name: gpio_set_output_type
* Description  : Configures pin output type (e.g. CMOS, open-drain)
* Arguments    : pin -
*                    Which pin to change output type for
*                out_type -
*                    What output type to use for this pin
* Return Value : None
***********************************************************************************************************************/
Function Name: gpio_set_output_type
Description  : Configures pin output type
Arguments    : pin
Which pin to change output type for
out_type
What output type to use for this pin
Return Value : None
Function Name : gpio_set_output_type Description : Configures pin output type Arguments : pin Which pin to change output type for out_type What output type to use for this pin Return Value : None
void gpio_set_output_type (gpio_port_pin_t pin, gpio_pin_output_t out_type)
{
    uint8_t volatile * addr;
    uint8_t            pin_number;
    uint8_t            bit_offset;
    pin_number = (uint8_t)(pin & 0x00FFu);
    addr   = gpio_port_addr_get(GPIO_PRV_BASE_ADDR_OUT_TYPE, (uint16_t)(((uint16_t)pin)*2));
    if (pin_number > 3)
    {
        addr += 1;
        bit_offset = (uint8_t)((pin_number - 4) * 2);
    }
    else
    {
        bit_offset = (uint8_t)(pin_number * 2);
    }
    *addr = (uint8_t)((*addr) & (~(3 << bit_offset)));
    *addr = (uint8_t)((*addr) | (((uint8_t)out_type) << bit_offset));
}
void gpio_set_output_type ( gpio_port_pin_t pin , gpio_pin_output_t out_type ) { uint8_t volatile * addr ; uint8_t pin_number ; uint8_t bit_offset ; pin_number = ( uint8_t ) ( pin & 0x00FFu ) ; addr = gpio_port_addr_get ( GPIO_PRV_BASE_ADDR_OUT_TYPE , ( uint16_t ) ( ( ( uint16_t ) pin ) * 2 ) ) ; if ( pin_number > 3 ) { addr += 1 ; bit_offset = ( uint8_t ) ( ( pin_number - 4 ) * 2 ) ; } else { bit_offset = ( uint8_t ) ( pin_number * 2 ) ; } * addr = ( uint8_t ) ( ( * addr ) & ( ~ ( 3 << bit_offset ) ) ) ; * addr = ( uint8_t ) ( ( * addr ) | ( ( ( uint8_t ) out_type ) << bit_offset ) ) ; }
Function Name: gpio_set_output_type
Description  : Configures pin output type (e.g.
Function Name : gpio_set_output_type Description : Configures pin output type ( e . g .
/* Get pin number */ /* 'pin' is multiplied by 2 because the ODR0 and ODR1 registers are staggered. This means that PORT0.ODR0
     * and PORT1.ODR0 are separated by 2 bytes instead of 1 as with the other port registers. */ /* ODR bit fields are 2-bits a piece. This means bits 0-3 are in the 1st byte (ODR0) and bits 4-7 are in
     * the 2nd byte (ODR1).
     */ /* Bit field is in ODR1. Increment address by 1 for ODR1 register for this port. */ /* Subtract 4 from pin number since pins 4-7 are stored in ODR1 which is an 8-bit register.
         * Multiple pin number by 2 since each pin is represented by 2 bits.
         */ /* Multiple pin number by 2 since each pin is represented by 2 bits. */ /* Clear the bits we intend to change. */ /* Set the bits again if needed. */