I read the expert's blog again and found that they don't run the compilation executive file spidev_test but sudo ./a.out. I vaguely remember a.out should be the c program's default output file. So the compilation actually runs the program.
Anyway, I complied and sudo ./a.out and got an all FF output. I guess this is a failure.
I remember I download the Python wrapper thing of spidev. So perhaps the spidev.c is for C only, not for python wrapper thing.
Anyway, I gave up and forget spidev_test.c for now, and move on to my own Python test functions.
pi@raspberrypi ~/python_programs/test_decoder $ gcc spidev_test.c
pi@raspberrypi ~/python_programs/test_decoder $ sudo ./a.out
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF
.END
No comments:
Post a Comment