Skip to content
Extraits de code Groupes Projets
spi.cpp 498 octets
Newer Older
  • Learn to ignore specific revisions
  • Diego de Fauconval's avatar
    spi
    Diego de Fauconval a validé
    #include <stdlib.h>
    #include <stdio.h>
    #include <wiringPi.h>
    #include <wiringPiSPI.h>
    
    #include <iostream>
    
    using namespace std;
    
    const int CHANNEL_CAN = 1;
    
    int main(int argc, char const *argv[])
    {
        int result, fd;
        unsigned char buff[30];
    
        fd = wiringPiSPISetup(CHANNEL_CAN, 500000);
        if (fd == -1) {
            printf("Error setup\n");
            exit(EXIT_FAILURE);
        }
    
        buff[0] = 0x40;
        buff[1] = 0x01;
    
        result = wiringPiSPIDataRW(CHANNEL_CAN, buff, 2);
    
    
    
        return 0;
    }