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

Function test_gpio

bsp/raspberry-pi/raspi3-32/applications/test_device.c:108–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106#endif
107
108void test_gpio(void)
109{
110#ifdef BSP_USING_PIN
111 rt_uint32_t ret;
112 rt_kprintf("Hello Test GPIO!\n");
113
114 rt_pin_mode(TEST_PIN_OUT, PIN_MODE_OUTPUT);
115 rt_pin_write(TEST_PIN_OUT, PIN_HIGH);
116 rt_pin_mode(TEST_PIN_IN, PIN_MODE_INPUT);
117
118 ret = rt_pin_read(TEST_PIN_IN);
119 rt_kprintf("common high input test read result: %d\n",ret);
120
121 rt_pin_write(TEST_PIN_OUT, PIN_LOW);
122 ret = rt_pin_read(TEST_PIN_IN);
123 rt_kprintf("common low input test read result: %d\n",ret);
124
125 rt_pin_mode(TEST_PIN_IN, PIN_MODE_INPUT_PULLDOWN);
126 rt_pin_attach_irq(TEST_PIN_IN, PIN_IRQ_MODE_RISING, gpio_rising_test, RT_NULL);
127 rt_pin_irq_enable(TEST_PIN_IN, PIN_IRQ_ENABLE);
128 rt_pin_write(TEST_PIN_OUT, PIN_HIGH);
129
130 rt_pin_irq_enable(TEST_PIN_IN, PIN_IRQ_DISABLE);
131#endif
132}
133
134#ifdef BSP_USING_I2C1
135#define DS3231_I2C_BUS_NAME "i2c1"

Callers 1

test_deviceFunction · 0.85

Calls 6

rt_kprintfFunction · 0.85
rt_pin_attach_irqFunction · 0.85
rt_pin_irq_enableFunction · 0.85
rt_pin_modeFunction · 0.50
rt_pin_writeFunction · 0.50
rt_pin_readFunction · 0.50

Tested by

no test coverage detected