firmware  v0.1.2
Chromation Spectrometer Dev-Kit
Functions | Variables
Queue.c File Reference
#include "Queue.h"

Go to the source code of this file.

Functions

volatile Queue_sQueueInit (volatile uint8_t *buffer, uint16_t const buffer_size_in_bytes)
 
uint16_t QueueLength (volatile Queue_s *pq)
 
bool QueueIsFull (volatile Queue_s *SpiFifo)
 
bool QueueIsEmpty (volatile Queue_s *SpiFifo)
 
void QueuePush (volatile Queue_s *SpiFifo, uint8_t data_to_push)
 
uint8_t QueuePop (volatile Queue_s *SpiFifo)
 

Variables

volatile Queue_s Queue
 

Function Documentation

◆ QueueInit()

volatile Queue_s* QueueInit ( volatile uint8_t *  buffer,
uint16_t const  buffer_size_in_bytes 
)
inline

Return a pointer to the global Queue

QueueInit behavior:

  • returns a pointer to a Queue struct
  • memory for Queue struct is allocated in Queue object file
  • assigns input buffer as Queue buffer
  • size input is the maximum Queue length
  • initializes Queue with length 0

Definition at line 51 of file Queue.h.

◆ QueueIsEmpty()

bool QueueIsEmpty ( volatile Queue_s SpiFifo)
inline

Return true if Queue is empty

QueueIsEmpty behavior:

  • returns true if Queue is empty
  • returns false if Queue is not empty

Definition at line 95 of file Queue.h.

◆ QueueIsFull()

bool QueueIsFull ( volatile Queue_s SpiFifo)
inline

Return true if Queue is full

QueueIsFull behavior:

  • returns true if Queue is full
  • returns false if Queue is not full

Definition at line 86 of file Queue.h.

◆ QueueLength()

uint16_t QueueLength ( volatile Queue_s pq)
inline

Return length of Queue

QueueLength behavior:

  • increments after a push
  • does not increase beyond max length
  • decrements after a pop
  • does not decrease below zero

Definition at line 76 of file Queue.h.

◆ QueuePop()

uint8_t QueuePop ( volatile Queue_s SpiFifo)
inline

Pop data from the Queue

QueuePop behavior:

  • removes oldest byte from Queue
  • returns oldest byte
  • does not remove any bytes if Queue is empty
  • returns 0 if Queue is empty
  • hits end of buffer and wraps around if Queue is not empty

Definition at line 139 of file Queue.h.

◆ QueuePush()

void QueuePush ( volatile Queue_s SpiFifo,
uint8_t  data_to_push 
)
inline

Push data onto the Queue

QueuePush behavior:

  • writes byte to Queue buffer
  • writes next byte to address after previous write
  • does not write byte if Queue is full
  • hits end of buffer and wraps around if Queue is not full

Definition at line 122 of file Queue.h.