Generation

generate functionTue, 17 Jan 2023

AS3933 receive data

void AS3933_read_data(uint8_t addr, uint8_t reg, uint8_t len, uint8_t *data) { uint8_t i = 0; uint8_t tmp; if(len > 1) { tmp = reg | 0x80; } else { tmp = reg; } set_CSN_low(); spi_transfer(SPI_WRITE_BYTE); spi_transfer(addr); spi_transfer(tmp); for(i = 0; i < len; i++) { data[i] = spi_transfer(0xFF); } set_CSN_high(); }

Questions about programming?Chat with your personal AI assistant