Skip to content

Commit

Permalink
RPI: Fix for SPIDEV on 4.1.7+
Browse files Browse the repository at this point in the history
Per #138 n8henrie - SPIDEV not working with newest firmware.
  • Loading branch information
TMRh20 committed Sep 23, 2015
1 parent 14ed863 commit ded2157
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions arch/BBB/spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ void SPI::begin(int busNo){


//BBB:
if(!busNo){
/*if(!busNo){
this->device = "/dev/spidev1.0";;
}else{
this->device = "/dev/spidev1.1";;
}
}*/

//RPi:
/* if(!busNo){
if(!busNo){
this->device = "/dev/spidev0.0";;
}else{
this->device = "/dev/spidev0.1";;
}*/
}


this->bits = 8;
Expand Down Expand Up @@ -110,7 +110,8 @@ uint8_t SPI::transfer(uint8_t tx_)
int ret;
uint8_t tx[1] = {tx_};
uint8_t rx[1];


this->init();
struct spi_ioc_transfer tr = {
tr.tx_buf = (unsigned long)&tx[0],
tr.rx_buf = (unsigned long)&rx[0],
Expand Down Expand Up @@ -151,7 +152,7 @@ void SPI::transfernb(char* tbuf, char* rbuf, uint32_t len)
{

int ret;

this->init();
struct spi_ioc_transfer tr = {
tr.tx_buf = (unsigned long)tbuf,
tr.rx_buf = (unsigned long)rbuf,
Expand Down

0 comments on commit ded2157

Please sign in to comment.