You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
795 B
33 lines
795 B
/*
|
|
* Gpio.c
|
|
*
|
|
* Created on: 2024Äê4ÔÂ17ÈÕ
|
|
* Author: tang
|
|
*/
|
|
#include<CH59x_gpio.h>
|
|
/*!
|
|
* @brief Get the position of the bit set in the GPIO_Pin
|
|
* @param GPIO_Pin: specifies the port bit to be written.
|
|
* This parameter can be one of GPIO_PIN_x where x can be (0..15).
|
|
* All port bits are not necessarily available on all GPIOs.
|
|
* @retval the position of the bit
|
|
*/
|
|
uint8_t GpioGetBitPos( uint16_t GPIO_Pin )
|
|
{
|
|
uint8_t pinPos = 0u;
|
|
|
|
if ( ( GPIO_Pin & 0xFF00u ) != 0u ){
|
|
pinPos |= 0x8u;
|
|
}
|
|
if ( ( GPIO_Pin & 0xF0F0u ) != 0u ){
|
|
pinPos |= 0x4u;
|
|
}
|
|
if ( ( GPIO_Pin & 0xCCCCu ) != 0u ){
|
|
pinPos |= 0x2u;
|
|
}
|
|
if ( ( GPIO_Pin & 0xAAAAu ) != 0u ){
|
|
pinPos |= 0x1u;
|
|
}
|
|
|
|
return pinPos;
|
|
}
|
|
|