Closed ADKaster closed 7 years ago
spi_master_push_request should be renamed spi_master_enqueue
spi_master_pop_request should be renamed spi_master_dequeue
spi_master_pop_request will never change which index is front.
This is the old state of pop_request
Bool spi_master_pop_request(spi_master_t *spi_interface) { Bool popStatus = true; uint8_t oldFront = spi_interface->front; uint8_t newFront = (oldFront == SPI_MASTER_QUEUE_DEPTH) ? 0 : oldFront; /* newFront will never change, and always be 0 */ if(spi_interface->requestQueue[oldFront].valid == false) { popStatus = false; } else { spi_interface->requestQueue[oldFront].valid = false; spi_interface->front = newFront; } return popStatus; }
It should look something like this:
Bool spi_master_dequeue(spi_master_t *spi_interface) { Bool popStatus = true; uint8_t oldFront = spi_interface->front; uint8_t newFront = (spi_interface->front == spi_interface->back) ? oldFront : oldFront + 1; if(newFront >= SPI_MASTER_QUEUE_DEPTH) { newFront = 0; } if(spi_interface->requestQueue[oldFront].valid == false) { popStatus = false; } else { spi_interface->requestQueue[oldFront].valid = false; spi_interface->front = newFront; } return popStatus; }
Also waaay too many files were committed on this branch. The extra karman-avionics folder needs to go away asap
spi_master_push_request should be renamed spi_master_enqueue
spi_master_pop_request should be renamed spi_master_dequeue
spi_master_pop_request will never change which index is front.
This is the old state of pop_request
It should look something like this:
Also waaay too many files were committed on this branch. The extra karman-avionics folder needs to go away asap