# queue01

queue01 - 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:
    queue01 = x -- put x into queue; block if queue is full
    x = queue01 -- read x from queue; block if queue is empty

    non-blocking access to the same queue is provided by
    queue01_nb_put()
    and
    queue01_nb_get()

    other methods:
    queue01_clear()    -- clear queue (makes queue empty)
    queue01_empty()    -- returns true if queue is emtpy (depricated, use queue1_is_empty())
    queue01_is_empty() -- returns true if queue is emtpy
    queue01_is_full()  -- returns true if queue is full
    queue01_nr_free()  -- returns nr of free places in queue
    queue01_nr_used()  -- returns nr of used places in queue

    Option:
    const queue01_element_size = n ; define Queue elements are n bytes wide (default is one byte)

Dependencies

No dependency found

## Summary

### Global variables/contants

- `var volatile byte queue01_out_pointer = 0 ; wijst naar databyte`
- `var volatile byte*queue01_element_size queue01_data[queue01_size + 1]`
- `var volatile byte queue01_in_pointer = 0 ; wijst naar vrije locatie`

### Procedures

- `queue01_nb'put(byte*queue01_element_size in v)`
- `queue01'put(byte*queue01_element_size in v)`
- `queue01_clear()`

### Functions

- `queue01_nb_put(byte*queue01_element_size in v) return bit`
- `queue01_nb'get() return byte*queue01_element_size`
- `queue01_empty() return bit`
- `queue01_is_empty() return bit`
- `queue01_nr_used() return byte`
- `queue01_is_full() return bit`
- `queue01_nr_free() return byte`
- `queue01_nb_get(byte*queue01_element_size out v) return bit`
- `queue01'get() return byte*queue01_element_size`

## API details

### Global variables/contants

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

  No documentation found

- `var volatile byte*queue01_element_size queue01_data[queue01_size + 1]`

      queue vars

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

  No documentation found

### Procedures

- `queue01_nb'put(byte*queue01_element_size in v)`

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

- `queue01'put(byte*queue01_element_size in v)`

      queue01'put - put one byte into queue

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

- `queue01_clear()`

      deprecated

### Functions

- `queue01_nb_put(byte*queue01_element_size in v) return bit`

      queue01_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)

- `queue01_nb'get() return byte*queue01_element_size`

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

      returns byte from queue, 0 if queue empty

- `queue01_empty() return bit`

- `queue01_is_empty() return bit`

      queue01_is_empty() -- returns true if queue is emtpy

- `queue01_nr_used() return byte`

      queue01_nr_used - returns nr of used places in queue

- `queue01_is_full() return bit`

      queue01_is_full()  -- returns true if queue is full

- `queue01_nr_free() return byte`

      queue01_nr_free - returns nr of free places in queue

- `queue01_nb_get(byte*queue01_element_size out v) return bit`

      queue01_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)

- `queue01'get() return byte*queue01_element_size`

      queue01'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.

## Related samples

Here are the list of samples which use this library:

16f648a | 16f648a_queue.jal
16f723 | 16f723_queue.jal
16f723 | 16f723_i2c_hw_slave_eeprom_simulator.jal
16f73 | 16f73_queue.jal
16f73 | 16f73_i2c_hw_slave_eeprom_simulator.jal
16f877 | 16f877_slip_isr.jal
16f877 | 16f877_i2c_hw_slave_eeprom_simulator.jal
16f877 | 16f877_slip_poll.jal
16f877 | 16f877_queue.jal
16f877a | 16f877a_slip_isr.jal
16f877a | 16f877a_slip_poll.jal
16f877a | 16f877a_i2c_hw_slave_eeprom_simulator.jal
16f877a | 16f877a_queue.jal
16f88 | 16f88_queue.jal
16f88 | 16f88_i2c_hw_slave_eeprom_simulator.jal
18f14k50 | 18f14k50_i2c_hw_slave_eeprom_simulator.jal
18f14k50 | 18f14k50_queue.jal
18f2450 | 18f2450_queue.jal
18f2520 | 18f2520_i2c_hw_slave_eeprom_simulator.jal
18f2520 | 18f2520_queue.jal
18f2550 | 18f2550_i2c_hw_slave_eeprom_simulator.jal
18f2550 | 18f2550_queue.jal
18f2620 | 18f2620_queue.jal
18f2620 | 18f2620_i2c_hw_slave_eeprom_simulator.jal
18f452 | 18f452_queue.jal
18f452 | 18f452_i2c_hw_slave_eeprom_simulator.jal
18f4525 | 18f4525_slip_isr.jal
18f4525 | 18f4525_slip_poll.jal
18f4550 | 18f4550_i2c_hw_slave_eeprom_simulator.jal
18f4550 | 18f4550_slip_poll_usb.jal
18f4550 | 18f4550_queue.jal
18f4550 | 18f4550_slip_poll.jal
18f4550 | 18f4550_slip_isr.jal
18f4620 | 18f4620_queue.jal
18f4620 | 18f4620_network_slip_isr_ping_udp.jal
18f4620 | 18f4620_slip_poll.jal
18f4620 | 18f4620_slip_isr.jal
18f4620 | 18f4620_i2c_hw_slave_eeprom_simulator.jal
18f46k22 | 18f46k22_slip_isr.jal
18f46k22 | 18f46k22_slip_poll.jal
18f67j50 | 18f67j50_i2c_hw_slave_eeprom_simulator.jal
18f67j50 | 18f67j50_slip_poll.jal
18f67j50 | 18f67j50_queue.jal
18f67j50 | 18f67j50_slip_isr.jal
18f67j50 | 18f67j50_slip_poll_usb.jal