added debugging

Fork of BLE_nRF8001 by RedBearLab

Embed: (wiki syntax)

« Back to documentation index

hal_aci_tl

Module for the ACI Transport Layer interface. More...

Data Structures

struct  _aci_packed_
 aci_cmd_params_set_local_data_t More...
struct  aci_pins_t
 Datatype for ACI pins and interface (polling/interrupt) More...

Typedefs

typedef struct aci_pins_t aci_pins_t
 Datatype for ACI pins and interface (polling/interrupt)

Functions

void hal_aci_tl_init (aci_pins_t *a_pins, bool debug)
 ACI Transport Layer initialization.
bool hal_aci_tl_send (hal_aci_data_t *aci_buffer)
 Sends an ACI command to the radio.
hal_aci_data_t * hal_aci_tl_poll_get (void)
 Process pending transactions.
bool hal_aci_tl_event_get (hal_aci_data_t *p_aci_data)
 Get an ACI event from the event queue.
bool hal_aci_tl_event_peek (hal_aci_data_t *p_aci_data)
 Peek an ACI event from the event queue.
void hal_aci_tl_debug_print (bool enable)
 Enable debug printing of all ACI commands sent and ACI events received.
void hal_aci_tl_pin_reset (void)
 Pin reset the nRF8001.
bool hal_aci_tl_rx_q_full (void)
 Return full status of transmit queue.
bool hal_aci_tl_rx_q_empty (void)
 Return empty status of receive queue.
bool hal_aci_tl_tx_q_full (void)
 Return full status of receive queue.
bool hal_aci_tl_tx_q_empty (void)
 Return empty status of transmit queue.
void hal_aci_tl_q_flush (void)
 Flush the ACI command Queue and the ACI Event Queue.

Detailed Description

Module for the ACI Transport Layer interface.

This module is responsible for sending and receiving messages over the ACI interface of the nRF8001 chip. The hal_aci_tl_send_cmd() can be called directly to send ACI commands.

The RDYN line is hooked to an interrupt on the MCU when the level is low. The SPI master clocks in the interrupt context. The ACI Command is taken from the head of the command queue is sent over the SPI and the received ACI event is placed in the tail of the event queue.


Typedef Documentation

typedef struct aci_pins_t aci_pins_t

Datatype for ACI pins and interface (polling/interrupt)


Function Documentation

void hal_aci_tl_debug_print ( bool  enable )

Enable debug printing of all ACI commands sent and ACI events received.

when the enable parameter is true. The debug printing is enabled on the Serial. When the enable parameter is false. The debug printing is disabled on the Serial. By default the debug printing is disabled.

Definition at line 246 of file hal_aci_tl.cpp.

bool hal_aci_tl_event_get ( hal_aci_data_t *  p_aci_data )

Get an ACI event from the event queue.

Call this function from the main context to get an event from the ACI event queue This is called by lib_aci_event_get

Definition at line 290 of file hal_aci_tl.cpp.

bool hal_aci_tl_event_peek ( hal_aci_data_t *  p_aci_data )

Peek an ACI event from the event queue.

Call this function from the main context to peek an event from the ACI event queue. This is called by lib_aci_event_peek

Definition at line 275 of file hal_aci_tl.cpp.

void hal_aci_tl_init ( aci_pins_t a_pins,
bool  debug 
)

ACI Transport Layer initialization.

This function initializes the transport layer, including configuring the SPI, creating message queues for Commands and Events and setting up interrupt if required.

Parameters:
a_pinsPins on the MCU used to connect to the nRF8001
boolTrue if debug printing should be enabled on the Serial.

Definition at line 327 of file hal_aci_tl.cpp.

void hal_aci_tl_pin_reset ( void   )

Pin reset the nRF8001.

The reset line of the nF8001 needs to kept low for 200 ns. Redbearlab shield v1.1 and v2012.07 are exceptions as they have a Power ON Reset circuit that works differently. The function handles the exceptions based on the board_name in aci_pins_t

Definition at line 251 of file hal_aci_tl.cpp.

hal_aci_data_t* hal_aci_tl_poll_get ( void   )

Process pending transactions.

The library code takes care of calling this function to check if the nRF8001 RDYN line indicates a pending transaction. It will send a pending message if there is one and return any receive message that was pending.

Returns:
Points to data buffer for received data. Length byte in buffer is 0 if no data received.
void hal_aci_tl_q_flush ( void   )

Flush the ACI command Queue and the ACI Event Queue.

Call this function in the main thread

Definition at line 429 of file hal_aci_tl.cpp.

bool hal_aci_tl_rx_q_empty ( void   )

Return empty status of receive queue.

Definition at line 409 of file hal_aci_tl.cpp.

bool hal_aci_tl_rx_q_full ( void   )

Return full status of transmit queue.

Definition at line 414 of file hal_aci_tl.cpp.

bool hal_aci_tl_send ( hal_aci_data_t *  aci_buffer )

Sends an ACI command to the radio.

This function sends an ACI command to the radio. This queue up the message to send and lower the request line. When the device lowers the ready line, m_aci_spi_transfer() will send the data.

Parameters:
aci_bufferPointer to the message to send.
Returns:
True if the data was successfully queued for sending, false if there is no more space to store messages to send.

Definition at line 372 of file hal_aci_tl.cpp.

bool hal_aci_tl_tx_q_empty ( void   )

Return empty status of transmit queue.

Definition at line 419 of file hal_aci_tl.cpp.

bool hal_aci_tl_tx_q_full ( void   )

Return full status of receive queue.

Definition at line 424 of file hal_aci_tl.cpp.