static void transfer(int fd,uint8_t opcode, uint32_t config_reg_data,int gpio_fd)
{
Clear_GPIO146(gpio_fd);//set reset pin to 0
Clear_SS(gpio_fd); // set SSN pin to 0
int ret;
uint8_t Data_Byte_Lo=config_reg_data;
uint8_t Data_Byte_Mid1=config_reg_data>>8;
uint8_t Data_Byte_Mid2=config_reg_data>>16;
uint8_t Data_Byte_Hi=config_reg_data>>24;
uint8_t tx[] ={opcode,Data_Byte_Hi,Data_Byte_Mid2,Data_Byte_Mid1,Data_Byte_Lo,};
uint8_t rx[ARRAY_SIZE(tx)] = {0, };
struct spi_ioc_transfer tr = {
.tx_buf = (unsigned long)tx,
.rx_buf = (unsigned long)rx,
.len = ARRAY_SIZE(tx),
.delay_usecs = 100,
.speed_hz = speed,
.bits_per_word = bits,
};
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
if (ret < 1)
pabort("can't send spi message");
Set_GPIO146(gpio_fd);//set reset pin back to 1
Set_SS(gpio_fd); //set SSN pin back to 1
}