Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/asteencern/rpi-daq
Browse files Browse the repository at this point in the history
  • Loading branch information
asteencern committed Jan 23, 2018
2 parents 856b5fa + c80fcb9 commit 179d9b5
Show file tree
Hide file tree
Showing 3 changed files with 753 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ static unsigned char BusMode; // global to remember status of gpio lines
////////////////////////////// LOW LEVEL ROUTINES //////////////////////////////
int set_bus_init()
{
if(!bcm2835_init()){
printf("problem in gpiolib.c method set_but_init(): bcm2835_init() failed -> exit code");
exit(1);
}
unsigned char lev;
bcm2835_gpio_fsel(STpin, BCM2835_GPIO_FSEL_OUTP); // set pin direction
bcm2835_gpio_fsel(RWpin, BCM2835_GPIO_FSEL_OUTP); // set pin direction
Expand All @@ -85,6 +89,8 @@ int set_bus_init()
BusMode = MODE_READ; // start in Read mode
lev = bcm2835_gpio_lev( ACKpin ); // check that ACK is HIGH
if(lev == HIGH) {
// Set the pin to be an output
bcm2835_gpio_fsel(RWpin, BCM2835_GPIO_FSEL_OUTP);
return(0);
}
else {
Expand Down
Loading

0 comments on commit 179d9b5

Please sign in to comment.