PINMUX Exported Functions

group PINMUX_Exported_Functions

Functions

void Pinmux_Reset(void)

Configure or reset all pins to idle mode.

Example usage

void board_xxx_init(void)//XXX represents the name of the peripheral to be configured.
{
    Pinmux_Reset();
}
Returns:

None.

void Pinmux_Deinit(uint8_t Pin_Num)

Configure the specified pin to idle mode.

Example usage

void board_xxx_init(void)
{
    Pinmux_Deinit(P2_2);
}
Parameters:

Pin_Num -- [in] Pin number to be configured. Pin Define.

Returns:

None.

void Pinmux_Config(uint8_t Pin_Num, uint8_t Pin_Func)

Configure the usage function of the selected pin.

Example usage

void driver_uart_init(void)
{
    Pad_Config(P2_0, PAD_PINMUX_MODE, PAD_IS_PWRON, PAD_PULL_UP, PAD_OUT_DISABLE,
            PAD_OUT_HIGH);
    Pad_Config(P2_1, PAD_PINMUX_MODE, PAD_IS_PWRON, PAD_PULL_UP, PAD_OUT_DISABLE,
            PAD_OUT_HIGH);

    Pinmux_Config(P2_0, UART0_TX);
    Pinmux_Config(P2_1, UART0_RX);
}
Parameters:
Returns:

None.

void Pad_Config(uint8_t Pin_Num, PAD_Mode AON_PAD_Mode, PAD_PWR_Mode AON_PAD_PwrOn, PAD_Pull_Mode AON_PAD_Pull, PAD_OUTPUT_ENABLE_Mode AON_PAD_E, PAD_OUTPUT_VAL AON_PAD_O)

Configure the relevant operation mode, peripheral circuit and output level value in software mode of the specified pin.

Example usage

