Newer
Older
const int MOSI_PIN = 12; //from RASPI to FPGA
const int MISO_PIN = 13; //from RASPI to FPGA
const int MOSI_PIN_FPGA = 14; //from RASPI to FPGA
const int MISO_PIN_FPGA = 16; //from RASPI to FPGA
const int VDD_PIN_FPGA = 29; //from FPGA to ENCODER -> ouput data from encoder
const int ENC_PIN_1A = 38; //from FPGA to ENCODER -> ouput data from encoder
const int ENC_PIN_1B = 36; //from FPGA to ENCODER -> ouput data from encoder
const int ENC_PIN_2A = 35; //from FPGA to ENCODER -> ouput data from encoder
const int ENC_PIN_2B = 34; //from FPGA to ENCODER -> ouput data from encoder
const int SCK_PIN = 14; //from RASPI to FPGA -> clock signal
const int SCK_PIN_FPGA = 13; //from FPGA to ENCODER -> clock signal
const int SS_PIN_2 = 11; //CE1 from RASPI to FPGA -> enable encoder
*/
unsigned char rawData[32];
const int len = 32;
const int CHANNEL_DEO = 1;
int result, fd;
for (int i = 0; i<32; i++){
rawData[i] = 0x01;}
if (wiringPiSetup() == -1) {
printf("WiringPiSetup failed\n");
exit(EXIT_FAILURE);
}
fd = wiringPiSPISetup(CHANNEL_DEO, 500000);
result = wiringPiSPIDataRW(CHANNEL_DEO, rawData, len);
for (int i = 0; i<32; i++){
printf("speed: ", rawData[i], "\n");
}
return 0;
/*
pinMode(ENC_PIN_1A, INPUT);
pinMode(ENC_PIN_1B, INPUT);
pinMode(ENC_PIN_2A, INPUT);
pinMode(ENC_PIN_2B, INPUT);