mbed HRM11017を使ってkonashi.jsでナイトライダー

Dependencies:   BLE_API_Native_IRC mbed

Fork of BLE_RCBController by Junichi Katsu

Embed: (wiki syntax)

« Back to documentation index

FIFO implementation

FIFO implementation

FIFO implementation. More...

Data Structures

struct  app_fifo_t
 A FIFO instance structure. More...

Functions

uint32_t app_fifo_init (app_fifo_t *p_fifo, uint8_t *p_buf, uint16_t buf_size)
 Function for initializing the FIFO.
uint32_t app_fifo_put (app_fifo_t *p_fifo, uint8_t byte)
 Function for adding an element to the FIFO.
uint32_t app_fifo_get (app_fifo_t *p_fifo, uint8_t *p_byte)
 Function for getting the next element from the FIFO.
uint32_t app_fifo_flush (app_fifo_t *p_fifo)
 Function for flushing the FIFO.

Detailed Description

FIFO implementation.


Function Documentation

uint32_t app_fifo_flush ( app_fifo_t p_fifo )

Function for flushing the FIFO.

Parameters:
[in]p_fifoPointer to the FIFO.
Return values:
NRF_SUCCESSIf the FIFO flushed successfully.
uint32_t app_fifo_get ( app_fifo_t p_fifo,
uint8_t *  p_byte 
)

Function for getting the next element from the FIFO.

Parameters:
[in]p_fifoPointer to the FIFO.
[out]p_byteByte fetched from the FIFO.
Return values:
NRF_SUCCESSIf an element was returned.
NRF_ERROR_NOT_FOUNDIf there is no more elements in the queue.
uint32_t app_fifo_init ( app_fifo_t p_fifo,
uint8_t *  p_buf,
uint16_t  buf_size 
)

Function for initializing the FIFO.

Parameters:
[out]p_fifoFIFO object.
[in]p_bufFIFO buffer for storing data. The buffer size has to be a power of two.
[in]buf_sizeSize of the FIFO buffer provided, has to be a power of 2.
Return values:
NRF_SUCCESSIf initialization was successful.
NRF_ERROR_NULLIf a NULL pointer is provided as buffer.
NRF_ERROR_INVALID_LENGTHIf size of buffer provided is not a power of two.
uint32_t app_fifo_put ( app_fifo_t p_fifo,
uint8_t  byte 
)

Function for adding an element to the FIFO.

Parameters:
[in]p_fifoPointer to the FIFO.
[in]byteData byte to add to the FIFO.
Return values:
NRF_SUCCESSIf an element has been successfully added to the FIFO.
NRF_ERROR_NO_MEMIf the FIFO is full.