Skip to content

Commit f5d7ad0

Browse files
committed
SDK: first init version
0 parents  commit f5d7ad0

File tree

1,212 files changed

+383489
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,212 files changed

+383489
-0
lines changed

.gitignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Object files
5+
*.o
6+
*.ko
7+
*.obj
8+
*.elf
9+
10+
# Linker output
11+
*.ilk
12+
*.map
13+
*.exp
14+
15+
# Precompiled Headers
16+
*.gch
17+
*.pch
18+
19+
# Libraries
20+
*.lib
21+
*.a
22+
*.la
23+
*.lo
24+
25+
# Shared objects (inc. Windows DLLs)
26+
*.dll
27+
*.so
28+
*.so.*
29+
*.dylib
30+
31+
# Executables
32+
*.exe
33+
*.out
34+
*.app
35+
*.i*86
36+
*.x86_64
37+
38+
# Debug files
39+
*.dSYM/
40+
*.su
41+
*.idb
42+
*.pdb
43+
44+
# Kernel Module Compile Results
45+
*.mod*
46+
*.cmd
47+
.tmp_versions/
48+
modules.order
49+
Module.symvers
50+
Mkfile.old
51+
dkms.conf

LICENSE

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Copyright (c) 2010 - 2017, Nordic Semiconductor ASA
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without modification,
6+
are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form, except as embedded into a Nordic
12+
Semiconductor ASA integrated circuit in a product or a software update for
13+
such product, must reproduce the above copyright notice, this list of
14+
conditions and the following disclaimer in the documentation and/or other
15+
materials provided with the distribution.
16+
17+
3. Neither the name of Nordic Semiconductor ASA nor the names of its
18+
contributors may be used to endorse or promote products derived from this
19+
software without specific prior written permission.
20+
21+
4. This software, with or without modification, must only be used with a
22+
Nordic Semiconductor ASA integrated circuit.
23+
24+
5. Any software provided in binary form under this license must not be reverse
25+
engineered, decompiled, modified and/or disassembled.
26+
27+
THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
28+
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29+
OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
30+
DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
31+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33+
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
36+
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37+

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# rtthread_nordic_sdk
2+
3+
#### 介绍
4+
基于Nordic nRF5_SDK_13.0.0_04a0bfd 的软件包
5+
6+
#### 软件架构
7+
来源官方SDK
8+
9+
#### 使用说明
10+
11+
1. 进入menuconfig中
12+
2. 选择on line package
13+
3. 选择peripheral libraries and drivers
14+
15+
#### 参与贡献
16+
17+
1. super_MCU