void driver_adc_init(void)
{
    Pad_Config(P2_0, PAD_SW_MODE, PAD_IS_PWRON, PAD_PULL_NONE, PAD_OUT_DISABLE, PAD_OUT_LOW);
    Pad_Config(P2_1, PAD_SW_MODE, PAD_IS_PWRON, PAD_PULL_NONE, PAD_OUT_DISABLE, PAD_OUT_LOW);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. Pin Define.

  • AON_PAD_Mode -- [in] Use software mode or pinmux mode. This parameter can be one of the following values:

    • PAD_SW_MODE: Use software mode.

    • PAD_PINMUX_MODE: Use pinmux mode.

  • AON_PAD_PwrOn -- [in] Configure power of pad. This parameter can be one of the following values:

    • PAD_NOT_PWRON: Shutdown power of pad.

    • PAD_IS_PWRON: Enable power of pad.

  • AON_PAD_Pull -- [in] Configure pad pull mode. This parameter can be one of the following values:

    • PAD_PULL_NONE: No pull.

    • PAD_PULL_UP: Pull this pin up.

    • PAD_PULL_DOWN: Pull this pin down.

  • AON_PAD_E -- [in] Configure pad output function. This parameter can be one of the following values:

    • PAD_OUT_DISABLE: Disable pin output.

    • PAD_OUT_ENABLE: Enable pad output.

  • AON_PAD_O -- [in] Configure pin output level. This parameter can be one of the following values:

    • PAD_OUT_LOW: Pad output low.

    • PAD_OUT_HIGH: Pad output high.

Returns:

None.

void System_WakeUpPinEnable(uint8_t Pin_Num, uint8_t Polarity, uint8_t DebounceEn, uint8_t DebounceTime)

Enable the function of the wake-up system of the specified pin.

Example usage

//IO enter DLPS callback function.
void io_uart_dlps_enter(void)
{
    // Switch pad to software mode
    Pad_ControlSelectValue(P2_0, PAD_SW_MODE); //TX pin
    Pad_ControlSelectValue(P2_1, PAD_SW_MODE); //RX pin

    System_WakeUpPinEnable(P2_1, PAD_WAKEUP_POL_LOW, PAD_WK_DEBOUNCE_DISABLE);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. Pin Define.

  • Polarity -- [in] Polarity of wake-up system. This parameter can be the following:

    • PAD_WAKEUP_POL_HIGH: Use high level wakeup.

    • PAD_WAKEUP_POL_LOW: Use low level wakeup.

  • DebounceEn -- [in] Enable delay function.

    • PAD_WK_DEBOUNCE_DISABLE: Disable delay function.

    • PAD_WK_DEBOUNCE_ENABLE: Enable delay function.

  • DebounceTime -- [in] Set debounce time, range from 0~63ms.

Returns:

None.

void System_WakeUpPinDisable(uint8_t Pin_Num)

Disable the function of the wake-up system of the specified pin.

Example usage

#define UART_RX_PIN                P4_1

//System interrupt handler function, for wakeup pin.
void System_Handler(void)
{
    if (System_WakeUpInterruptValue(UART_RX_PIN) == SET)
    {
        Pad_ClearWakeupINTPendingBit(UART_RX_PIN);
        System_WakeUpPinDisable(UART_RX_PIN);
        //Add user code here.
    }
}
Parameters:

Pin_Num -- [in] Pin number to be configured. Pin Define.

Returns:

None.

uint8_t System_WakeUpInterruptValue(uint8_t Pin_Num)

Get pin interrupt status.

Example usage

#define UART_RX_PIN                P4_1

//System interrupt handler function, for wakeup pin.
void System_Handler(void)
{
    if (System_WakeUpInterruptValue(UART_RX_PIN) == SET)
    {
        Pad_ClearWakeupINTPendingBit(UART_RX_PIN);
        System_WakeUpPinDisable(UART_RX_PIN);
        //Add user code here.
    }
}
Parameters:

Pin_Num -- [in] Pin number to be configured. Pin Define.

Return values:
  • 1 -- Pin wake up system.

  • 0 -- The pin does not wake up the system.

Returns:

Interrupt status.

uint8_t System_DebounceWakeupStatus(void)

Get debounce wake up status.

Example usage

void board_xxx_init(void)
{
    uint8_t DebounceWakeupStatus = System_DebounceWakeupStatus();
}

Note

Call this API will clear the debounce wakeup status bit.

Return values:

Debounce -- wakeup status

void Pad_OutputControlValue(uint8_t Pin_Num, uint8_t value)

Configure pad output level.

Example usage

void board_xxx_init(void)
{
    Pad_OutputControlValue(P2_0, PAD_OUT_HIGH);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. Pin Define.

  • value -- [in] Configure pin output level. This parameter can be one of the following values:

    • PAD_OUT_LOW: Pad output low.

    • PAD_OUT_HIGH: Pad output high.

Returns:

None.

void Pad_OutputEnableValue(uint8_t Pin_Num, uint8_t value)

Enable or disable pad output mode.

Example usage

void pad_demo(void)
{
    Pad_OutputEnableValue(P2_0, PAD_OUT_ENABLE);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. Pin Define.

  • value -- [in] This parameter sets whether the pin outputs the level in software mode. This parameter can be enumerated PAD_OUTPUT_ENABLE_Mode of the values:

    • PAD_OUT_DISABLE: Disable output.

    • PAD_OUT_ENABLE: Enable output.

Returns:

None.

void Pad_PullEnableValue(uint8_t Pin_Num, uint8_t value)

Enable or disable pad pull-up / pull-down resistance function.

Example usage

void board_xxx_init(void)
{
    Pad_PullEnableValue(P2_0, ENABLE);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. Pin Define.

  • value -- [in] This parameter Enable or disable the pad pin pull-up/pull-down function. This parameter can be the following:

    • DISABLE: Disable pad pull-up / pull-down function.

    • ENABLE: Enable pad pull-up / pull-down function.

Returns:

None.

void Pad_PullUpOrDownValue(uint8_t Pin_Num, uint8_t value)

Pad pull-up/pull-down resistance function selection.

Example usage

void board_xxx_init(void)
{
    Pad_PullUpOrDownValue(P2_0, 1);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. This parameter is from P0_0 to H_2, please refer to rtl876x.h Pin Define part.

  • value -- [in] This parameter sets whether the pin pull-up or pull-down. This parameter can be the following:

    • 0: Config pad pull-up function.

    • 1: Config pad pull-down function.

Returns:

None.

void Pad_PullConfigValue(uint8_t Pin_Num, uint8_t value)

Configure the strength of pull-up/pull-down resistance.

Example usage

void board_xxx_init(void)
{
    Pad_PullConfigValue(P2_0, PAD_STRONG_PULL);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. Pin Define.

  • value -- [in] This parameter sets the strength of pull-up/pull-down resistance. This parameter can be the following:

    • PAD_WEAK_PULL: Resistance weak pull.

    • PAD_STRONG_PULL: Resistance strong pull.

Returns:

None.

void Pad_PowerOrShutDownValue(uint8_t Pin_Num, uint8_t value)

Set pin power mode.

Example usage

void board_xxx_init(void)
{
    Pad_PowerOrShutDownValue(P2_0, PAD_NOT_PWRON);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. Pin Define.

  • value -- [in] This parameter sets the power supply mode of the pin, and the value is enumeration PAD_PWR_Mode One of the values.

    • PAD_NOT_PWRON: Power off.

    • PAD_IS_PWRON: Power on.

Returns:

None.

void Pad_ControlSelectValue(uint8_t Pin_Num, uint8_t value)

Set pin mode.

Example usage

void board_xxx_init(void)
{
    Pad_ControlSelectValue(P2_0, PAD_SW_MODE);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. Pin Define.

  • value -- [in] This parameter sets the pin mode. This parameter can be the following:

    • PAD_SW_MODE: Software mode.

    • PAD_PINMUX_MODE: Pinmux mode.

Returns:

None.

void Pad_SetDrivingCurrent(uint8_t Pin_Num, PAD_DRIVING_CURRENT PAD_Driving_Current)

Set pin driving current.

Example usage

void board_xxx_init(void)
{
    Pad_SetDrivingCurrent(P0_0, PAD_DRIVING_CURRENT_16_28mA);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. This parameter can be P0_0 P0_5 P0_6 P5_1.

  • PAD_Driving_Current -- [in] This parameter sets the pin driving current. This parameter can be the following:

    • PAD_DRIVING_CURRENT_8_8mA.

    • PAD_DRIVING_CURRENT_12_18mA.

    • PAD_DRIVING_CURRENT_16_28mA.

Returns:

None.

void Pad_WakeupEnableValue(uint8_t Pin_Num, uint8_t value)

Enable the function of the wake-up system of the specified pin.

Example usage

void board_xxx_init(void)
{
    Pad_WakeupEnableValue(P2_0, 1);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. Pin Define.

  • value -- [in] Enable wake-up system function.

    • 0: Disable wake-up system function.

    • 1: Enable wake-up system function.

Returns:

None.

void Pad_WakeupPolarityValue(uint8_t Pin_Num, uint8_t value)

Set polarity of wake-up system.

Example usage

void board_xxx_init(void)
{
    Pad_WakeupPolarityValue(P2_0, PAD_WAKEUP_POL_HIGH);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. Pin Define.

  • Polarity -- [in] Polarity of wake-up system. This parameter can be the following:

    • PAD_WAKEUP_POL_LOW: Use low-level wakeup.

    • PAD_WAKEUP_POL_HIGH: Use high-level wakeup.

Returns:

None.

void Pad_WKDebounceConfig(uint8_t Pin_Num, uint8_t value)

Config pin delay function.

Example usage

void board_xxx_init(void)
{
    Pad_WKDebounceConfig(P2_0, 1);
}
Parameters:
  • Pin_Num -- [in] Pin number to be configured. Pin Define.

  • value -- [in] Enable delay function.

    • 0: Disable delay function.

    • 1: Enable delay function.

Returns:

None.

uint8_t Pad_WakeupInterruptValue(uint8_t Pin_Num)

Get pin interrupt status, function is the same as.

See also

system_WakeUpInterruptValue.

Parameters:

Pin_Num -- [in] Pin number to be configured. Pin Define.

Return values:
  • 0 -- The pin does not wake up the system.

  • 1 -- Pin wake up system.

Returns:

Interrupt status.

uint8_t Pad_DebounceWakeupStatus(void)

Check debounce wake up status.

Note

Call this API will clear the debounce wakeup status bit.

Returns:

Debounce wakeup status

void Pad_ClearWakeupINTPendingBit(uint8_t Pin_Num)

Clear the interrupt pending bit of the specified pin.

Example usage

void board_xxx_init(void)
{
    Pad_ClearWakeupINTPendingBit(P2_0);
}
Parameters:

Pin_Num -- [in] Pin number to be configured. Pin Define.

Returns:

None.

void Pad_ClearAllWakeupINT(void)

Clear all wake up pin interrupt pending bit.

Example usage

void board_xxx_init(void)
{
    Pad_ClearAllWakeupINT();
}
Returns:

None.

void Pinmux_L8080_Sel_Intfc(uint32_t Sel_Intfc)

LCD8080 pinmux select interface.

Parameters:

value -- [in] LCD8080 select interface:

  • 0x0 : disable LCD interface

  • 0x1 : enable I8080 interface

  • 0x2 : enable QSPI interface

  • 0x3 : disable LCD interface

Returns:

None

void Pinmux_L8080_Enable(uint8_t Pin_Num, FunctionalState NewState)

LCD8080 pinmux cmd.

Parameters:
  • Pin_Num -- [in] LCD8080 Pinmux pos:

    • P0_1 LCD PINMUX POS: 0

    • P0_2 LCD PINMUX POS: 1

    • P0_4 LCD PINMUX POS: 2

    • P0_5 LCD PINMUX POS: 3

    • P2_0 LCD PINMUX POS: 4

    • P3_2 LCD PINMUX POS: 5

    • P3_3 LCD PINMUX POS: 6

    • P3_4 LCD PINMUX POS: 7

    • P3_5 LCD PINMUX POS: 8

    • P3_6 LCD PINMUX POS: 9

    • P4_0 LCD PINMUX POS: 10

    • P4_1 LCD PINMUX POS: 11

    • P4_2 LCD PINMUX POS: 12

    • P4_3 LCD PINMUX POS: 13

  • NewState -- Enable or Disable.

Returns:

None

void Spic0_control(uint8_t value)

Spic0 master enable.

Example usage

void io_demo(void)
{
    Spic0_control(1);
}
Parameters:

value -- [in] 0:Disable 1:Enable.

Returns:

None.

void Spic1_control(uint8_t value)

Spic1 master enable.

Example usage

void io_demo(void)
{
    Spic1_control(1);
}
Parameters:

value -- [in] 0:Disable 1:Enable.

Returns:

None.