| 2251 | */ |
| 2252 | |
| 2253 | int digitalReadDeviceV2(int pin) { // INPUT and OUTPUT should work |
| 2254 | struct gpio_v2_line_values lv; |
| 2255 | int ret; |
| 2256 | |
| 2257 | if (lineFds[pin]<0) { |
| 2258 | // line not requested - auto request on first read as input |
| 2259 | pinModeDevice(pin, INPUT); |
| 2260 | } |
| 2261 | lv.mask = 0; |
| 2262 | lv.bits = 0; |
| 2263 | if (lineFds[pin]>=0) { |
| 2264 | gpiotools_set_bit(&lv.mask, 0); |
| 2265 | ret = ioctl(lineFds[pin], GPIO_V2_LINE_GET_VALUES_IOCTL, &lv); |
| 2266 | if (ret) { |
| 2267 | ReportDeviceError("get line values", pin, "digitalRead", ret); |
| 2268 | return LOW; // error |
| 2269 | } |
| 2270 | return gpiotools_test_bit(lv.bits, 0); |
| 2271 | } |
| 2272 | return LOW; // error , need to request line before |
| 2273 | } |
| 2274 | |
| 2275 | |
| 2276 | int digitalRead (int pin) |
no test coverage detected