I have a Raspberry-pi 3 which I am trying to interface with FLIR Lepton thermal camera. While I understand how this interface works, I have a question regarding the SPI read
command. Below is the snippet of the code. Full source can be found at github
#define PACKET_SIZE 164
#define PACKET_SIZE_UINT16 (PACKET_SIZE/2) //82
#define PACKETS_PER_FRAME 60
#define FRAME_SIZE_UINT16 (PACKET_SIZE_UINT16*PACKETS_PER_FRAME) //4920
uint8_t result[PACKET_SIZE*PACKETS_PER_FRAME]; //9840
for(int j=0;j<PACKETS_PER_FRAME;j++) {
read(spi_cs0_fd, result+sizeof(uint8_t)*PACKET_SIZE*j, sizeof(uint8_t)*PACKET_SIZE);
}
Since the second parameter of the unix read
call is the buffer void *buf
, I cannot figure out how the parameter result+sizeof(uint8_t)*PACKET_SIZE*j
resolves into a pointer of a location in the array result
.
Can someone help explain how this resolves into an array location in result
?