int spi_master_write(spi_t *obj, int value) { while (!spi_writeable(obj)) { } obj->spi->TXD = (uint32_t)value; return spi_read(obj); }
static inline void spi_write(spi_t *obj, int value) { while (!spi_writeable(obj)); // end of transfer obj->spi->TXCTL |= (1 << 20); obj->spi->TXDAT = (value & 0xffff); }
int spi_master_write(spi_t *obj, int value) { // wait tx buffer empty while(!spi_writeable(obj)); obj->spi->D = (value & 0xff); // wait rx buffer full while (!spi_readable(obj)); return obj->spi->D & 0xff; }
int spi_master_write(spi_t *obj, int value) { // wait tx buffer empty while(!spi_writeable(obj)); obj->spi->PUSHR = SPI_PUSHR_TXDATA(value & 0xff); // wait rx buffer full while (!spi_readable(obj)); return obj->spi->POPR; }
int spi_master_write(spi_t *obj, int value) { //clear RX buffer flag obj->spi->SR |= SPI_SR_RFDF_MASK; // wait tx buffer empty while(!spi_writeable(obj)); obj->spi->PUSHR = SPI_PUSHR_TXDATA(value & 0xffff) /*| SPI_PUSHR_EOQ_MASK*/; // wait rx buffer full while (!spi_readable(obj)); return obj->spi->POPR; }
int spi_master_write(spi_t *obj, int value) { // wait tx buffer empty while(!spi_writeable(obj)); dspi_command_config_t command = {0}; command.isEndOfQueue = true; command.isChipSelectContinuous = 0; dspi_hal_write_data_master_mode(obj->instance, &command, (uint16_t)value); dspi_hal_clear_status_flag(obj->instance, kDspiTxFifoFillRequest); // wait rx buffer full while (!spi_readable(obj)); dspi_hal_clear_status_flag(obj->instance, kDspiRxFifoDrainRequest); return dspi_hal_read_data(obj->instance) & 0xff; }
int spi_master_write(spi_t *obj, int value) { // wait tx buffer empty while(!spi_writeable(obj)); dspi_command_config_t command = {0}; command.isEndOfQueue = true; command.isChipSelectContinuous = 0; DSPI_HAL_WriteDataMastermode(obj->spi.address, &command, (uint16_t)value); DSPI_HAL_ClearStatusFlag(obj->spi.address, kDspiTxFifoFillRequest); // wait rx buffer full while (!spi_readable(obj)); DSPI_HAL_ClearStatusFlag(obj->spi.address, kDspiRxFifoDrainRequest); return DSPI_HAL_ReadData(obj->spi.address) & 0xff; }
void spi_slave_write(spi_t *obj, int value) { while (!spi_writeable(obj)); dspi_hal_write_data_slave_mode(obj->instance, (uint32_t)value); }
void spi_slave_write(spi_t *obj, int value) { while (!spi_writeable(obj)); obj->spi->D = value; }
void spi_slave_write(spi_t *obj, int value) { while (!spi_writeable(obj)); }
void spi_slave_write(spi_t *obj, int value) { while (spi_writeable(obj) == 0) ; obj->spi->TXDAT = value; }