Skip to content
Extraits de code Groupes Projets
Valider 99b3496b rédigé par Diego de Bernard de Fauconval's avatar Diego de Bernard de Fauconval
Parcourir les fichiers

plein de choses

parent b10d87fa
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
{
"files.associations": {
"iostream": "cpp"
}
}
\ No newline at end of file
......@@ -15,6 +15,9 @@ uart : compile_UART
spi : compile_spi
sudo ./spi
encoder : compile_encoder
sudo ./encoder
# compilations
compile_switch :
g++ -o switch switch.cpp -lwiringPi
......@@ -31,6 +34,9 @@ compile_UART :
compile_spi :
g++ -o spi spi.cpp -l wiringPi
compile_encoder :
g++ -o encoder encoder.cpp -l wiringPi
.PHONY : clean
clean :
rm -rf switch motor led i2c uart spi
rm -rf switch motor led i2c uart spi encoder
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <wiringPi.h>
#include <wiringPiSPI.h>
/*
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
......@@ -16,19 +17,36 @@ 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
const int CE1_PIN_FPGA = 15;
*/
unsigned char rawData[32];
const int len = 32;
const int CHANNEL_DEO = 1;
int main(int argc, char const *argv[])
{
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);
//read(wiringPiSPIGetFd (0), data, 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);
return 0;
}
\ No newline at end of file
*/
}
Fichier ajouté
spi 0 → 100755
Fichier ajouté
......@@ -13,14 +13,14 @@ 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);
}
int reg = 0x42;
int reg = 0x40;
int GPIO[] = {0b00000001, 0b00000010, 0b00001000, 0b00010000};
buff[0] = reg;
......@@ -32,7 +32,7 @@ int main(int argc, char const *argv[])
buff[0] = reg;
delay(1500);
}
return 0;
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter