mirror of
https://github.com/CTCaer/hekate.git
synced 2024-12-23 00:22:01 +00:00
bdk: gpio: add simple gpio direction functions
This commit is contained in:
parent
4e15e034b8
commit
05b5e4f297
2 changed files with 15 additions and 0 deletions
|
@ -86,6 +86,19 @@ void gpio_write(u32 port, u32 pins, int high)
|
|||
(void)GPIO(port_offset); // Commit the write.
|
||||
}
|
||||
|
||||
void gpio_direction_input(u32 port, u32 pins)
|
||||
{
|
||||
gpio_config(port, pins, GPIO_MODE_GPIO);
|
||||
gpio_output_enable(port, pins, GPIO_OUTPUT_DISABLE);
|
||||
}
|
||||
|
||||
void gpio_direction_output(u32 port, u32 pins, int high)
|
||||
{
|
||||
gpio_config(port, pins, GPIO_MODE_GPIO);
|
||||
gpio_output_enable(port, pins, GPIO_OUTPUT_ENABLE);
|
||||
gpio_write(port, pins, high);
|
||||
}
|
||||
|
||||
int gpio_read(u32 port, u32 pins)
|
||||
{
|
||||
u32 port_offset = GPIO_IN_OFFSET(port);
|
||||
|
|
|
@ -85,6 +85,8 @@
|
|||
|
||||
void gpio_config(u32 port, u32 pins, int mode);
|
||||
void gpio_output_enable(u32 port, u32 pins, int enable);
|
||||
void gpio_direction_input(u32 port, u32 pins);
|
||||
void gpio_direction_output(u32 port, u32 pins, int high);
|
||||
void gpio_write(u32 port, u32 pins, int high);
|
||||
int gpio_read(u32 port, u32 pins);
|
||||
int gpio_interrupt_status(u32 port, u32 pins);
|
||||
|
|
Loading…
Reference in a new issue