upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
Go to the source code of this file.
Data Structures | |
struct | _aci_packed_ |
Structure for the ACI_CMD_SET_LOCAL_DATA ACI command parameters. More... | |
#define | HAL_ACI_MAX_LENGTH 31 |
Module for the ACI Transport Layer interface. More... | |
#define | UNUSED 255 |
ACI_ASSERT_SIZE (hal_aci_data_t, HAL_ACI_MAX_LENGTH+2) | |
void | hal_aci_tl_init (aci_pins_t *a_pins, bool debug) |
ACI Transport Layer initialization. More... | |
bool | hal_aci_tl_send (hal_aci_data_t *aci_buffer) |
Sends an ACI command to the radio. More... | |
bool | hal_aci_tl_event_get (hal_aci_data_t *p_aci_data) |
Process pending transactions. More... | |
bool | hal_aci_tl_event_peek (hal_aci_data_t *p_aci_data) |
Peek an ACI event from the event queue. More... | |
void | hal_aci_tl_debug_print (bool enable) |
Enable debug printing of all ACI commands sent and ACI events received. More... | |
void | hal_aci_tl_pin_reset (void) |
Pin reset the nRF8001. More... | |
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. More... | |
void hal_aci_tl_init | ( | aci_pins_t * | a_pins, |
bool | debug | ||
) |
This function initializes the transport layer, including configuring the SPI, creating message queues for Commands and Events and setting up interrupt if required.
a_pins | Pins on the MCU used to connect to the nRF8001 |
bool | True if debug printing should be enabled on the Serial. |
bool hal_aci_tl_send | ( | hal_aci_data_t * | aci_buffer | ) |
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.
aci_buffer | Pointer to the message to send. |
bool hal_aci_tl_event_get | ( | hal_aci_data_t * | p_aci_data | ) |
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.
Call this function from the main context to get an event from the ACI event queue This is called by lib_aci_event_get
bool hal_aci_tl_event_peek | ( | hal_aci_data_t * | p_aci_data | ) |
Call this function from the main context to peek an event from the ACI event queue. This is called by lib_aci_event_peek
void hal_aci_tl_debug_print | ( | bool | enable | ) |
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.
void hal_aci_tl_pin_reset | ( | void | ) |
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
void hal_aci_tl_q_flush | ( | void | ) |
Call this function in the main thread
#define HAL_ACI_MAX_LENGTH 31 |
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.