MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / gpio_direction_output

Function gpio_direction_output

bsp/dm365/drivers/gpio.c:88–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88int gpio_direction_output(unsigned int gpio, int value)
89{
90 unsigned int offset;
91 int ret=0;
92
93 rt_ubase_t temp = rt_hw_interrupt_disable();
94 ret = gpio_to_base(gpio);
95 if (ret < 0) {
96 goto gpio_free;
97 }
98
99 offset = gpio & ((1 << GPIO_GRP_MASK) -1);
100
101 if (value) {
102 gpio_set(offset);
103 }
104 else {
105 gpio_clr(offset);
106 }
107
108 gpio_dirout(offset);
109
110gpio_free:
111 rt_hw_interrupt_enable(temp);
112
113 return ret;
114}
115
116int gpio_set_value(unsigned int gpio, int value)
117{

Callers 1

davinci_spi_probeFunction · 0.70

Calls 4

gpio_to_baseFunction · 0.85
rt_hw_interrupt_disableFunction · 0.50
gpio_setFunction · 0.50
rt_hw_interrupt_enableFunction · 0.50

Tested by

no test coverage detected