diff --git a/cw/cw_main.c b/cw/cw_main.c index e67ffd78..98ec7522 100644 --- a/cw/cw_main.c +++ b/cw/cw_main.c @@ -16,6 +16,9 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include //Needed for I2C port +#include //Needed for I2C port +#include //Needed for I2C port #include #include @@ -86,7 +89,18 @@ int main(void) tlm[i][j] = 0; } } - tempSensor = wiringPiI2CSetupInterface("/dev/i2c-3", 0x48); + int file_i2c; + char *filenam1e = (char*)"/dev/i2c-3"; + if ((file_i2c = open(filenam1e, O_RDWR)) < 0) + { + printf("ERROR: /dev/ic2-3 bus not present\n"); + tempSensor = -1; + } else + { + tempSensor = wiringPiI2CSetupInterface("/dev/i2c-3", 0x48); + } + + printf("tempSensor: %d \n",tempSensor); // Configure SPI bus to AX5043 setSpiChannel(SPI_CHANNEL);