Sconscript

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Import('RTT_ROOT')
2+
Import('rtconfig')
3+
from building import *
4+
5+
# get current directory
6+
cwd = GetCurrentDir()
7+
8+
BLE_COMMON = Glob('./components/ble/common/*.c')
9+
SrcRemove(BLE_COMMON, 'ble_conn_state.c')
10+
11+
BLE_GATT = Glob('./components/ble/nrf_ble_gatt/*.c')
12+
BLE_ADVERTISING = Glob('./components/ble/ble_advertising/*.c')
13+
14+
BLE_SERVICE = Glob('./components/ble/ble_services/ble_nus/*.c')
15+
16+
BLE_SRC = BLE_COMMON + BLE_GATT + BLE_SERVICE + BLE_ADVERTISING
17+
18+
SOFTDEVICE = Glob('./components/softdevice/common/softdevice_handler/*.c')
19+
SrcRemove(SOFTDEVICE, './components/softdevice/common/softdevice_handler/softdevice_handler_appsh.c')
20+
21+
BLE_STACK_SRC = BLE_SRC + SOFTDEVICE
22+
23+
path = [cwd + '/components']
24+
path += [cwd + '/components/softdevice/common/softdevice_handler']
25+
path += [cwd + '/components/softdevice/s132/headers']
26+
path += [cwd + '/components/softdevice/s132/headers/nrf52']
27+
path += [cwd + '/components/ble/common']
28+
path += [cwd + '/components/ble/nrf_ble_gatt']
29+
path += [cwd + '/components/ble/ble_advertising']
30+
path += [cwd + '/components/ble/ble_services/ble_nus']
31+
32+
CPPDEFINES = ['BLE_STACK_SUPPORT_REQD', 'NRF_SD_BLE_API_VERSION=4', 'S132', 'SOFTDEVICE_PRESENT']
33+
group = DefineGroup('BLE_STACK', BLE_STACK_SRC, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
34+
35+
group = group + SConscript(os.path.join(cwd, 'components/Sconscript'))
36+
37+
Return('group')

components/SConscript

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
Import('RTT_ROOT')
2+
Import('rtconfig')
3+
from building import *
4+
5+
# get current directory
6+
cwd = GetCurrentDir()
7+
8+
DriversDir = cwd + '/drivers_nrf/'
9+
DeviceDrivers = [DriversDir + 'hal/nrf_saadc.c']
10+
DeviceDrivers += [DriversDir + 'common/nrf_drv_common.c']
11+
#DeviceDrivers += [DriversDir + 'uart/nrf_drv_uart.c']
12+
DeviceDrivers += [DriversDir + 'clock/nrf_drv_clock.c']
13+
DeviceDrivers += [DriversDir + 'gpiote/nrf_drv_gpiote.c']
14+
DeviceDrivers += [DriversDir + 'pwm/nrf_drv_pwm.c']
15+
DeviceDrivers += [DriversDir + 'saadc/nrf_drv_saadc.c']
16+
17+
Libraries_dir = cwd + '/libraries/'
18+
Libraries_src = Glob(Libraries_dir + 'log/src/*.c')
19+
Libraries_src += Glob(Libraries_dir + 'timer/app_timer_rtthread.c')
20+
Libraries_src += Glob(Libraries_dir + 'util/*.c')
21+
Libraries_src += Glob(Libraries_dir + 'fstorage/fstorage.c')
22+
Libraries_src += Glob(Libraries_dir + 'strerror/nrf_strerror.c')
23+
24+
src = DeviceDrivers + Libraries_src
25+
26+
27+
28+
path = [cwd]
29+
path += [cwd + '/device']
30+
path += [cwd + '/drivers_nrf/delay']
31+
path += [cwd + '/drivers_nrf/uart']
32+
path += [cwd + '/drivers_nrf/clock']
33+
path += [cwd + '/drivers_nrf/gpiote']
34+
path += [cwd + '/drivers_nrf/common']
35+
path += [cwd + '/drivers_nrf/hal']
36+
path += [cwd + '/drivers_nrf/pwm']
37+
path += [DriversDir + 'saadc']
38+
39+
path += [Libraries_dir + 'util']
40+
path += [Libraries_dir + 'timer']
41+
path += [Libraries_dir + 'fstorage']
42+
path += [Libraries_dir + 'experimental_section_vars']
43+
path += [Libraries_dir + 'log']
44+
path += [Libraries_dir + 'log/src']
45+
path += [Libraries_dir + 'strerror']
46+
47+
path += [cwd + '/toolchain/cmsis/include']
48+
path += [cwd + '/toolchain']
49+
50+
CPPDEFINES = ['RTTHREAD', 'SWI_DISABLE0', 'CONFIG_GPIO_AS_PINRESET', 'NRF52']
51+
CPPDEFINES += ['NRF52_PAN_12', 'NRF52_PAN_15', 'NRF52_PAN_20', 'NRF52_PAN_31', 'NRF52_PAN_36']
52+
CPPDEFINES += ['NRF52_PAN_51', 'NRF52_PAN_54', 'NRF52_PAN_55', 'NRF52_PAN_58', 'NRF52_PAN_64', 'NRF52_PAN_74']
53+
54+
55+
56+
if GetDepend(['SOC_NRF52832']):
57+
src += ['toolchain/system_nrf52.c']
58+
src += ['toolchain/arm/arm_startup_nrf52.s']
59+
CPPDEFINES += ['NRF52832_XXAA']
60+
elif GetDepend(['SOC_NRF52840']):
61+
src += ['toolchain/system_nrf52840.c']
62+
src += ['toolchain/arm/arm_startup_nrf52840.s']
63+
CPPDEFINES += ['NRF52840_XXAA']
64+
65+
66+
group = DefineGroup('NRF_DRIVERS', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
67+
Return('group')
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/**
2+
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
3+
*
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without modification,
7+
* are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice, this
10+
* list of conditions and the following disclaimer.
11+
*
12+
* 2. Redistributions in binary form, except as embedded into a Nordic
13+
* Semiconductor ASA integrated circuit in a product or a software update for
14+
* such product, must reproduce the above copyright notice, this list of
15+
* conditions and the following disclaimer in the documentation and/or other
16+
* materials provided with the distribution.
17+
*
18+
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
19+
* contributors may be used to endorse or promote products derived from this
20+
* software without specific prior written permission.
21+
*
22+
* 4. This software, with or without modification, must only be used with a
23+
* Nordic Semiconductor ASA integrated circuit.
24+
*
25+
* 5. Any software provided in binary form under this license must not be reverse
26+
* engineered, decompiled, modified and/or disassembled.
27+
*
28+
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
29+
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
30+
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
31+
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
32+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
34+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
37+
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38+
*
39+
*/
40+
#include "sdk_common.h"
41+
#if NRF_MODULE_ENABLED(ANT_CHANNEL_CONFIG)
42+
#include "nrf_error.h"
43+
#include "ant_channel_config.h"
44+
#include "ant_interface.h"
45+
#include "ant_parameters.h"
46+
47+
uint32_t ant_channel_init(ant_channel_config_t const * p_config)
48+
{
49+
uint32_t err_code;
50+
// Set Channel Number.
51+
err_code = sd_ant_channel_assign(p_config->channel_number,
52+
p_config->channel_type,
53+
p_config->network_number,
54+
p_config->ext_assign);
55+
56+
VERIFY_SUCCESS(err_code);
57+
58+
// Set Channel ID.
59+
err_code = sd_ant_channel_id_set(p_config->channel_number,
60+
p_config->device_number,
61+
p_config->device_type,
62+
p_config->transmission_type);
63+
64+
VERIFY_SUCCESS(err_code);
65+
66+
// Set Channel RF frequency.
67+
err_code = sd_ant_channel_radio_freq_set(p_config->channel_number, p_config->rf_freq);
68+
VERIFY_SUCCESS(err_code);
69+
70+
// Set Channel period.
71+
if (!(p_config->ext_assign & EXT_PARAM_ALWAYS_SEARCH) && (p_config->channel_period != 0))
72+
{
73+
err_code = sd_ant_channel_period_set(p_config->channel_number, p_config->channel_period);
74+
}
75+
76+
77+
#if ANT_CONFIG_ENCRYPTED_CHANNELS > 0
78+
VERIFY_SUCCESS(err_code);
79+
80+
err_code = ant_channel_encrypt_config(p_config->channel_type , p_config->channel_number, p_config->p_crypto_settings);
81+
#endif
82+
83+
return err_code;
84+
}
85+
86+
#endif // NRF_MODULE_ENABLED(ANT_CHANNEL_CONFIG)
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/**
2+
* Copyright (c) 2015 - 2017, Nordic Semiconductor ASA
3+
*
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without modification,
7+
* are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice, this
10+
* list of conditions and the following disclaimer.
11+
*
12+
* 2. Redistributions in binary form, except as embedded into a Nordic
13+
* Semiconductor ASA integrated circuit in a product or a software update for
14+
* such product, must reproduce the above copyright notice, this list of
15+
* conditions and the following disclaimer in the documentation and/or other
16+
* materials provided with the distribution.
17+
*
18+
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
19+
* contributors may be used to endorse or promote products derived from this
20+
* software without specific prior written permission.
21+
*
22+
* 4. This software, with or without modification, must only be used with a
23+
* Nordic Semiconductor ASA integrated circuit.
24+
*
25+
* 5. Any software provided in binary form under this license must not be reverse
26+
* engineered, decompiled, modified and/or disassembled.
27+
*
28+
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
29+
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
30+
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
31+
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
32+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
34+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
37+
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38+
*
39+
*/
40+
#ifndef ANT_CHANNEL_CONFIG_H__
41+
#define ANT_CHANNEL_CONFIG_H__
42+
43+
/** @file
44+
*
45+
* @defgroup ant_channel_config ANT channel configuration
46+
* @{
47+
* @ingroup ant_sdk_utils
48+
* @brief ANT channel configuration module.
49+
*/
50+
51+
#include <stdint.h>
52+
#include "sdk_config.h"
53+
54+
55+
#ifndef ANT_CONFIG_ENCRYPTED_CHANNELS
56+
#error Undefined ANT_CONFIG_ENCRYPTED_CHANNELS. It should be defined in sdk_config.h file.
57+
#elif ANT_CONFIG_ENCRYPTED_CHANNELS > 0
58+
#include "ant_encrypt_config.h"
59+
#endif
60+
61+
#ifdef __cplusplus
62+
extern "C" {
63+
#endif
64+
65+
/**@brief ANT channel configuration structure. */
66+
typedef struct
67+
{
68+
uint8_t channel_number; ///< Assigned channel number.
69+
uint8_t channel_type; ///< Channel type (see Assign Channel Parameters in ant_parameters.h: @ref ant_parameters).
70+
uint8_t ext_assign; ///< Extended assign (see Ext. Assign Channel Parameters in ant_parameters.h: @ref ant_parameters).
71+
uint8_t rf_freq; ///< Radio frequency offset from 2400 MHz (for example, 2466 MHz, rf_freq = 66).
72+
uint8_t transmission_type; ///< Transmission type.
73+
uint8_t device_type; ///< Device type.
74+
uint16_t device_number; ///< Device number.
75+
uint16_t channel_period; ///< The period in 32 kHz counts.
76+
uint8_t network_number; ///< Network number denoting the network key.
77+
78+
#if ANT_CONFIG_ENCRYPTED_CHANNELS > 0
79+
ant_encrypt_channel_settings_t * p_crypto_settings; ///< Pointer to cryptographic settings, NULL if this configuration have to be omitted.
80+
#endif
81+
82+
} ant_channel_config_t;
83+
84+
/**@brief Function for configuring the ANT channel.
85+
*
86+
* @param[in] p_config Pointer to the channel configuration structure.
87+
*
88+
* @retval NRF_SUCCESS If the channel was successfully configured. Otherwise, an error code is returned.
89+
*/
90+
uint32_t ant_channel_init(ant_channel_config_t const * p_config);
91+
92+
93+
#ifdef __cplusplus
94+
}
95+
#endif
96+
97+
#endif // ANT_CHANNEL_CONFIG_H__
98+
/** @} */

0 commit comments

Comments
 (0)