Patched version of nrf51822 FOTA compatible driver, with GPTIO disabled, as it clashed with the mbed definitions...
Fork of nRF51822 by
ble_date_time.h
00001 /* Copyright (c) 2011 Nordic Semiconductor. All Rights Reserved. 00002 * 00003 * The information contained herein is property of Nordic Semiconductor ASA. 00004 * Terms and conditions of usage are described in detail in NORDIC 00005 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 00006 * 00007 * Licensees are granted free, non-transferable use of the information. NO 00008 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 00009 * the file. 00010 */ 00011 00012 /* Attention! 00013 * To maintain compliance with Nordic Semiconductor ASA�s Bluetooth profile 00014 * qualification listings, this section of source code must not be modified. 00015 */ 00016 00017 /** @file 00018 * @brief Contains definition of ble_date_time structure. 00019 */ 00020 00021 /** @file 00022 * 00023 * @defgroup ble_sdk_srv_date_time BLE Date Time characteristic type 00024 * @{ 00025 * @ingroup ble_sdk_lib 00026 * @brief Definition of ble_date_time_t type. 00027 */ 00028 00029 #ifndef BLE_DATE_TIME_H__ 00030 #define BLE_DATE_TIME_H__ 00031 00032 #include <stdint.h> 00033 00034 /**@brief Date and Time structure. */ 00035 typedef struct 00036 { 00037 uint16_t year; 00038 uint8_t month; 00039 uint8_t day; 00040 uint8_t hours; 00041 uint8_t minutes; 00042 uint8_t seconds; 00043 } ble_date_time_t; 00044 00045 static __INLINE uint8_t ble_date_time_encode(const ble_date_time_t * p_date_time, 00046 uint8_t * p_encoded_data) 00047 { 00048 uint8_t len = uint16_encode(p_date_time->year, p_encoded_data); 00049 00050 p_encoded_data[len++] = p_date_time->month; 00051 p_encoded_data[len++] = p_date_time->day; 00052 p_encoded_data[len++] = p_date_time->hours; 00053 p_encoded_data[len++] = p_date_time->minutes; 00054 p_encoded_data[len++] = p_date_time->seconds; 00055 00056 return len; 00057 } 00058 00059 static __INLINE uint8_t ble_date_time_decode(ble_date_time_t * p_date_time, 00060 const uint8_t * p_encoded_data) 00061 { 00062 uint8_t len = sizeof(uint16_t); 00063 00064 p_date_time->year = uint16_decode(p_encoded_data); 00065 p_date_time->month = p_encoded_data[len++]; 00066 p_date_time->day = p_encoded_data[len++]; 00067 p_date_time->hours = p_encoded_data[len++]; 00068 p_date_time->minutes = p_encoded_data[len++]; 00069 p_date_time->seconds = p_encoded_data[len++]; 00070 00071 return len; 00072 } 00073 00074 #endif // BLE_DATE_TIME_H__ 00075 00076 /** @} */
Generated on Mon Dec 17 2018 22:13:50 by
