# queue04

queue04 - fifo queue (number 01 is the template)

Author | Joep Suijs, Copyright © 2009, all rights reserved.
Adapted-by |
Compiler | >=2.4i

Description

    this library provides a (one) byte fifo queue.
    This queue is interrupt-safe in the sense that you can write to the queue from the interrupt and
    read from the main program or vice versa without special precautions.
    Reading (or writing) from both interrupt and main program might not work properly.

    The basic interface is pseudo var:
    queue04 = x -- put x into queue; block if queue is full
    x = queue04 -- read x from queue; block if queue is empty

    non-blocking access to the same queue is provided by
    queue04_nb_put()
    and
    queue04_nb_get()

    other methods:
    queue04_clear()    -- clear queue (makes queue empty)
    queue04_empty()    -- returns true if queue is emtpy (depricated, use queue1_is_empty())
    queue04_is_empty() -- returns true if queue is emtpy
    queue04_is_full()  -- returns true if queue is full
    queue04_nr_free()  -- returns nr of free places in queue
    queue04_nr_used()  -- returns nr of used places in queue

Dependencies

No dependency found

## Summary

### Global variables/contants

- `var volatile byte queue04_in_pointer = 0 ; wijst naar vrije locatie`
- `var volatile byte queue04_data[queue04_size + 1]`
- `var volatile byte queue04_out_pointer = 0 ; wijst naar databyte`

### Procedures

- `queue04'put(byte in v)`
- `queue04_nb'put(byte in v)`
- `queue04_clear()`

### Functions

- `queue04_nr_free() return byte`
- `queue04_empty() return bit`
- `queue04_is_full() return bit`
- `queue04_nb'get() return byte`
- `queue04_nr_used() return byte`
- `queue04_is_empty() return bit`
- `queue04_nb_get(byte out v) return bit`
- `queue04'get() return byte`
- `queue04_nb_put(byte in v) return bit`

## API details

### Global variables/contants

- `var volatile byte queue04_in_pointer = 0 ; wijst naar vrije locatie`

  No documentation found

- `var volatile byte queue04_data[queue04_size + 1]`

      queue vars

- `var volatile byte queue04_out_pointer = 0 ; wijst naar databyte`

  No documentation found

### Procedures

- `queue04'put(byte in v)`

      queue04'put - put one byte into queue

      When the queue is full, it waits until a byte is removed from the queue.

- `queue04_nb'put(byte in v)`

      queue04_nb'put - put one byte into queue (non-blocking)

- `queue04_clear()`

      deprecated

### Functions

- `queue04_nr_free() return byte`

      queue04_nr_free - returns nr of free places in queue

- `queue04_empty() return bit`

- `queue04_is_full() return bit`

      queue04_is_full()  -- returns true if queue is full

- `queue04_nb'get() return byte`

      queue04_nb'get - get one byte from queue (non-blocking)

      returns byte from queue, 0 if queue empty

- `queue04_nr_used() return byte`

      queue04_nr_used - returns nr of used places in queue

- `queue04_is_empty() return bit`

      queue04_is_empty() -- returns true if queue is emtpy

- `queue04_nb_get(byte out v) return bit`

      queue04_nb_get - get one byte from queue (non-blocking)

      The byte read is put into v (calling param)
      returns: true  when we read a byte from the queue
      false when the queue is empty (byte is not read from queue)

- `queue04'get() return byte`

      queue04'get - get one byte from queue

      returns byte from queue.
      When the queue is empty, it waits until a byte is put into the queue.

- `queue04_nb_put(byte in v) return bit`

      queue04_nb_put - put one byte into queue (non-blocking)

      return:  true  when the byte is put into the queue
      false when the queue is full (byte is not put in queue)

## Related samples

No sample found