Commit 2fb6742b authored by Jacob Vosmaer's avatar Jacob Vosmaer

Remove queue code

parent d8f6193c
PRG = crowbx
OBJ = crowbx.o midi.o dac.o voice.o uart.o gate.o poly.o mono.o queue.o list.o
OBJ = crowbx.o midi.o dac.o voice.o uart.o gate.o poly.o mono.o list.o
MCU_TARGET = atmega328p
#MCU_TARGET = at90s2313
#MCU_TARGET = at90s2333
#include "queue.h"
q_advance(struct queue *q, uint8_t i)
return (i + 1) % (q->size + 1);
q_full(struct queue *q)
return q_advance(q, q->tail) == q->head;
q_enqueue(struct queue *q, uint8_t x)
if (q_full(q)) {
q->array[q->tail] = x;
q->tail = q_advance(q, q->tail);
q_empty(struct queue *q)
return q->tail == q->head;
q_dequeue(struct queue *q)
if (q_empty(q)) {
return q->size;
uint8_t x = q->array[q->head];
q->head = q_advance(q, q->head);
return x;
q_flush(struct queue *q)
q->head = 0;
q->tail = 0;
#ifndef _queue_h
#define _queue_h
#include <inttypes.h>
struct queue {
uint8_t head;
uint8_t tail;
uint8_t *array;
uint8_t size;
uint8_t q_full(struct queue *q);
void q_enqueue(struct queue *q, uint8_t x);
uint8_t q_empty(struct queue *q);
uint8_t q_dequeue(struct queue *q);
void q_flush(struct queue *q);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment