Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_nRF8001 by
lib_aci.h
00001 /* Copyright (c) 2014, Nordic Semiconductor ASA 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy 00004 * of this software and associated documentation files (the "Software"), to deal 00005 * in the Software without restriction, including without limitation the rights 00006 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00007 * copies of the Software, and to permit persons to whom the Software is 00008 * furnished to do so, subject to the following conditions: 00009 * 00010 * The above copyright notice and this permission notice shall be included in all 00011 * copies or substantial portions of the Software. 00012 * 00013 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00014 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00015 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00016 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00017 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00018 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00019 * SOFTWARE. 00020 */ 00021 00022 #ifndef LIB_ACI_H__ 00023 #define LIB_ACI_H__ 00024 00025 /** @file 00026 * @brief ACI library 00027 */ 00028 00029 /** @addtogroup lib_aci 00030 @{ 00031 @brief Library for the logical part of the Application Controller Interface (ACI) 00032 */ 00033 00034 #include "hal_platform.h " 00035 #include "hal_aci_tl.h" 00036 #include "aci_queue.h" 00037 #include "aci.h " 00038 #include "aci_cmds.h" 00039 #include "aci_evts.h" 00040 00041 00042 #define EVT_CMD_RESPONSE_MIN_LENGTH 3 00043 00044 #define PIPES_ARRAY_SIZE ((ACI_DEVICE_MAX_PIPES + 7)/8) 00045 00046 /* Same size as a hal_aci_data_t */ 00047 typedef struct { 00048 uint8_t debug_byte; 00049 aci_evt_t evt; 00050 } _aci_packed_ hal_aci_evt_t; 00051 00052 ACI_ASSERT_SIZE(hal_aci_evt_t, 34); 00053 00054 typedef struct 00055 { 00056 uint8_t location; /**< enum aci_pipe_store_t */ 00057 aci_pipe_type_t pipe_type; 00058 } services_pipe_type_mapping_t; 00059 00060 typedef struct aci_setup_info_t 00061 { 00062 services_pipe_type_mapping_t *services_pipe_type_mapping; 00063 uint8_t number_of_pipes; 00064 hal_aci_data_t *setup_msgs; 00065 uint8_t num_setup_msgs; 00066 } aci_setup_info_t; 00067 00068 00069 00070 // aci_struct that will contain 00071 // total initial credits 00072 // current credit 00073 // current state of the aci (setup/standby/active/sleep) 00074 // open remote pipe pending 00075 // close remote pipe pending 00076 // Current pipe available bitmap 00077 // Current pipe closed bitmap 00078 // Current connection interval, slave latency and link supervision timeout 00079 // Current State of the the GATT client (Service Discovery status) 00080 // Relationship of bond to peer address 00081 typedef struct aci_state_t 00082 { 00083 aci_pins_t aci_pins; /* Pins on the MCU used to connect to the nRF8001 */ 00084 aci_setup_info_t aci_setup_info; /* Data structures that are created from nRFgo Studio */ 00085 uint8_t bonded; /* ( aci_bond_status_code_t ) Is the nRF8001 bonded to a peer device */ 00086 uint8_t data_credit_total; /* Total data credit available for the specific version of the nRF8001, total equals available when a link is established */ 00087 aci_device_operation_mode_t device_state; /* Operating mode of the nRF8001 */ 00088 00089 /* */ 00090 00091 /* Start : Variables that are valid only when in a connection */ 00092 uint8_t data_credit_available; /* Available data credits at a specific point of time, ACI_EVT_DATA_CREDIT updates the available credits */ 00093 00094 uint16_t connection_interval; /* Multiply by 1.25 to get the connection interval in milliseconds*/ 00095 uint16_t slave_latency; /* Number of consecutive connection intervals that the nRF8001 is not required to transmit. Use this to save power */ 00096 uint16_t supervision_timeout; /* Multiply by 10 to get the supervision timeout in milliseconds */ 00097 00098 uint8_t pipes_open_bitmap[PIPES_ARRAY_SIZE]; /* Bitmap -> pipes are open and can be used for sending data over the air */ 00099 uint8_t pipes_closed_bitmap[PIPES_ARRAY_SIZE]; /* Bitmap -> pipes are closed and cannot be used for sending data over the air */ 00100 bool confirmation_pending; /* Attribute protocol Handle Value confirmation is pending for a Handle Value Indication 00101 (ACK is pending for a TX_ACK pipe) on local GATT Server*/ 00102 /* End : Variables that are valid only when in a connection */ 00103 00104 } aci_state_t; 00105 00106 00107 00108 #define DISCONNECT_REASON_CX_TIMEOUT 0x08 00109 #define DISCONNECT_REASON_CX_CLOSED_BY_PEER_DEVICE 0x13 00110 #define DISCONNECT_REASON_POWER_LOSS 0x14 00111 #define DISCONNECT_REASON_CX_CLOSED_BY_LOCAL_DEVICE 0x16 00112 #define DISCONNECT_REASON_ADVERTISER_TIMEOUT 0x50 00113 00114 00115 /** @name Functions for library management */ 00116 //@{ 00117 00118 /** @brief Function to enable printing of all ACI commands sent and ACI events received 00119 * @details This function shall be used to enable or disable the debug printing. 00120 Debug printing is disabled by default. 00121 */ 00122 void lib_aci_debug_print(bool enable); 00123 00124 /** @brief Function to pin reset the nRF8001 00125 * @details Pin resets the nRF8001 also handles differences between development boards 00126 */ 00127 void lib_aci_pin_reset(void); 00128 00129 /** @brief Initialization function. 00130 * @details This function shall be used to initialize/reset ACI Library and also Resets the 00131 * nRF8001 by togging the reset pin of the nRF8001. This function will reset 00132 * all the variables locally used by ACI library to their respective default values. 00133 * @param bool True if the data was successfully queued for sending, 00134 * false if there is no more space to store messages to send. 00135 */ 00136 void lib_aci_init(aci_state_t *aci_stat, bool debug); 00137 00138 00139 /** @brief Gets the number of currently available ACI credits. 00140 * @return Number of ACI credits. 00141 */ 00142 uint8_t lib_aci_get_nb_available_credits(aci_state_t *aci_stat); 00143 00144 /** @brief Gets the connection interval in milliseconds. 00145 * @return Connection interval in milliseconds. 00146 */ 00147 uint16_t lib_aci_get_cx_interval_ms(aci_state_t *aci_stat); 00148 00149 /** @brief Gets the connection interval in multiple of 1.25 ms. 00150 * @return Connection interval in multiple of 1.25 ms. 00151 */ 00152 uint16_t lib_aci_get_cx_interval(aci_state_t *aci_stat); 00153 00154 /** @brief Gets the current slave latency. 00155 * @return Current slave latency. 00156 */ 00157 uint16_t lib_aci_get_slave_latency(aci_state_t *aci_stat); 00158 00159 /** @brief Checks if a given pipe is available. 00160 * @param pipe Pipe to check. 00161 * @return True if the pipe is available, otherwise false. 00162 */ 00163 bool lib_aci_is_pipe_available(aci_state_t *aci_stat, uint8_t pipe); 00164 00165 /** @brief Checks if a given pipe is closed. 00166 * @param pipe Pipe to check. 00167 * @return True if the pipe is closed, otherwise false. 00168 */ 00169 bool lib_aci_is_pipe_closed(aci_state_t *aci_stat, uint8_t pipe); 00170 00171 /** @brief Checks if the discovery operation is finished. 00172 * @return True if the discovery is finished. 00173 */ 00174 bool lib_aci_is_discovery_finished(aci_state_t *aci_stat); 00175 00176 00177 00178 //@} 00179 00180 /** @name ACI Commands available in all modes */ 00181 //@{ 00182 00183 /** @brief Sets the radio in sleep mode. 00184 * @details The function sends a @c sleep command to the radio. 00185 * If the radio is advertising or connected, it sends back an error, then use lib_aci_radio_reset 00186 * if advertising or disconnect if in a connection. 00187 * @return True if the transaction is successfully initiated. 00188 */ 00189 bool lib_aci_sleep(void); 00190 00191 /** @brief Resets the radio. 00192 * @details The function sends a @c BasebandReset command to the radio. 00193 * @return True if the transaction is successfully initiated. 00194 */ 00195 bool lib_aci_radio_reset(void); 00196 00197 /** @brief Radio starts directed advertising to bonded device. 00198 * @details The function sends a @c DirectedConnect command to the radio. 00199 * @return True if the transaction is successfully initiated. 00200 */ 00201 bool lib_aci_direct_connect(void); 00202 00203 /** @brief Gets the radio's version. 00204 * @details This function sends a @c GetDeviceVersion command. 00205 * @return True if the transaction is successfully initiated. 00206 */ 00207 bool lib_aci_device_version(void); 00208 00209 /** @brief Gets the device address. 00210 * @details This function sends a @c GetDeviceAddress command. 00211 * @return True if the transaction is successfully initiated. 00212 */ 00213 bool lib_aci_get_address(void); 00214 00215 /** @brief Gets the temperature. 00216 * @details This function sends a @c GetTemperature command. lib_aci 00217 * calls the @ref lib_aci_transaction_finished_hook() function when the temperature is received. 00218 * @return True if the transaction is successfully initiated. 00219 */ 00220 bool lib_aci_get_temperature(void); 00221 00222 /** @brief Gets the battery level. 00223 * @details This function sends a @c GetBatteryLevel command. 00224 * @return True if the transaction is successfully initiated. 00225 */ 00226 bool lib_aci_get_battery_level(void); 00227 00228 //@} 00229 00230 /** @name ACI commands available in Sleep mode */ 00231 //@{ 00232 00233 /** @brief Wakes up the radio. 00234 * @details This function sends a @c Wakeup command to wake up the radio from 00235 * sleep mode. When woken up the radio sends a @c DeviceStartedEvent and 00236 * a @c CommandResponseEvent. 00237 * @return True if the transaction is successfully initiated. 00238 */ 00239 bool lib_aci_wakeup(void); 00240 00241 //@} 00242 00243 /** @name ACI commands available in Active mode */ 00244 //@{ 00245 00246 /** @brief Sets the radio in test mode. 00247 * @details This function sends a @c Test command to the radio. There are two 00248 * Test modes available: 00249 * - UART: DTM commands are received over UART. 00250 * - ACI: DTM commands are received over ACI. 00251 * The same command is used to exit the test mode When receiving 00252 * a @c DeviceStartedEvent the radio has entered the new mode. 00253 * @param enter_exit_test_mode Enter a Test mode, or exit Test mode. 00254 * @return True if the transaction is successfully initiated. 00255 */ 00256 bool lib_aci_test(aci_test_mode_change_t enter_exit_test_mode); 00257 00258 /** @brief Sets the radio's TX power. 00259 * @details This function sends a @c SetTxPower command. 00260 * @param tx_power TX power to be used by the radio. 00261 * @return True if the transaction is successfully initiated. 00262 */ 00263 bool lib_aci_set_tx_power(aci_device_output_power_t tx_power); 00264 00265 /** @brief Tries to connect to a peer device. 00266 * @details This function sends a @c Connect command to the radio. 00267 * @param run_timeout Maximum advertising time in seconds (0 means infinite). 00268 * @param adv_interval Advertising interval (in multiple of 0.625 ms). 00269 * @return True if the transaction is successfully initiated. 00270 */ 00271 bool lib_aci_connect(uint16_t run_timeout, uint16_t adv_interval); 00272 00273 /** @brief Tries to bond with a peer device. 00274 * @details This function sends a @c Bond command to the radio. 00275 * @param run_timeout Maximum advertising time in seconds (0 means infinite). 00276 * @param adv_interval Advertising interval (in multiple of 0.625 ms). 00277 * @return True if the transaction is successfully initiated. 00278 */ 00279 bool lib_aci_bond(uint16_t run_timeout, uint16_t adv_interval); 00280 00281 /** @brief Disconnects from peer device. 00282 * @details This function sends a @c Disconnect command to the radio. 00283 * @param reason Reason for disconnecting. 00284 * @return True if the transaction is successfully initiated. 00285 */ 00286 bool lib_aci_disconnect(aci_state_t *aci_stat, aci_disconnect_reason_t reason); 00287 00288 /**@brief Sets Local Data. 00289 * @details 00290 * This command updates the value of the characteristic value or the characteristic descriptor stored locally on the device. 00291 * Can be called for all types of pipes as long as the data is stored locally. 00292 * @param ACI state structure 00293 * @param pipe Pipe number on which the data should be set. 00294 * @param value Pointer to the data to set. 00295 * @param size Size of the data to set. 00296 * @return True if the transaction is successfully initiated. 00297 */ 00298 bool lib_aci_set_local_data(aci_state_t *aci_stat, uint8_t pipe, uint8_t *value, uint8_t size); 00299 00300 /** @brief Sends Broadcast message to the radio. 00301 * @details The Broadcast message starts advertisement procedure 00302 * using the given interval with the intention of broadcasting data to a peer device. 00303 * @param timeout Time, in seconds, to advertise before exiting to standby mode (0 means infinite). 00304 * Valid values: 0 to 16383. 00305 * @param adv_interval Advertising interval (in multiple of 0.625 ms). 00306 * Valid values: 160 to 16384 (which corresponds to an interval from 100 ms to 10.24 s). 00307 * @return True if the broadcast message is sent successfully to the radio. 00308 */ 00309 bool lib_aci_broadcast(const uint16_t timeout, const uint16_t adv_interval); 00310 00311 /** @name Open Advertising Pipes. */ 00312 00313 /** @brief Sends a command to the radio to set the input pipe to be placed in Advertisement Service Data. 00314 * @details This function sends a command to the radio that places the pipe in 00315 * advertisement service data. To start advertising service data, call this function before 00316 * Connecting, Broadcasting or Bonding to peer. The data that should be sent in the advertisement packets 00317 * must be set using the @c lib_aci_set_local_data function. This function can be called during 00318 * advertising to enable/disable broadcast pipes. 00319 * @param pipe The pipe that has to be placed in advertising service data. 00320 * @return True if the Open Adv Pipe message is sent successfully to the radio. 00321 */ 00322 bool lib_aci_open_adv_pipe(const uint8_t pipe); 00323 00324 00325 /** @name Open Advertising Pipes */ 00326 00327 /** @brief Sends a command to the radio to set the pipes to be placed in Advertisement Service Data. 00328 * @details This function will send a command to the radio that will set the pipes to be placed in 00329 * advertisement Service Data. To start advertising service data, this function should be called before 00330 * Connecting, Broadcasting or Bonding to peer. This function can be called during 00331 * advertising to enable/disable broadcast pipes. Use this as an alternative to @ref lib_aci_open_adv_pipe 00332 * to avoid multiple function calls for placing multiple pipes in the adv data. 00333 * @param adv_service_data_pipes Pipe bitmap, where '1' indicates that the corresponding 00334 * Valid Values: 0000000000000000 to FEFFFFFFFFFFFF7F (See the ACI Pipe Status Evt bitmap in the nRF8001 datasheet 00335 * TX_BROADCAST pipe data is to be placed in Advertising Service Data fields 00336 * @return true if the Open Adv Pipe message was sent successfully to the radio. 00337 */ 00338 bool lib_aci_open_adv_pipes(const uint8_t * const adv_service_data_pipes); 00339 00340 00341 //@} 00342 00343 /** @name ACI commands available in Connected mode */ 00344 //@{ 00345 00346 00347 /** @brief Sets a given application latency. 00348 * @details This function sends a @c setApplicationLatency command. 00349 * @return True if the transaction is successfully initiated. 00350 */ 00351 bool lib_aci_set_app_latency(uint16_t latency, aci_app_latency_mode_t latency_mode); 00352 00353 /** @brief Opens a remote pipe. 00354 * @details This function sends an @c OpenRemotePipe command. 00355 * @param pipe Number of the pipe to open. 00356 * @return True if the transaction is successfully initiated. 00357 */ 00358 bool lib_aci_open_remote_pipe(aci_state_t *aci_stat, uint8_t pipe); 00359 00360 /** @brief Closes a remote pipe. 00361 * @details This function sends an @c CloseRemotePipe command. 00362 * @param pipe Pipe number to close. 00363 * @return True if the transaction is successfully initiated. 00364 */ 00365 bool lib_aci_close_remote_pipe(aci_state_t *aci_stat, uint8_t pipe); 00366 00367 /** @brief Sends data on a given pipe. 00368 * @details This function sends a @c SendData command with application data to 00369 * the radio. This function memorizes credit use, and checks that 00370 * enough credits are available. 00371 * @param pipe Pipe number on which the data should be sent. 00372 * @param value Pointer to the data to send. 00373 * @param size Size of the data to send. 00374 * @return True if the transaction is successfully initiated. 00375 */ 00376 bool lib_aci_send_data(uint8_t pipe, uint8_t *value, uint8_t size); 00377 00378 /** @brief Requests data from a given pipe. 00379 * @details This function sends a @c RequestData command to the radio. This 00380 * function memorizes credit uses, and check that enough credits are available. 00381 * After this command, the radio sends back either a @c DataReceivedEvent 00382 * or a @c PipeErrorEvent. 00383 * @param pipe Pipe number on which the data is requested. 00384 * @return True if the transaction is successfully initiated. 00385 */ 00386 bool lib_aci_request_data(aci_state_t *aci_stat, uint8_t pipe); 00387 00388 /** @brief Sends a L2CAP change connection parameters request. 00389 * @details This function sends a @c ChangeTiming command to the radio. This command triggers a "L2CAP change connection parameters" request 00390 * to the master. If the master rejects or accepts but doesn't change the connection parameters within 00391 * 30 seconds, a timing event with the unchanged connection parameters is sent by the radio. 00392 * If the request is accepted and the master changes connection parameters, a timing event with 00393 * the new connection parameters is sent by the radio. 00394 * If the master doesn't reply to the request within 60 seconds, the radio disconnects. 00395 * @param minimun_cx_interval Minimum connection interval requested, in multiple of 1.25 ms. 00396 * @param maximum_cx_interval Maximum connection interval requested, in multiple of 1.25 ms. 00397 * @param slave_latency requested slave latency. 00398 * @param timeout requested slave timeout, in multiple of 10 ms. 00399 * @return True if the transaction is successfully initiated. 00400 */ 00401 bool lib_aci_change_timing(uint16_t minimun_cx_interval, uint16_t maximum_cx_interval, uint16_t slave_latency, uint16_t timeout); 00402 00403 /** @brief Sends a L2CAP change connection parameters request with the connection predefined preffered connection parameters. 00404 * @details This function sends a @c ChangeTiming command to the radio. This command triggers a "L2CAP change connection parameters" request 00405 * to the master. If the master rejects or accepts but doesn't change the connection parameters within 00406 * 30 seconds, a timing event with the unchanged connection parameters is sent by the radio. 00407 * If the request is accepted and the master changes connection parameters, a timing event with 00408 * the new connection parameters is sent by the radio. 00409 * If the master doesn't reply to the request within 60 seconds, the radio disconnects. 00410 * The timing parameters used are the Timing parameters in the GAP settings in the nRFgo Studio. 00411 * The Timing parameters as stored as the GAP Preferred Peripheral Connection Parameters. 00412 * @return True if the transaction is successfully initiated. 00413 */ 00414 bool lib_aci_change_timing_GAP_PPCP(void); 00415 00416 /** @brief Sends acknowledgement message to peer. 00417 * @details This function sends @c SendDataAck command to radio. The radio is expected 00418 * to send either Handle Value Confirmation or Write response depending 00419 * on whether the data is stored remotely or locally. 00420 * @param pipe Pipe number for which the acknowledgement is to be sent. 00421 * @return True if the ack was sent successfully. False otherwise. 00422 */ 00423 bool lib_aci_send_ack(aci_state_t *aci_stat, const uint8_t pipe); 00424 00425 /** @brief Sends negative acknowledgement message to peer. 00426 * @details This function sends @c SendDataNack command to radio. The radio is expected 00427 * to send Error Response to the peer. 00428 * @param pipe Pipe number for which the nack is to be sent. 00429 * @param error_code Error code to be sent in the NACk. 00430 * @return True if the nack was sent successfully. False otherwise. 00431 */ 00432 bool lib_aci_send_nack(aci_state_t *aci_stat, const uint8_t pipe, const uint8_t error_code); 00433 00434 /** @brief Sends ReadDynamicData command to the host. 00435 * @details This function sends @c ReadDynamicData command to host. The host is expected 00436 * to send @c CommandResponse back with the dynamic data. The application is expected to 00437 * call this function in a loop until all the dynamic data is read out from the host. 00438 * As long as there is dynamic data to be read from the host, the command response 00439 * for this message has its status field set to ACI_STATUS_TRANSACTION_CONTINUE (0x01). 00440 * The application may chose to store this read out data in a non-volatile memory location 00441 * and later chose to write it back using the function lib_aci_write_dynamic_data. 00442 * @return True if the command was sent successfully through the ACI. False otherwise. 00443 */ 00444 bool lib_aci_read_dynamic_data(void); 00445 00446 /** @brief Sends WriteDynamicData command to the host. 00447 * @details This function sends @c WriteDynamicData command to host. The host is expected 00448 * to send @c CommandResponse with the status of this operation. As long as the status field 00449 * in the @c CommandResponse is ACI_STATUS_TRANSACTION_CONTINUE (0x01), the hosts expects 00450 * more dynamic data to be written. This function should ideally be called in a cycle, 00451 * until all the stored dynamic data is sent to the host. This function should be 00452 * called with the dynamic data obtained from the response to a @c ReadDynamicData 00453 * (see @c lib_aci_read_dynamic_data) command. 00454 * @param sequence_number Sequence number of the dynamic data to be sent. 00455 * @param dynamic_data Pointer to the dynamic data. 00456 * @param length Length of the dynamic data. 00457 * @return True if the command was sent successfully through the ACI. False otherwise. 00458 */ 00459 bool lib_aci_write_dynamic_data(uint8_t sequence_number, uint8_t* dynamic_data, uint8_t length); 00460 //@} 00461 00462 /** @name ACI commands available while connected in Bond mode */ 00463 //@{ 00464 00465 /** @brief Sends a SMP Security Request. 00466 * @details This function send a @c BondRequest command to the radio. 00467 * This command triggers a SMP Security Request to the master. If the 00468 * master rejects with a pairing failed or if the bond timer expires the connection is closed. 00469 * @return True if the transaction is successfully initiated. 00470 */ 00471 bool lib_aci_bond_request(void); 00472 00473 /** @brief Set the key requested by the 8001. 00474 * @details This function sends an @c SetKey command to the radio. 00475 * @param key_rsp_type Type of key. 00476 * @param key Pointer to the key to set. 00477 * @param len Length of the key. 00478 * @return True if the transaction is successfully initiated. 00479 */ 00480 bool lib_aci_set_key(aci_key_type_t key_rsp_type, uint8_t *key, uint8_t len); 00481 00482 //@} 00483 00484 00485 00486 /** @name ACI commands available in Test mode */ 00487 //@{ 00488 00489 /** @brief Sends an echo message 00490 * @details This function sends an @c Echo command to the radio. lib_aci 00491 * places the Echp ACI command in the ACI command queue 00492 * @param message_size Length of the data to send. 00493 * @param message_data Pointer to the data to send. 00494 * @return True if the transaction is successfully initiated. 00495 */ 00496 bool lib_aci_echo_msg(uint8_t message_size, uint8_t *message_data); 00497 00498 /** @brief Sends an DTM command 00499 * @details This function sends an @c DTM command to the radio. 00500 * @param dtm_command_msbyte Most significant byte of the DTM command. 00501 * @param dtm_command_lsbyte Least significant byte of the DTM command. 00502 * @return True if the transaction is successfully initiated. 00503 */ 00504 bool lib_aci_dtm_command(uint8_t dtm_command_msbyte, uint8_t dtm_command_lsbyte); 00505 00506 /** @brief Gets an ACI event from the ACI Event Queue 00507 * @details This function gets an ACI event from the ACI event queue. 00508 * The queue is updated by the SPI driver for the ACI running in the interrupt context 00509 * @param aci_stat pointer to the state of the ACI. 00510 * @param p_aci_data pointer to the ACI Event. The ACI Event received will be copied into this pointer. 00511 * @return True if an ACI Event was copied to the pointer. 00512 */ 00513 bool lib_aci_event_get(aci_state_t *aci_stat, hal_aci_evt_t * aci_evt); 00514 00515 /** @brief Peeks an ACI event from the ACI Event Queue 00516 * @details This function peeks at the top event in the ACI event queue. 00517 * In polling mode, this function will query the nRF8001 for pending events, but unlike 00518 * lib_aci_event_get() it will not dequeue the event from the local queue, but will instead 00519 * only peek at it. 00520 * @return True if an ACI Event was copied to the pointer. 00521 */ 00522 bool lib_aci_event_peek(hal_aci_evt_t *p_aci_evt_data); 00523 00524 /** @brief Flushes the events in the ACI command queues and ACI Event queue 00525 * 00526 */ 00527 void lib_aci_flush(void); 00528 00529 /** @brief Return full status of the Event queue 00530 * @details 00531 * 00532 */ 00533 bool lib_aci_event_queue_full(void); 00534 00535 /** @brief Return empty status of the Event queue 00536 * @details 00537 * 00538 */ 00539 bool lib_aci_event_queue_empty(void); 00540 00541 /** @brief Return full status of Command queue 00542 * @details 00543 * 00544 */ 00545 bool lib_aci_command_queue_full(void); 00546 00547 /** @brief Return empty status of Command queue 00548 * @details 00549 * 00550 */ 00551 bool lib_aci_command_queue_empty(void); 00552 00553 //@} 00554 00555 /** @} */ 00556 00557 #endif /* LIB_ACI_H__ */
Generated on Tue Jul 12 2022 15:15:46 by
1.7.2
