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

Function gpio_set_value

bsp/dm365/drivers/gpio.c:116–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116int gpio_set_value(unsigned int gpio, int value)
117{
118 unsigned int offset;
119 int ret=0;
120
121 rt_ubase_t temp = rt_hw_interrupt_disable();
122 ret = gpio_to_base(gpio);
123 if (ret < 0) {
124 goto gpio_free;
125 }
126
127 offset = gpio & ((1 << GPIO_GRP_MASK) -1);
128
129 if (value) {
130 gpio_set(offset);
131 }
132 else {
133 gpio_clr(offset);
134 }
135
136gpio_free:
137 rt_hw_interrupt_enable(temp);
138
139 return ret;
140}
141
142int gpio_get_value(unsigned int gpio)
143{

Callers 2

davinci_spi_chipselectFunction · 0.70
generic_i2c_clock_pulseFunction · 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