To get started with Seeed Tiny BLE, include detecting motion, button and battery level.
Dependencies: BLE_API eMPL_MPU6050 mbed nRF51822
nRF51822/nordic-sdk/components/drivers_nrf/hal/nrf_ecb.h@1:fc2f9d636751, 2015-04-22 (annotated)
- Committer:
- yihui
- Date:
- Wed Apr 22 07:47:17 2015 +0000
- Revision:
- 1:fc2f9d636751
update libraries; ; delete nRF51822/nordic-sdk/components/gpiote/app_gpiote.c to solve GPIOTE_IRQHandler multiply defined issue. temperarily change nRF51822 library to folder
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 1:fc2f9d636751 | 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. |
yihui | 1:fc2f9d636751 | 2 | * |
yihui | 1:fc2f9d636751 | 3 | * The information contained herein is confidential property of Nordic |
yihui | 1:fc2f9d636751 | 4 | * Semiconductor ASA.Terms and conditions of usage are described in detail |
yihui | 1:fc2f9d636751 | 5 | * in NORDIC SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
yihui | 1:fc2f9d636751 | 6 | * |
yihui | 1:fc2f9d636751 | 7 | * Licensees are granted free, non-transferable use of the information. NO |
yihui | 1:fc2f9d636751 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
yihui | 1:fc2f9d636751 | 9 | * the file. |
yihui | 1:fc2f9d636751 | 10 | * |
yihui | 1:fc2f9d636751 | 11 | * $LastChangedRevision: 13999 $ |
yihui | 1:fc2f9d636751 | 12 | */ |
yihui | 1:fc2f9d636751 | 13 | |
yihui | 1:fc2f9d636751 | 14 | /** |
yihui | 1:fc2f9d636751 | 15 | * @file |
yihui | 1:fc2f9d636751 | 16 | * @brief ECB driver API. |
yihui | 1:fc2f9d636751 | 17 | */ |
yihui | 1:fc2f9d636751 | 18 | |
yihui | 1:fc2f9d636751 | 19 | #ifndef NRF_ECB_H__ |
yihui | 1:fc2f9d636751 | 20 | #define NRF_ECB_H__ |
yihui | 1:fc2f9d636751 | 21 | |
yihui | 1:fc2f9d636751 | 22 | /** |
yihui | 1:fc2f9d636751 | 23 | * @defgroup nrf_ecb AES ECB encryption |
yihui | 1:fc2f9d636751 | 24 | * @{ |
yihui | 1:fc2f9d636751 | 25 | * @ingroup nrf_drivers |
yihui | 1:fc2f9d636751 | 26 | * @brief Driver for the nRF51 AES Electronic Code Book (ECB) peripheral. |
yihui | 1:fc2f9d636751 | 27 | * |
yihui | 1:fc2f9d636751 | 28 | * In order to encrypt and decrypt data the peripheral must be powered on |
yihui | 1:fc2f9d636751 | 29 | * using nrf_ecb_init() and then the key set using nrf_ecb_set_key. |
yihui | 1:fc2f9d636751 | 30 | */ |
yihui | 1:fc2f9d636751 | 31 | |
yihui | 1:fc2f9d636751 | 32 | #include <stdint.h> |
yihui | 1:fc2f9d636751 | 33 | |
yihui | 1:fc2f9d636751 | 34 | /** |
yihui | 1:fc2f9d636751 | 35 | * Initialize and power on the ECB peripheral. |
yihui | 1:fc2f9d636751 | 36 | * |
yihui | 1:fc2f9d636751 | 37 | * Allocates memory for the ECBDATAPTR. |
yihui | 1:fc2f9d636751 | 38 | * @retval true Initialization was successful. |
yihui | 1:fc2f9d636751 | 39 | * @retval false Powering up failed. |
yihui | 1:fc2f9d636751 | 40 | */ |
yihui | 1:fc2f9d636751 | 41 | bool nrf_ecb_init(void); |
yihui | 1:fc2f9d636751 | 42 | |
yihui | 1:fc2f9d636751 | 43 | /** |
yihui | 1:fc2f9d636751 | 44 | * Encrypt/decrypt 16-byte data using current key. |
yihui | 1:fc2f9d636751 | 45 | * |
yihui | 1:fc2f9d636751 | 46 | * The function avoids unnecessary copying of data if the point to the |
yihui | 1:fc2f9d636751 | 47 | * correct locations in the ECB data structure. |
yihui | 1:fc2f9d636751 | 48 | * |
yihui | 1:fc2f9d636751 | 49 | * @param dst Result of encryption/decryption. 16 bytes will be written. |
yihui | 1:fc2f9d636751 | 50 | * @param src Source with 16-byte data to be encrypted/decrypted. |
yihui | 1:fc2f9d636751 | 51 | * |
yihui | 1:fc2f9d636751 | 52 | * @retval true If the encryption operation completed. |
yihui | 1:fc2f9d636751 | 53 | * @retval false If the encryption operation did not complete. |
yihui | 1:fc2f9d636751 | 54 | */ |
yihui | 1:fc2f9d636751 | 55 | bool nrf_ecb_crypt(uint8_t * dst, const uint8_t * src); |
yihui | 1:fc2f9d636751 | 56 | |
yihui | 1:fc2f9d636751 | 57 | /** |
yihui | 1:fc2f9d636751 | 58 | * Set the key to be used for encryption/decryption. |
yihui | 1:fc2f9d636751 | 59 | * |
yihui | 1:fc2f9d636751 | 60 | * @param key Pointer to key. 16 bytes will be read. |
yihui | 1:fc2f9d636751 | 61 | */ |
yihui | 1:fc2f9d636751 | 62 | void nrf_ecb_set_key(const uint8_t * key); |
yihui | 1:fc2f9d636751 | 63 | |
yihui | 1:fc2f9d636751 | 64 | #endif // NRF_ECB_H__ |
yihui | 1:fc2f9d636751 | 65 | |
yihui | 1:fc2f9d636751 | 66 | /** @} */ |