MCPcopy Create free account
hub / github.com/WiringPi/WiringPi / digitalReadByte

Function digitalReadByte

wiringPi/wiringPi.c:2563–2585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2561}
2562
2563unsigned int digitalReadByte (void)
2564{
2565 int pin, x ;
2566 uint32_t raw ;
2567 uint32_t data = 0 ;
2568
2569 FailOnModel5("digitalReadByte");
2570
2571 if (wiringPiMode == WPI_MODE_GPIO_SYS)
2572 {
2573 return 0;
2574 }
2575 else
2576 {
2577 raw = *(gpio + gpioToGPLEV [0]) ; // First bank for these pins
2578 for (pin = 0 ; pin < 8 ; ++pin)
2579 {
2580 x = pinToGpio [pin] ;
2581 data = (data << 1) | (((raw & (1 << x)) == 0) ? 0 : 1) ;
2582 }
2583 }
2584 return data ;
2585}
2586
2587
2588/*

Callers 1

doReadByteFunction · 0.85

Calls 1

FailOnModel5Function · 0.85

Tested by

no test coverage detected