summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorja Martinez2016-09-11 10:53:17 -0500
committerBorja Martinez2016-09-11 10:53:17 -0500
commit65ee7440cefee2ca8c994d810acc6109c21f30ee (patch)
tree2f69e1ea82199998f3cfc4ed646d22ffc54f42f3
parent516ee6037b67bc7725e1f269d7dadeee19dbc2d4 (diff)
downloadi3-mote-65ee7440cefee2ca8c994d810acc6109c21f30ee.tar.gz
i3-mote-65ee7440cefee2ca8c994d810acc6109c21f30ee.tar.xz
i3-mote-65ee7440cefee2ca8c994d810acc6109c21f30ee.zip
Created Test CC2650 I2C Sensors
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/Board.h86
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.c640
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.cfg617
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.cmd88
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.h324
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/ccfg.c57
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/main.c291
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/uart_printf.c173
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/uart_printf.h81
9 files changed, 2357 insertions, 0 deletions
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/Board.h b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/Board.h
new file mode 100644
index 0000000..ae8255e
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/Board.h
@@ -0,0 +1,86 @@
1/*
2 * Copyright (c) 2015-2016, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef __BOARD_H
34#define __BOARD_H
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#include <ti/drivers/Power.h>
41
42#include "CC2650_I3M.h"
43
44/* These #defines allow us to reuse TI-RTOS across other device families */
45#define Board_LED0 Board_LEDR
46#define Board_LED1 Board_LEDG
47#define Board_LED2 Board_LED0
48
49#define Board_BUTTON0 Board_BTN1
50#define Board_BUTTON1 Board_BTN2
51
52#define Board_I2C0 Board_I2C
53
54#define Board_UART0 Board_UART
55#define Board_AES0 Board_AES
56#define Board_WATCHDOG0 Board_WATCHDOG
57
58#define Board_ADC0 CC2650_I3MOTE_ADCVSS
59#define Board_ADC1 CC2650_I3MOTE_ADCVDDS
60
61#define Board_ADCBuf0 CC2650_I3MOTE_ADCBuf0
62
63#define Board_ADCBufChannel0 (0)
64#define Board_initGeneral() { \
65 Power_init(); \
66 if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) \
67 {System_abort("Error with PIN_init\n"); \
68 } \
69}
70
71#define Board_initGPIO()
72#define Board_initPWM() PWM_init()
73#define Board_initSPI() SPI_init()
74#define Board_initI2C() I2C_init()
75#define Board_initUART() UART_init()
76#define Board_initWatchdog() Watchdog_init()
77#define Board_initADCBuf() ADCBuf_init()
78#define Board_initADC() ADC_init()
79#define GPIO_toggle(n)
80#define GPIO_write(n,m)
81
82#ifdef __cplusplus
83}
84#endif
85
86#endif /* __BOARD_H */
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.c b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.c
new file mode 100644
index 0000000..f3e0087
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.c
@@ -0,0 +1,640 @@
1/*
2 * Copyright (c) 2016, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/*
34 * ====================== CC2650_I3MOTE.c ===================================
35 * This file is responsible for setting up the board specific items for the
36 * CC2650 LaunchPad.
37 */
38
39
40/*
41 * ====================== Includes ============================================
42 */
43#include <xdc/std.h>
44#include <xdc/runtime/System.h>
45
46#include <ti/sysbios/family/arm/m3/Hwi.h>
47#include <ti/drivers/PIN.h>
48#include <ti/drivers/pin/PINCC26XX.h>
49#include <ti/drivers/PWM.h>
50#include <ti/drivers/pwm/PWMTimerCC26XX.h>
51#include <ti/drivers/timer/GPTimerCC26XX.h>
52#include <ti/drivers/Power.h>
53#include <ti/drivers/power/PowerCC26XX.h>
54
55#include <inc/hw_memmap.h>
56#include <inc/hw_ints.h>
57#include <driverlib/ioc.h>
58#include <driverlib/udma.h>
59
60#include <Board.h>
61
62/*
63 * ========================= IO driver initialization =========================
64 * From main, PIN_init(BoardGpioInitTable) should be called to setup safe
65 * settings for this board.
66 * When a pin is allocated and then de-allocated, it will revert to the state
67 * configured in this table.
68 */
69/* Place into subsections to allow the TI linker to remove items properly */
70#if defined(__TI_COMPILER_VERSION__)
71#pragma DATA_SECTION(BoardGpioInitTable, ".const:BoardGpioInitTable")
72#pragma DATA_SECTION(PINCC26XX_hwAttrs, ".const:PINCC26XX_hwAttrs")
73#endif
74
75const PIN_Config BoardGpioInitTable[] = {
76
77 Board_LEDR | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
78 Board_LEDG | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
79 Board_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
80 Board_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
81 Board_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
82 PIN_TERMINATE
83};
84
85const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
86 .intPriority = ~0,
87 .swiPriority = 0
88};
89/*============================================================================*/
90
91/*
92 * ============================= Power begin ==================================
93 */
94/* Place into subsections to allow the TI linker to remove items properly */
95#if defined(__TI_COMPILER_VERSION__)
96#pragma DATA_SECTION(PowerCC26XX_config, ".const:PowerCC26XX_config")
97#endif
98const PowerCC26XX_Config PowerCC26XX_config = {
99 .policyInitFxn = NULL,
100 .policyFxn = &PowerCC26XX_standbyPolicy,
101 .calibrateFxn = &PowerCC26XX_calibrate,
102 .enablePolicy = TRUE,
103 .calibrateRCOSC_LF = TRUE,
104 .calibrateRCOSC_HF = TRUE,
105};
106/*
107 * ============================= Power end ====================================
108 */
109
110/*
111 * ============================= UART begin ===================================
112 */
113/* Place into subsections to allow the TI linker to remove items properly */
114#if defined(__TI_COMPILER_VERSION__)
115#pragma DATA_SECTION(UART_config, ".const:UART_config")
116#pragma DATA_SECTION(uartCC26XXHWAttrs, ".const:uartCC26XXHWAttrs")
117#endif
118
119/* Include drivers */
120#include <ti/drivers/UART.h>
121#include <ti/drivers/uart/UARTCC26XX.h>
122
123/* UART objects */
124UARTCC26XX_Object uartCC26XXObjects[CC2650_I3MOTE_UARTCOUNT];
125
126/* UART hardware parameter structure, also used to assign UART pins */
127const UARTCC26XX_HWAttrsV1 uartCC26XXHWAttrs[CC2650_I3MOTE_UARTCOUNT] = {
128 {
129 .baseAddr = UART0_BASE,
130 .powerMngrId = PowerCC26XX_PERIPH_UART0,
131 .intNum = INT_UART0_COMB,
132 .intPriority = ~0,
133 .swiPriority = 0,
134 .txPin = Board_UART_TX,
135 .rxPin = Board_UART_RX,
136 .ctsPin = PIN_UNASSIGNED,
137 .rtsPin = PIN_UNASSIGNED
138 }
139};
140
141/* UART configuration structure */
142const UART_Config UART_config[] = {
143 {
144 .fxnTablePtr = &UARTCC26XX_fxnTable,
145 .object = &uartCC26XXObjects[0],
146 .hwAttrs = &uartCC26XXHWAttrs[0]
147 },
148 {NULL, NULL, NULL}
149};
150/*
151 * ============================= UART end =====================================
152 */
153
154/*
155 * ============================= UDMA begin ===================================
156 */
157/* Place into subsections to allow the TI linker to remove items properly */
158#if defined(__TI_COMPILER_VERSION__)
159#pragma DATA_SECTION(UDMACC26XX_config, ".const:UDMACC26XX_config")
160#pragma DATA_SECTION(udmaHWAttrs, ".const:udmaHWAttrs")
161#endif
162
163/* Include drivers */
164#include <ti/drivers/dma/UDMACC26XX.h>
165
166/* UDMA objects */
167UDMACC26XX_Object udmaObjects[CC2650_I3MOTE_UDMACOUNT];
168
169/* UDMA configuration structure */
170const UDMACC26XX_HWAttrs udmaHWAttrs[CC2650_I3MOTE_UDMACOUNT] = {
171 {
172 .baseAddr = UDMA0_BASE,
173 .powerMngrId = PowerCC26XX_PERIPH_UDMA,
174 .intNum = INT_DMA_ERR,
175 .intPriority = ~0
176 }
177};
178
179/* UDMA configuration structure */
180const UDMACC26XX_Config UDMACC26XX_config[] = {
181 {
182 .object = &udmaObjects[0],
183 .hwAttrs = &udmaHWAttrs[0]
184 },
185 {NULL, NULL}
186};
187/*
188 * ============================= UDMA end =====================================
189 */
190
191/*
192 * ========================== SPI DMA begin ===================================
193 */
194/* Place into subsections to allow the TI linker to remove items properly */
195#if defined(__TI_COMPILER_VERSION__)
196#pragma DATA_SECTION(SPI_config, ".const:SPI_config")
197#pragma DATA_SECTION(spiCC26XXDMAHWAttrs, ".const:spiCC26XXDMAHWAttrs")
198#endif
199
200/* Include drivers */
201#include <ti/drivers/spi/SPICC26XXDMA.h>
202
203/* SPI objects */
204SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2650_I3MOTE_SPICOUNT];
205
206/* SPI configuration structure, describing which pins are to be used */
207const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650_I3MOTE_SPICOUNT] = {
208 {
209 .baseAddr = SSI0_BASE,
210 .intNum = INT_SSI0_COMB,
211 .intPriority = ~0,
212 .swiPriority = 0,
213 .powerMngrId = PowerCC26XX_PERIPH_SSI0,
214 .defaultTxBufValue = 0,
215 .rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
216 .txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
217 .mosiPin = Board_SPI0_MOSI,
218 .misoPin = Board_SPI0_MISO,
219 .clkPin = Board_SPI0_CLK,
220 .csnPin = Board_SPI0_CSN
221 },
222 {
223 .baseAddr = SSI1_BASE,
224 .intNum = INT_SSI1_COMB,
225 .intPriority = ~0,
226 .swiPriority = 0,
227 .powerMngrId = PowerCC26XX_PERIPH_SSI1,
228 .defaultTxBufValue = 0,
229 .rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
230 .txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
231 .mosiPin = Board_SPI1_MOSI,
232 .misoPin = Board_SPI1_MISO,
233 .clkPin = Board_SPI1_CLK,
234 .csnPin = Board_SPI1_CSN
235 }
236};
237
238/* SPI configuration structure */
239const SPI_Config SPI_config[] = {
240 {
241 .fxnTablePtr = &SPICC26XXDMA_fxnTable,
242 .object = &spiCC26XXDMAObjects[0],
243 .hwAttrs = &spiCC26XXDMAHWAttrs[0]
244 },
245 {
246 .fxnTablePtr = &SPICC26XXDMA_fxnTable,
247 .object = &spiCC26XXDMAObjects[1],
248 .hwAttrs = &spiCC26XXDMAHWAttrs[1]
249 },
250 {NULL, NULL, NULL}
251};
252/*
253 * ========================== SPI DMA end =====================================
254*/
255
256
257/*
258 * ============================= I2C Begin=====================================
259*/
260/* Place into subsections to allow the TI linker to remove items properly */
261#if defined(__TI_COMPILER_VERSION__)
262#pragma DATA_SECTION(I2C_config, ".const:I2C_config")
263#pragma DATA_SECTION(i2cCC26xxHWAttrs, ".const:i2cCC26xxHWAttrs")
264#endif
265
266/* Include drivers */
267#include <ti/drivers/i2c/I2CCC26XX.h>
268
269/* I2C objects */
270I2CCC26XX_Object i2cCC26xxObjects[CC2650_I3MOTE_I2CCOUNT];
271
272/* I2C configuration structure, describing which pins are to be used */
273const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650_I3MOTE_I2CCOUNT] = {
274 {
275 .baseAddr = I2C0_BASE,
276 .powerMngrId = PowerCC26XX_PERIPH_I2C0,
277 .intNum = INT_I2C_IRQ,
278 .intPriority = ~0,
279 .swiPriority = 0,
280 .sdaPin = Board_I2C0_SDA0,
281 .sclPin = Board_I2C0_SCL0,
282 }
283};
284
285/* I2C configuration structure */
286const I2C_Config I2C_config[] = {
287 {
288 .fxnTablePtr = &I2CCC26XX_fxnTable,
289 .object = &i2cCC26xxObjects[0],
290 .hwAttrs = &i2cCC26xxHWAttrs[0]
291 },
292 {NULL, NULL, NULL}
293};
294/*
295 * ========================== I2C end =========================================
296 */
297
298/*
299 * ========================== Crypto begin ====================================
300 * NOTE: The Crypto implementation should be considered experimental
301 * and not validated!
302 */
303/* Place into subsections to allow the TI linker to remove items properly */
304#if defined(__TI_COMPILER_VERSION__)
305#pragma DATA_SECTION(CryptoCC26XX_config, ".const:CryptoCC26XX_config")
306#pragma DATA_SECTION(cryptoCC26XXHWAttrs, ".const:cryptoCC26XXHWAttrs")
307#endif
308
309/* Include drivers */
310#include <ti/drivers/crypto/CryptoCC26XX.h>
311
312/* Crypto objects */
313CryptoCC26XX_Object cryptoCC26XXObjects[CC2650_I3MOTE_CRYPTOCOUNT];
314
315/* Crypto configuration structure, describing which pins are to be used */
316const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC2650_I3MOTE_CRYPTOCOUNT] = {
317 {
318 .baseAddr = CRYPTO_BASE,
319 .powerMngrId = PowerCC26XX_PERIPH_CRYPTO,
320 .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ,
321 .intPriority = ~0,
322 }
323};
324
325/* Crypto configuration structure */
326const CryptoCC26XX_Config CryptoCC26XX_config[] = {
327 {
328 .object = &cryptoCC26XXObjects[0],
329 .hwAttrs = &cryptoCC26XXHWAttrs[0]
330 },
331 {NULL, NULL}
332};
333/*
334 * ========================== Crypto end ======================================
335 */
336
337
338/*
339 * ========================= RF driver begin ==================================
340 */
341/* Place into subsections to allow the TI linker to remove items properly */
342#if defined(__TI_COMPILER_VERSION__)
343#pragma DATA_SECTION(RFCC26XX_hwAttrs, ".const:RFCC26XX_hwAttrs")
344#endif
345
346/* Include drivers */
347#include <ti/drivers/rf/RF.h>
348
349/* RF hwi and swi priority */
350const RFCC26XX_HWAttrs RFCC26XX_hwAttrs = {
351 .hwiCpe0Priority = ~0,
352 .hwiHwPriority = ~0,
353 .swiCpe0Priority = 0,
354 .swiHwPriority = 0,
355};
356
357/*
358 * ========================== RF driver end ===================================
359 */
360
361/*
362 * ========================= Display begin ====================================
363 */
364
365/*
366 * ========================= Display end ======================================
367 */
368
369/*
370 * ============================ GPTimer begin =================================
371 * Remove unused entries to reduce flash usage both in Board.c and Board.h
372 */
373/* Place into subsections to allow the TI linker to remove items properly */
374#if defined(__TI_COMPILER_VERSION__)
375#pragma DATA_SECTION(GPTimerCC26XX_config, ".const:GPTimerCC26XX_config")
376#pragma DATA_SECTION(gptimerCC26xxHWAttrs, ".const:gptimerCC26xxHWAttrs")
377#endif
378
379/* GPTimer hardware attributes, one per timer part (Timer 0A, 0B, 1A, 1B..) */
380const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC2650_I3MOTE_GPTIMERPARTSCOUNT] = {
381 { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
382 { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
383 { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
384 { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
385 { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
386 { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
387 { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
388 { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
389};
390
391/* GPTimer objects, one per full-width timer (A+B) (Timer 0, Timer 1..) */
392GPTimerCC26XX_Object gptimerCC26XXObjects[CC2650_I3MOTE_GPTIMERCOUNT];
393
394/* GPTimer configuration (used as GPTimer_Handle by driver and application) */
395const GPTimerCC26XX_Config GPTimerCC26XX_config[CC2650_I3MOTE_GPTIMERPARTSCOUNT] = {
396 { &gptimerCC26XXObjects[0], &gptimerCC26xxHWAttrs[0], GPT_A },
397 { &gptimerCC26XXObjects[0], &gptimerCC26xxHWAttrs[1], GPT_B },
398 { &gptimerCC26XXObjects[1], &gptimerCC26xxHWAttrs[2], GPT_A },
399 { &gptimerCC26XXObjects[1], &gptimerCC26xxHWAttrs[3], GPT_B },
400 { &gptimerCC26XXObjects[2], &gptimerCC26xxHWAttrs[4], GPT_A },
401 { &gptimerCC26XXObjects[2], &gptimerCC26xxHWAttrs[5], GPT_B },
402 { &gptimerCC26XXObjects[3], &gptimerCC26xxHWAttrs[6], GPT_A },
403 { &gptimerCC26XXObjects[3], &gptimerCC26xxHWAttrs[7], GPT_B },
404};
405
406/*
407 * ============================ GPTimer end ===================================
408 */
409
410
411
412/*
413 * ============================= PWM begin ====================================
414 * Remove unused entries to reduce flash usage both in Board.c and Board.h
415 */
416/* Place into subsections to allow the TI linker to remove items properly */
417#if defined(__TI_COMPILER_VERSION__)
418#pragma DATA_SECTION(PWM_config, ".const:PWM_config")
419#pragma DATA_SECTION(pwmtimerCC26xxHWAttrs, ".const:pwmtimerCC26xxHWAttrs")
420#endif
421
422/* PWM configuration, one per PWM output. */
423PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC2650_I3MOTE_PWMCOUNT] = {
424 { .pwmPin = Board_PWMPIN0, .gpTimerUnit = Board_GPTIMER0A },
425 { .pwmPin = Board_PWMPIN1, .gpTimerUnit = Board_GPTIMER0B },
426 { .pwmPin = Board_PWMPIN2, .gpTimerUnit = Board_GPTIMER1A },
427 { .pwmPin = Board_PWMPIN3, .gpTimerUnit = Board_GPTIMER1B },
428 { .pwmPin = Board_PWMPIN4, .gpTimerUnit = Board_GPTIMER2A },
429 { .pwmPin = Board_PWMPIN5, .gpTimerUnit = Board_GPTIMER2B },
430 { .pwmPin = Board_PWMPIN6, .gpTimerUnit = Board_GPTIMER3A },
431 { .pwmPin = Board_PWMPIN7, .gpTimerUnit = Board_GPTIMER3B },
432};
433
434/* PWM object, one per PWM output */
435PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC2650_I3MOTE_PWMCOUNT];
436
437extern const PWM_FxnTable PWMTimerCC26XX_fxnTable;
438
439/* PWM configuration (used as PWM_Handle by driver and application) */
440const PWM_Config PWM_config[CC2650_I3MOTE_PWMCOUNT + 1] = {
441 { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[0], &pwmtimerCC26xxHWAttrs[0] },
442 { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[1], &pwmtimerCC26xxHWAttrs[1] },
443 { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[2], &pwmtimerCC26xxHWAttrs[2] },
444 { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[3], &pwmtimerCC26xxHWAttrs[3] },
445 { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[4], &pwmtimerCC26xxHWAttrs[4] },
446 { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[5], &pwmtimerCC26xxHWAttrs[5] },
447 { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[6], &pwmtimerCC26xxHWAttrs[6] },
448 { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[7], &pwmtimerCC26xxHWAttrs[7] },
449 { NULL, NULL, NULL }
450};
451
452
453/*
454 * ============================= PWM end ======================================
455 */
456
457/*
458 * ========================== ADCBuf begin =========================================
459 */
460/* Place into subsections to allow the TI linker to remove items properly */
461#if defined(__TI_COMPILER_VERSION__)
462#pragma DATA_SECTION(ADCBuf_config, ".const:ADCBuf_config")
463#pragma DATA_SECTION(adcBufCC26xxHWAttrs, ".const:adcBufCC26xxHWAttrs")
464#pragma DATA_SECTION(ADCBufCC26XX_adcChannelLut, ".const:ADCBufCC26XX_adcChannelLut")
465#endif
466
467/* Include drivers */
468#include <ti/drivers/ADCBuf.h>
469#include <ti/drivers/adcbuf/ADCBufCC26XX.h>
470
471/* ADCBuf objects */
472ADCBufCC26XX_Object adcBufCC26xxObjects[CC2650_I3MOTE_ADCBufCOUNT];
473
474/*
475 * This table converts a virtual adc channel into a dio and internal analogue input signal.
476 * This table is necessary for the functioning of the adcBuf driver.
477 * Comment out unused entries to save flash.
478 * Dio and internal signal pairs are hardwired. Do not remap them in the table. You may reorder entire entries though.
479 * The mapping of dio and internal signals is package dependent.
480 */
481const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[] = {
482 {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS},
483 {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL},
484 {PIN_UNASSIGNED, ADC_COMPB_IN_VSS},
485 //{Board_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7},
486 //{Board_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6},
487 //{Board_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5},
488 //{Board_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4},
489 //{Board_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3},
490 //{Board_DIO28_ANALOG, ADC_COMPB_IN_AUXIO2},
491 //{Board_DIO29_ANALOG, ADC_COMPB_IN_AUXIO1},
492 //{Board_DIO30_ANALOG, ADC_COMPB_IN_AUXIO0},
493};
494
495const ADCBufCC26XX_HWAttrs adcBufCC26xxHWAttrs[CC2650_I3MOTE_ADCBufCOUNT] = {
496 {
497 .intPriority = ~0,
498 .swiPriority = 0,
499 .adcChannelLut = ADCBufCC26XX_adcChannelLut,
500 .gpTimerUnit = Board_GPTIMER0A,
501 .gptDMAChannelMask = 1 << UDMA_CHAN_TIMER0_A,
502 }
503};
504
505const ADCBuf_Config ADCBuf_config[] = {
506 {&ADCBufCC26XX_fxnTable, &adcBufCC26xxObjects[0], &adcBufCC26xxHWAttrs[0]},
507 {NULL, NULL, NULL},
508};
509/*
510 * ========================== ADCBuf end =========================================
511 */
512
513
514
515/*
516 * ========================== ADC begin =========================================
517 */
518/* Place into subsections to allow the TI linker to remove items properly */
519#if defined(__TI_COMPILER_VERSION__)
520#pragma DATA_SECTION(ADC_config, ".const:ADC_config")
521#pragma DATA_SECTION(adcCC26xxHWAttrs, ".const:adcCC26xxHWAttrs")
522#endif
523
524/* Include drivers */
525#include <ti/drivers/ADC.h>
526#include <ti/drivers/adc/ADCCC26XX.h>
527
528/* ADC objects */
529ADCCC26XX_Object adcCC26xxObjects[CC2650_I3MOTE_ADCCOUNT];
530
531
532const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC2650_I3MOTE_ADCCOUNT] = {
533 {
534 .adcDIO = Board_DIO23_ANALOG,
535 .adcCompBInput = ADC_COMPB_IN_AUXIO7,
536 .refSource = ADCCC26XX_FIXED_REFERENCE,
537 .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
538 .inputScalingEnabled = true,
539 .triggerSource = ADCCC26XX_TRIGGER_MANUAL
540 },
541 {
542 .adcDIO = Board_DIO24_ANALOG,
543 .adcCompBInput = ADC_COMPB_IN_AUXIO6,
544 .refSource = ADCCC26XX_FIXED_REFERENCE,
545 .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
546 .inputScalingEnabled = true,
547 .triggerSource = ADCCC26XX_TRIGGER_MANUAL
548 },
549 {
550 .adcDIO = Board_DIO25_ANALOG,
551 .adcCompBInput = ADC_COMPB_IN_AUXIO5,
552 .refSource = ADCCC26XX_FIXED_REFERENCE,
553 .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
554 .inputScalingEnabled = true,
555 .triggerSource = ADCCC26XX_TRIGGER_MANUAL
556 },
557 {
558 .adcDIO = Board_DIO26_ANALOG,
559 .adcCompBInput = ADC_COMPB_IN_AUXIO4,
560 .refSource = ADCCC26XX_FIXED_REFERENCE,
561 .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
562 .inputScalingEnabled = true,
563 .triggerSource = ADCCC26XX_TRIGGER_MANUAL
564 },
565 {
566 .adcDIO = Board_DIO27_ANALOG,
567 .adcCompBInput = ADC_COMPB_IN_AUXIO3,
568 .refSource = ADCCC26XX_FIXED_REFERENCE,
569 .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
570 .inputScalingEnabled = true,
571 .triggerSource = ADCCC26XX_TRIGGER_MANUAL
572 },
573 {
574 .adcDIO = Board_DIO28_ANALOG,
575 .adcCompBInput = ADC_COMPB_IN_AUXIO2,
576 .refSource = ADCCC26XX_FIXED_REFERENCE,
577 .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
578 .inputScalingEnabled = true,
579 .triggerSource = ADCCC26XX_TRIGGER_MANUAL
580 },
581 {
582 .adcDIO = Board_DIO29_ANALOG,
583 .adcCompBInput = ADC_COMPB_IN_AUXIO1,
584 .refSource = ADCCC26XX_FIXED_REFERENCE,
585 .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
586 .inputScalingEnabled = true,
587 .triggerSource = ADCCC26XX_TRIGGER_MANUAL
588 },
589 {
590 .adcDIO = Board_DIO30_ANALOG,
591 .adcCompBInput = ADC_COMPB_IN_AUXIO0,
592 .refSource = ADCCC26XX_FIXED_REFERENCE,
593 .samplingDuration = ADCCC26XX_SAMPLING_DURATION_10P9_MS,
594 .inputScalingEnabled = true,
595 .triggerSource = ADCCC26XX_TRIGGER_MANUAL
596 },
597 {
598 .adcDIO = PIN_UNASSIGNED,
599 .adcCompBInput = ADC_COMPB_IN_DCOUPL,
600 .refSource = ADCCC26XX_FIXED_REFERENCE,
601 .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
602 .inputScalingEnabled = true,
603 .triggerSource = ADCCC26XX_TRIGGER_MANUAL
604 },
605 {
606 .adcDIO = PIN_UNASSIGNED,
607 .adcCompBInput = ADC_COMPB_IN_VSS,
608 .refSource = ADCCC26XX_FIXED_REFERENCE,
609 .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
610 .inputScalingEnabled = true,
611 .triggerSource = ADCCC26XX_TRIGGER_MANUAL
612 },
613 {
614 .adcDIO = PIN_UNASSIGNED,
615 .adcCompBInput = ADC_COMPB_IN_VDDS,
616 .refSource = ADCCC26XX_FIXED_REFERENCE,
617 .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
618 .inputScalingEnabled = true,
619 .triggerSource = ADCCC26XX_TRIGGER_MANUAL
620 }
621};
622
623const ADC_Config ADC_config[] = {
624 {&ADCCC26XX_fxnTable, &adcCC26xxObjects[0], &adcCC26xxHWAttrs[0]},
625 {&ADCCC26XX_fxnTable, &adcCC26xxObjects[1], &adcCC26xxHWAttrs[1]},
626 {&ADCCC26XX_fxnTable, &adcCC26xxObjects[2], &adcCC26xxHWAttrs[2]},
627 {&ADCCC26XX_fxnTable, &adcCC26xxObjects[3], &adcCC26xxHWAttrs[3]},
628 {&ADCCC26XX_fxnTable, &adcCC26xxObjects[4], &adcCC26xxHWAttrs[4]},
629 {&ADCCC26XX_fxnTable, &adcCC26xxObjects[5], &adcCC26xxHWAttrs[5]},
630 {&ADCCC26XX_fxnTable, &adcCC26xxObjects[6], &adcCC26xxHWAttrs[6]},
631 {&ADCCC26XX_fxnTable, &adcCC26xxObjects[7], &adcCC26xxHWAttrs[7]},
632 {&ADCCC26XX_fxnTable, &adcCC26xxObjects[8], &adcCC26xxHWAttrs[8]},
633 {&ADCCC26XX_fxnTable, &adcCC26xxObjects[9], &adcCC26xxHWAttrs[9]},
634 {&ADCCC26XX_fxnTable, &adcCC26xxObjects[10], &adcCC26xxHWAttrs[10]},
635 {NULL, NULL, NULL},
636};
637
638/*
639 * ========================== ADC end =========================================
640 */
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.cfg b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.cfg
new file mode 100644
index 0000000..c4d7b01
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.cfg
@@ -0,0 +1,617 @@
1/*
2 * Copyright (c) 2015-2016, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33
34
35/* ================ Boot configuration ================ */
36var Boot = xdc.useModule('ti.sysbios.family.arm.cc26xx.Boot');
37/*
38 * This module contains family specific Boot APIs and configuration settings.
39 * See the SYS/BIOS API guide for more information.
40 */
41
42
43
44/* ================ Clock configuration ================ */
45var Clock = xdc.useModule('ti.sysbios.knl.Clock');
46/*
47 * When using Power and calibrateRCOSC is set to true, this should be set to 10.
48 * The timer used by the Clock module supports TickMode_DYNAMIC. This enables us
49 * to set the tick period to 10 us without generating the overhead of additional
50 * interrupts.
51 *
52 * Note: The calibrateRCOSC parameter is set within the Power configuration
53 * structure in the "Board.c" file.
54 */
55Clock.tickPeriod = 10;
56
57
58
59/* ================ Defaults (module) configuration ================ */
60var Defaults = xdc.useModule('xdc.runtime.Defaults');
61/*
62 * A flag to allow module names to be loaded on the target. Module name
63 * strings are placed in the .const section for debugging purposes.
64 *
65 * Pick one:
66 * - true (default)
67 * Setting this parameter to true will include name strings in the .const
68 * section so that Errors and Asserts are easier to debug.
69 * - false
70 * Setting this parameter to false will reduce footprint in the .const
71 * section. As a result, Error and Assert messages will contain an
72 * "unknown module" prefix instead of the actual module name.
73 *
74 * When using BIOS in ROM:
75 * This option must be set to false.
76 */
77//Defaults.common$.namedModule = true;
78Defaults.common$.namedModule = false;
79
80
81
82/* ================ Error configuration ================ */
83var Error = xdc.useModule('xdc.runtime.Error');
84/*
85 * This function is called to handle all raised errors, but unlike
86 * Error.raiseHook, this function is responsible for completely handling the
87 * error with an appropriately initialized Error_Block.
88 *
89 * Pick one:
90 * - Error.policyDefault (default)
91 * Calls Error.raiseHook with an initialized Error_Block structure and logs
92 * the error using the module's logger.
93 * - Error.policySpin
94 * Simple alternative that traps on a while(1) loop for minimized target
95 * footprint.
96 * Using Error.policySpin, the Error.raiseHook will NOT called.
97 */
98//Error.policyFxn = Error.policyDefault;
99Error.policyFxn = Error.policySpin;
100
101/*
102 * If Error.policyFxn is set to Error.policyDefault, this function is called
103 * whenever an error is raised by the Error module.
104 *
105 * Pick one:
106 * - Error.print (default)
107 * Errors are formatted and output via System_printf() for easier
108 * debugging.
109 * - null
110 * Errors are not formatted or logged. This option reduces code footprint.
111 * - non-null function
112 * Errors invoke custom user function. See the Error module documentation
113 * for more details.
114 */
115//Error.raiseHook = Error.print;
116Error.raiseHook = null;
117//Error.raiseHook = "&myErrorFxn";
118
119/*
120 * If Error.policyFxn is set to Error.policyDefault, this option applies to the
121 * maximum number of times the Error.raiseHook function can be recursively
122 * invoked. This option limits the possibility of an infinite recursion that
123 * could lead to a stack overflow.
124 * The default value is 16.
125 */
126Error.maxDepth = 2;
127
128
129
130/* ================ Hwi configuration ================ */
131var halHwi = xdc.useModule('ti.sysbios.hal.Hwi');
132var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
133/*
134 * Checks for Hwi (system) stack overruns while in the Idle loop.
135 *
136 * Pick one:
137 * - true (default)
138 * Checks the top word for system stack overflows during the idle loop and
139 * raises an Error if one is detected.
140 * - false
141 * Disabling the runtime check improves runtime performance and yields a
142 * reduced flash footprint.
143 */
144//halHwi.checkStackFlag = true;
145halHwi.checkStackFlag = false;
146
147/*
148 * The following options alter the system's behavior when a hardware exception
149 * is detected.
150 *
151 * Pick one:
152 * - Hwi.enableException = true
153 * This option causes the default m3Hwi.excHandlerFunc function to fully
154 * decode an exception and dump the registers to the system console.
155 * This option raises errors in the Error module and displays the
156 * exception in ROV.
157 * - Hwi.enableException = false
158 * This option reduces code footprint by not decoding or printing the
159 * exception to the system console.
160 * It however still raises errors in the Error module and displays the
161 * exception in ROV.
162 * - Hwi.excHandlerFunc = null
163 * This is the most aggressive option for code footprint savings; but it
164 * can difficult to debug exceptions. It reduces flash footprint by
165 * plugging in a default while(1) trap when exception occur. This option
166 * does not raise an error with the Error module.
167 */
168//m3Hwi.enableException = true;
169//m3Hwi.enableException = false;
170m3Hwi.excHandlerFunc = null;
171
172/*
173 * Enable hardware exception generation when dividing by zero.
174 *
175 * Pick one:
176 * - 0 (default)
177 * Disables hardware exceptions when dividing by zero
178 * - 1
179 * Enables hardware exceptions when dividing by zero
180 */
181m3Hwi.nvicCCR.DIV_0_TRP = 0;
182//m3Hwi.nvicCCR.DIV_0_TRP = 1;
183
184/*
185 * Enable hardware exception generation for invalid data alignment.
186 *
187 * Pick one:
188 * - 0 (default)
189 * Disables hardware exceptions for data alignment
190 * - 1
191 * Enables hardware exceptions for data alignment
192 */
193m3Hwi.nvicCCR.UNALIGN_TRP = 0;
194//m3Hwi.nvicCCR.UNALIGN_TRP = 1;
195
196/*
197 * Assign an address for the reset vector.
198 *
199 * Default is 0x0, which is the start of Flash. Ordinarily this setting should
200 * not be changed.
201 */
202m3Hwi.resetVectorAddress = 0x0;
203
204/*
205 * Assign an address for the vector table in RAM.
206 *
207 * The default is the start of RAM. This table is placed in RAM so interrupts
208 * can be added at runtime.
209 *
210 * Note: To change, verify address in the device specific datasheets'
211 * memory map.
212 */
213m3Hwi.vectorTableAddress = 0x20000000;
214
215
216
217/* ================ Idle configuration ================ */
218var Idle = xdc.useModule('ti.sysbios.knl.Idle');
219/*
220 * The Idle module is used to specify a list of functions to be called when no
221 * other tasks are running in the system.
222 *
223 * Functions added here will be run continuously within the idle task.
224 *
225 * Function signature:
226 * Void func(Void);
227 */
228//Idle.addFunc("&myIdleFunc");
229Idle.addFunc('&uartPrintf_flush'); // BMH flushing function.
230
231
232/* ================ Kernel (SYS/BIOS) configuration ================ */
233var BIOS = xdc.useModule('ti.sysbios.BIOS');
234/*
235 * Enable asserts in the BIOS library.
236 *
237 * Pick one:
238 * - true (default)
239 * Enables asserts for debugging purposes.
240 * - false
241 * Disables asserts for a reduced code footprint and better performance.
242 *
243 * When using BIOS in ROM:
244 * This option must be set to false.
245 */
246//BIOS.assertsEnabled = true;
247BIOS.assertsEnabled = false;
248
249/*
250 * Specify default heap size for BIOS.
251 */
252BIOS.heapSize = 1024;
253
254/*
255 * Specify default CPU Frequency.
256 */
257BIOS.cpuFreq.lo = 48000000;
258
259/*
260 * A flag to determine if xdc.runtime sources are to be included in a custom
261 * built BIOS library.
262 *
263 * Pick one:
264 * - false (default)
265 * The pre-built xdc.runtime library is provided by the respective target
266 * used to build the application.
267 * - true
268 * xdc.runtime library sources are to be included in the custom BIOS
269 * library. This option yields the most efficient library in both code
270 * footprint and runtime performance.
271 */
272//BIOS.includeXdcRuntime = false;
273BIOS.includeXdcRuntime = true;
274
275/*
276 * The SYS/BIOS runtime is provided in the form of a library that is linked
277 * with the application. Several forms of this library are provided with the
278 * SYS/BIOS product.
279 *
280 * Pick one:
281 * - BIOS.LibType_Custom
282 * Custom built library that is highly optimized for code footprint and
283 * runtime performance.
284 * - BIOS.LibType_Debug
285 * Custom built library that is non-optimized that can be used to
286 * single-step through APIs with a debugger.
287 *
288 */
289BIOS.libType = BIOS.LibType_Custom;
290//BIOS.libType = BIOS.LibType_Debug;
291
292/*
293 * Runtime instance creation enable flag.
294 *
295 * Pick one:
296 * - true (default)
297 * Allows Mod_create() and Mod_delete() to be called at runtime which
298 * requires a default heap for dynamic memory allocation.
299 * - false
300 * Reduces code footprint by disallowing Mod_create() and Mod_delete() to
301 * be called at runtime. Object instances are constructed via
302 * Mod_construct() and destructed via Mod_destruct().
303 *
304 * When using BIOS in ROM:
305 * This option must be set to true.
306 */
307BIOS.runtimeCreatesEnabled = true;
308//BIOS.runtimeCreatesEnabled = false;
309
310/*
311 * Enable logs in the BIOS library.
312 *
313 * Pick one:
314 * - true (default)
315 * Enables logs for debugging purposes.
316 * - false
317 * Disables logging for reduced code footprint and improved runtime
318 * performance.
319 *
320 * When using BIOS in ROM:
321 * This option must be set to false.
322 */
323//BIOS.logsEnabled = true;
324BIOS.logsEnabled = false;
325
326
327
328/* ================ Memory configuration ================ */
329var Memory = xdc.useModule('xdc.runtime.Memory');
330/*
331 * The Memory module itself simply provides a common interface for any
332 * variety of system and application specific memory management policies
333 * implemented by the IHeap modules(Ex. HeapMem, HeapBuf).
334 */
335
336
337
338/* ================ Program configuration ================ */
339/*
340 * Program.stack is ignored with IAR. Use the project options in
341 * IAR Embedded Workbench to alter the system stack size.
342 */
343if (!Program.build.target.$name.match(/iar/)) {
344 /*
345 * Reducing the system stack size (used by ISRs and Swis) to reduce
346 * RAM usage.
347 */
348 Program.stack = 768;
349}
350
351
352
353/*
354 * Uncomment to enable Semihosting for GNU targets to print to the CCS console.
355 * Please read the following TIRTOS Wiki page for more information on Semihosting:
356 * http://processors.wiki.ti.com/index.php/TI-RTOS_Examples_SemiHosting
357 */
358
359if (Program.build.target.$name.match(/gnu/)) {
360 //var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
361}
362
363/* ================ ROM configuration ================ */
364/*
365 * To use BIOS in flash, comment out the code block below.
366 */
367var ROM = xdc.useModule('ti.sysbios.rom.ROM');
368if (Program.cpu.deviceName.match(/CC26/)) {
369 ROM.romName = ROM.CC2650;
370}
371else if (Program.cpu.deviceName.match(/CC13/)) {
372 ROM.romName = ROM.CC1350;
373}
374
375
376
377/* ================ Semaphore configuration ================ */
378var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
379/*
380 * Enables global support for Task priority pend queuing.
381 *
382 * Pick one:
383 * - true (default)
384 * This allows pending tasks to be serviced based on their task priority.
385 * - false
386 * Pending tasks are services based on first in, first out basis.
387 *
388 * When using BIOS in ROM:
389 * This option must be set to false.
390 */
391//Semaphore.supportsPriority = true;
392Semaphore.supportsPriority = false;
393
394/*
395 * Allows for the implicit posting of events through the semaphore,
396 * disable for additional code saving.
397 *
398 * Pick one:
399 * - true
400 * This allows the Semaphore module to post semaphores and events
401 * simultaneously.
402 * - false (default)
403 * Events must be explicitly posted to unblock tasks.
404 *
405 * When using BIOS in ROM:
406 * This option must be set to false.
407 */
408//Semaphore.supportsEvents = true;
409Semaphore.supportsEvents = false;
410
411
412
413/* ================ Swi configuration ================ */
414var Swi = xdc.useModule('ti.sysbios.knl.Swi');
415/*
416 * A software interrupt is an object that encapsulates a function to be
417 * executed and a priority. Software interrupts are prioritized, preempt tasks
418 * and are preempted by hardware interrupt service routines.
419 *
420 * This module is included to allow Swi's in a users' application.
421 */
422
423/*
424 * Reduce the number of swi priorities from the default of 16.
425 * Decreasing the number of swi priorities yields memory savings.
426 */
427Swi.numPriorities = 6;
428
429
430
431/* ================ System configuration ================ */
432var System = xdc.useModule('xdc.runtime.System');
433/*
434 * The Abort handler is called when the system exits abnormally.
435 *
436 * Pick one:
437 * - System.abortStd (default)
438 * Call the ANSI C Standard 'abort()' to terminate the application.
439 * - System.abortSpin
440 * A lightweight abort function that loops indefinitely in a while(1) trap
441 * function.
442 * - A custom abort handler
443 * A user-defined function. See the System module documentation for
444 * details.
445 */
446//System.abortFxn = System.abortStd;
447System.abortFxn = System.abortSpin;
448//System.abortFxn = "&myAbortSystem";
449
450/*
451 * The Exit handler is called when the system exits normally.
452 *
453 * Pick one:
454 * - System.exitStd (default)
455 * Call the ANSI C Standard 'exit()' to terminate the application.
456 * - System.exitSpin
457 * A lightweight exit function that loops indefinitely in a while(1) trap
458 * function.
459 * - A custom exit function
460 * A user-defined function. See the System module documentation for
461 * details.
462 */
463//System.exitFxn = System.exitStd;
464System.exitFxn = System.exitSpin;
465//System.exitFxn = "&myExitSystem";
466
467/*
468 * Minimize exit handler array in the System module. The System module includes
469 * an array of functions that are registered with System_atexit() which is
470 * called by System_exit(). The default value is 8.
471 */
472System.maxAtexitHandlers = 0;
473
474/*
475 * The System.SupportProxy defines a low-level implementation of System
476 * functions such as System_printf(), System_flush(), etc.
477 *
478 * Pick one pair:
479 * - SysMin
480 * This module maintains an internal configurable circular buffer that
481 * stores the output until System_flush() is called.
482 * The size of the circular buffer is set via SysMin.bufSize.
483 * - SysCallback
484 * SysCallback allows for user-defined implementations for System APIs.
485 * The SysCallback support proxy has a smaller code footprint and can be
486 * used to supply custom System_printf services.
487 * The default SysCallback functions point to stub functions. See the
488 * SysCallback module's documentation.
489 */
490//var SysMin = xdc.useModule('xdc.runtime.SysMin');
491//SysMin.bufSize = 128;
492//System.SupportProxy = SysMin;
493var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
494System.SupportProxy = SysCallback;
495//SysCallback.abortFxn = "&myUserAbort";
496//SysCallback.exitFxn = "&myUserExit";
497//SysCallback.flushFxn = "&myUserFlush";
498//SysCallback.putchFxn = "&myUserPutch";
499SysCallback.putchFxn = "&uartPrintf_putch"; // BMH Modified
500//SysCallback.readyFxn = "&myUserReady";
501
502
503
504/* ================ Task configuration ================ */
505var Task = xdc.useModule('ti.sysbios.knl.Task');
506/*
507 * Check task stacks for overflow conditions.
508 *
509 * Pick one:
510 * - true (default)
511 * Enables runtime checks for task stack overflow conditions during
512 * context switching ("from" and "to")
513 * - false
514 * Disables runtime checks for task stack overflow conditions.
515 *
516 * When using BIOS in ROM:
517 * This option must be set to false.
518 */
519//Task.checkStackFlag = true;
520Task.checkStackFlag = false;
521
522/*
523 * Set the default task stack size when creating tasks.
524 *
525 * The default is dependent on the device being used. Reducing the default stack
526 * size yields greater memory savings.
527 */
528Task.defaultStackSize = 512;
529
530/*
531 * Enables the idle task.
532 *
533 * Pick one:
534 * - true (default)
535 * Creates a task with priority of 0 which calls idle hook functions. This
536 * option must be set to true to gain power savings provided by the Power
537 * module.
538 * - false
539 * No idle task is created. This option consumes less memory as no
540 * additional default task stack is needed.
541 * To gain power savings by the Power module without having the idle task,
542 * add Idle.run as the Task.allBlockedFunc.
543 */
544Task.enableIdleTask = true;
545//Task.enableIdleTask = false;
546//Task.allBlockedFunc = Idle.run;
547
548/*
549 * If Task.enableIdleTask is set to true, this option sets the idle task's
550 * stack size.
551 *
552 * Reducing the idle stack size yields greater memory savings.
553 */
554Task.idleTaskStackSize = 512;
555
556/*
557 * Reduce the number of task priorities.
558 * The default is 16.
559 * Decreasing the number of task priorities yield memory savings.
560 */
561Task.numPriorities = 4;
562
563
564
565/* ================ Text configuration ================ */
566var Text = xdc.useModule('xdc.runtime.Text');
567/*
568 * These strings are placed in the .const section. Setting this parameter to
569 * false will save space in the .const section. Error, Assert and Log messages
570 * will print raw ids and args instead of a formatted message.
571 *
572 * Pick one:
573 * - true (default)
574 * This option loads test string into the .const for easier debugging.
575 * - false
576 * This option reduces the .const footprint.
577 */
578//Text.isLoaded = true;
579Text.isLoaded = false;
580
581
582
583/* ================ Types configuration ================ */
584var Types = xdc.useModule('xdc.runtime.Types');
585/*
586 * This module defines basic constants and types used throughout the
587 * xdc.runtime package.
588 */
589
590
591
592/* ================ TI-RTOS middleware configuration ================ */
593var mwConfig = xdc.useModule('ti.mw.Config');
594/*
595 * Include TI-RTOS middleware libraries
596 */
597
598
599
600/* ================ TI-RTOS drivers' configuration ================ */
601var driversConfig = xdc.useModule('ti.drivers.Config');
602/*
603 * Include TI-RTOS drivers
604 *
605 * Pick one:
606 * - driversConfig.LibType_NonInstrumented (default)
607 * Use TI-RTOS drivers library optimized for footprint and performance
608 * without asserts or logs.
609 * - driversConfig.LibType_Instrumented
610 * Use TI-RTOS drivers library for debugging with asserts and logs enabled.
611 */
612driversConfig.libType = driversConfig.LibType_NonInstrumented;
613//driversConfig.libType = driversConfig.LibType_Instrumented;
614
615
616
617/* ================ Application Specific Instances ================ */
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.cmd b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.cmd
new file mode 100644
index 0000000..c30c09f
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.cmd
@@ -0,0 +1,88 @@
1/*
2 * Copyright (c) 2015-2016, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32/*
33 * ======== CC2650_LAUNCHXL.cmd ========
34 * CC26x0F128 PG2 linker configuration file for Code Composer Studio
35 */
36
37/* Override default entry point. */
38--entry_point ResetISR
39/* Allow main() to take args */
40--args 0x8
41/* Suppress warnings and errors: */
42/* - 10063: Warning about entry point not being _c_int00 */
43/* - 16011, 16012: 8-byte alignment errors. Observed when linking in object */
44/* files compiled using Keil (ARM compiler) */
45--diag_suppress=10063,16011,16012
46
47/* The starting address of the application. Normally the interrupt vectors */
48/* must be located at the beginning of the application. */
49#define FLASH_BASE 0x0
50#define FLASH_SIZE 0x20000
51#define RAM_BASE 0x20000000
52#define RAM_SIZE 0x5000
53
54/* System memory map */
55
56MEMORY
57{
58 /* Application stored in and executes from internal flash */
59 FLASH (RX) : origin = FLASH_BASE, length = FLASH_SIZE
60 /* Application uses internal RAM for data */
61 SRAM (RWX) : origin = RAM_BASE, length = RAM_SIZE
62}
63
64/* Section allocation in memory */
65
66SECTIONS
67{
68 .text : > FLASH
69 .const : > FLASH
70 .constdata : > FLASH
71 .rodata : > FLASH
72 .cinit : > FLASH
73 .pinit : > FLASH
74 .init_array : > FLASH
75 .emb_text : > FLASH
76 .ccfg : > FLASH (HIGH)
77
78#ifdef __TI_COMPILER_VERSION__
79#if __TI_COMPILER_VERSION__ >= 15009000
80 .TI.ramfunc : {} load=FLASH, run=SRAM, table(BINIT)
81#endif
82#endif
83 .data : > SRAM
84 .bss : > SRAM
85 .sysmem : > SRAM
86 .stack : > SRAM (HIGH)
87 .nonretenvar : > SRAM
88}
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.h b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.h
new file mode 100644
index 0000000..1ab67d2
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/CC2650_I3M.h
@@ -0,0 +1,324 @@
1/*
2 * Copyright (c) 2015-2016, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32/** ============================================================================
33 * @file CC2650_I3MOTE.h
34 *
35 * @brief CC2650 LaunchPad Board Specific header file.
36 *
37 * NB! This is the board file for CC2650 LaunchPad PCB version 1.1
38 *
39 * ============================================================================
40 */
41#ifndef __CC2650_I3MOTE_BOARD_H__
42#define __CC2650_I3MOTE_BOARD_H__
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48/** ============================================================================
49 * Includes
50 * ==========================================================================*/
51#include <ti/drivers/PIN.h>
52#include <driverlib/ioc.h>
53
54/** ============================================================================
55 * Externs
56 * ==========================================================================*/
57extern const PIN_Config BoardGpioInitTable[];
58
59/** ============================================================================
60 * Defines
61 * ==========================================================================*/
62
63/* Same RF Configuration as 7x7 EM */
64#define CC2650EM_7ID
65#define CC2650_I3MOTE
66
67
68/* Sensors */
69#define Board_INA219_ADDR (0x41)
70#define Board_HDC1000_ADDR (0x43)
71#define Board_HDC1080_ADDR (0x40)
72#define Board_TMP007_ADDR (0x44)
73#define Board_OPT3001_ADDR (0x45)
74#define Board_MPU9250_ADDR (0x68)
75#define Board_BMP280_ADDR (0x77)
76
77
78/* Mapping of pins to board signals using general board aliases
79 * <board signal alias> <pin mapping>
80 */
81/* Discrete outputs */
82/* I2C */
83
84#define Board_I2C0_SDA0 IOID_23
85#define Board_I2C0_SCL0 IOID_24
86
87#define Board_LEDR IOID_5
88#define Board_LEDG IOID_6
89
90#define Board_LED_ON 1
91#define Board_LED_OFF 0
92
93/* Discrete inputs */
94#define Board_BTN1 IOID_4
95#define Board_BTN2 PIN_UNASSIGNED
96
97/* Debug UART */
98#define Board_UART_RX IOID_2 /* RXD */
99#define Board_UART_TX IOID_3 /* TXD */
100
101/* DAC8730 UART */
102//#define Board_UART_TX IOID_8 /* TCD to DAC*/
103//#define Board_UART_RX IOID_9 /* RXD from DAC */
104
105/* SPI Board */
106#define Board_SPI0_IRQ IOID_10
107#define Board_SPI0_MISO IOID_12
108#define Board_SPI0_MOSI IOID_13
109#define Board_SPI0_CLK IOID_14
110#define Board_SPI0_CSN IOID_15
111
112#define Board_SPI1_MISO IOID_18
113#define Board_SPI1_MOSI IOID_19
114#define Board_SPI1_CLK IOID_20
115#define Board_SPI1_CSN IOID_21
116#define Board_SPI1_IRQ IOID_22
117
118/* Power */
119//#define Board_DIO0 IOID_0 // VCCIO_DAC
120//#define Board_DIO1 IOID_1 // GPS_PWR_nEN
121//#define Board_DIO7 IOID_7 // EH_nBYPASS
122//#define Board_DIO25 IOID_25 // SSM_PWR_nEN
123//#define Board_DIO26 IOID_26 // GPS_PWR_nEN
124//#define Board_DIO27 IOID_27 // VBAT_OK
125//#define Board_DIO28 IOID_28 // SSM_5V_EN
126
127/* Misc */
128//#define Board_DIO11 IOID_11 // BSL
129//#define Board_DIO16 IOID_16 // JTAG_TDO
130//#define Board_DIO17 IOID_17 // JTAG_TDI
131
132
133
134/* Analog */
135#define Board_DIO23_ANALOG PIN_UNASSIGNED
136#define Board_DIO24_ANALOG PIN_UNASSIGNED
137#define Board_DIO25_ANALOG PIN_UNASSIGNED
138#define Board_DIO26_ANALOG PIN_UNASSIGNED
139#define Board_DIO27_ANALOG PIN_UNASSIGNED
140#define Board_DIO28_ANALOG PIN_UNASSIGNED
141#define Board_DIO29_ANALOG PIN_UNASSIGNED
142#define Board_DIO30_ANALOG PIN_UNASSIGNED
143
144
145/* PWM outputs */
146#define Board_PWMPIN0 PIN_UNASSIGNED
147#define Board_PWMPIN1 PIN_UNASSIGNED
148#define Board_PWMPIN2 PIN_UNASSIGNED
149#define Board_PWMPIN3 PIN_UNASSIGNED
150#define Board_PWMPIN4 PIN_UNASSIGNED
151#define Board_PWMPIN5 PIN_UNASSIGNED
152#define Board_PWMPIN6 PIN_UNASSIGNED
153#define Board_PWMPIN7 PIN_UNASSIGNED
154
155
156/** ============================================================================
157 * Instance identifiers
158 * ==========================================================================*/
159/* Generic I2C instance identifiers */
160#define Board_I2C CC2650_I3MOTE_I2C0
161/* Generic SPI instance identifiers */
162#define Board_SPI0 CC2650_I3MOTE_SPI0
163#define Board_SPI1 CC2650_I3MOTE_SPI1
164/* Generic UART instance identifiers */
165#define Board_UART CC2650_I3MOTE_UART0
166/* Generic Crypto instance identifiers */
167#define Board_CRYPTO CC2650_I3MOTE_CRYPTO0
168/* Generic GPTimer instance identifiers */
169#define Board_GPTIMER0A CC2650_I3MOTE_GPTIMER0A
170#define Board_GPTIMER0B CC2650_I3MOTE_GPTIMER0B
171#define Board_GPTIMER1A CC2650_I3MOTE_GPTIMER1A
172#define Board_GPTIMER1B CC2650_I3MOTE_GPTIMER1B
173#define Board_GPTIMER2A CC2650_I3MOTE_GPTIMER2A
174#define Board_GPTIMER2B CC2650_I3MOTE_GPTIMER2B
175#define Board_GPTIMER3A CC2650_I3MOTE_GPTIMER3A
176#define Board_GPTIMER3B CC2650_I3MOTE_GPTIMER3B
177/* Generic PWM instance identifiers */
178#define Board_PWM0 CC2650_I3MOTE_PWM0
179#define Board_PWM1 CC2650_I3MOTE_PWM1
180#define Board_PWM2 CC2650_I3MOTE_PWM2
181#define Board_PWM3 CC2650_I3MOTE_PWM3
182#define Board_PWM4 CC2650_I3MOTE_PWM4
183#define Board_PWM5 CC2650_I3MOTE_PWM5
184#define Board_PWM6 CC2650_I3MOTE_PWM6
185#define Board_PWM7 CC2650_I3MOTE_PWM7
186
187/** ============================================================================
188 * Number of peripherals and their names
189 * ==========================================================================*/
190
191/*!
192 * @def CC2650_I3MOTE_I2CName
193 * @brief Enum of I2C names on the CC2650 dev board
194 */
195typedef enum CC2650_I3MOTE_I2CName {
196 CC2650_I3MOTE_I2C0 = 0,
197
198 CC2650_I3MOTE_I2CCOUNT
199} CC2650_I3MOTE_I2CName;
200
201/*!
202 * @def CC2650_I3MOTE_CryptoName
203 * @brief Enum of Crypto names on the CC2650 dev board
204 */
205typedef enum CC2650_I3MOTE_CryptoName {
206 CC2650_I3MOTE_CRYPTO0 = 0,
207
208 CC2650_I3MOTE_CRYPTOCOUNT
209} CC2650_I3MOTE_CryptoName;
210
211
212/*!
213 * @def CC2650_I3MOTE_SPIName
214 * @brief Enum of SPI names on the CC2650 dev board
215 */
216typedef enum CC2650_I3MOTE_SPIName {
217 CC2650_I3MOTE_SPI0 = 0,
218 CC2650_I3MOTE_SPI1,
219
220 CC2650_I3MOTE_SPICOUNT
221} CC2650_I3MOTE_SPIName;
222
223/*!
224 * @def CC2650_I3MOTE_UARTName
225 * @brief Enum of UARTs on the CC2650 dev board
226 */
227typedef enum CC2650_I3MOTE_UARTName {
228 CC2650_I3MOTE_UART0 = 0,
229
230 CC2650_I3MOTE_UARTCOUNT
231} CC2650_I3MOTE_UARTName;
232
233/*!
234 * @def CC2650_I3MOTE_UdmaName
235 * @brief Enum of DMA buffers
236 */
237typedef enum CC2650_I3MOTE_UdmaName {
238 CC2650_I3MOTE_UDMA0 = 0,
239
240 CC2650_I3MOTE_UDMACOUNT
241} CC2650_I3MOTE_UdmaName;
242
243/*!
244 * @def CC2650_I3MOTE_GPTimerName
245 * @brief Enum of GPTimer parts
246 */
247typedef enum CC2650_I3MOTE_GPTimerName
248{
249 CC2650_I3MOTE_GPTIMER0A = 0,
250 CC2650_I3MOTE_GPTIMER0B,
251 CC2650_I3MOTE_GPTIMER1A,
252 CC2650_I3MOTE_GPTIMER1B,
253 CC2650_I3MOTE_GPTIMER2A,
254 CC2650_I3MOTE_GPTIMER2B,
255 CC2650_I3MOTE_GPTIMER3A,
256 CC2650_I3MOTE_GPTIMER3B,
257 CC2650_I3MOTE_GPTIMERPARTSCOUNT
258} CC2650_I3MOTE_GPTimerName;
259
260/*!
261 * @def CC2650_I3MOTE_GPTimers
262 * @brief Enum of GPTimers
263 */
264typedef enum CC2650_I3MOTE_GPTimers
265{
266 CC2650_I3MOTE_GPTIMER0 = 0,
267 CC2650_I3MOTE_GPTIMER1,
268 CC2650_I3MOTE_GPTIMER2,
269 CC2650_I3MOTE_GPTIMER3,
270 CC2650_I3MOTE_GPTIMERCOUNT
271} CC2650_I3MOTE_GPTimers;
272
273/*!
274 * @def CC2650_I3MOTE_PWM
275 * @brief Enum of PWM outputs on the board
276 */
277typedef enum CC2650_I3MOTE_PWM
278{
279 CC2650_I3MOTE_PWM0 = 0,
280 CC2650_I3MOTE_PWM1,
281 CC2650_I3MOTE_PWM2,
282 CC2650_I3MOTE_PWM3,
283 CC2650_I3MOTE_PWM4,
284 CC2650_I3MOTE_PWM5,
285 CC2650_I3MOTE_PWM6,
286 CC2650_I3MOTE_PWM7,
287 CC2650_I3MOTE_PWMCOUNT
288} CC2650_I3MOTE_PWM;
289
290/*!
291 * @def CC2650_I3MOTE_ADCBufName
292 * @brief Enum of ADCs
293 */
294typedef enum CC2650_I3MOTE_ADCBufName {
295 CC2650_I3MOTE_ADCBuf0 = 0,
296 CC2650_I3MOTE_ADCBufCOUNT
297} CC2650_I3MOTE_ADCBufName;
298
299
300/*!
301 * @def CC2650_I3MOTE_ADCName
302 * @brief Enum of ADCs
303 */
304typedef enum CC2650_I3MOTE_ADCName {
305 CC2650_I3MOTE_ADC0 = 0,
306 CC2650_I3MOTE_ADC1,
307 CC2650_I3MOTE_ADC2,
308 CC2650_I3MOTE_ADC3,
309 CC2650_I3MOTE_ADC4,
310 CC2650_I3MOTE_ADC5,
311 CC2650_I3MOTE_ADC6,
312 CC2650_I3MOTE_ADC7,
313 CC2650_I3MOTE_ADCDCOUPL,
314 CC2650_I3MOTE_ADCVSS,
315 CC2650_I3MOTE_ADCVDDS,
316 CC2650_I3MOTE_ADCCOUNT
317} CC2650_I3MOTE_ADCName;
318
319
320#ifdef __cplusplus
321}
322#endif
323
324#endif /* __CC2650_I3MOTE_BOARD_H__ */
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/ccfg.c b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/ccfg.c
new file mode 100644
index 0000000..40b80b0
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/ccfg.c
@@ -0,0 +1,57 @@
1/*
2 * Copyright (c) 2015, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/*
34 * ======== ccfg.c ========
35 * Customer Configuration for CC26xx and CC13xx devices. This file is used to
36 * configure Boot ROM, start-up code, and SW radio behaviour.
37 *
38 * By default, driverlib startup_files/ccfg.c settings are used. However, if
39 * changes are required there are two means to do so:
40 *
41 * 1. Remove this file and copy driverlib's startup_files/ccfg.c file in
42 * its place. Make all changes to the file. Changes made are local to
43 * the project and will not affect other projects.
44 *
45 * 2. Perform changes to driverlib startup_files/ccfg.c file. Changes
46 * made to this file will be applied to all projects. This file must
47 * remain unmodified.
48 */
49
50
51#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 // Enable ROM boot loader
52#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00 // Active low to open boot loader backdoor
53#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER 0x0B // DIO number for boot loader backdoor
54#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 // Enabled boot loader backdoor
55
56
57#include <startup_files/ccfg.c>
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/main.c b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/main.c
new file mode 100644
index 0000000..9f25b51
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/main.c
@@ -0,0 +1,291 @@
1/*
2 * ======== empty_min.c ========
3 */
4/* XDCtools Header files */
5#include <xdc/std.h>
6#include <xdc/runtime/System.h>
7
8/* BIOS Header files */
9#include <ti/sysbios/BIOS.h>
10#include <ti/sysbios/knl/Task.h>
11#include <ti/sysbios/knl/Clock.h>
12#include <ti/sysbios/knl/Semaphore.h>
13
14/* TI-RTOS Header files */
15#include <ti/drivers/I2C.h>
16#include <ti/drivers/PIN.h>
17// #include <ti/drivers/SPI.h>
18#include <ti/drivers/UART.h>
19// #include <ti/drivers/Watchdog.h>
20
21/* Board Header files */
22#include "Board.h"
23
24#include "uart_printf.h"
25
26#define TASKSTACKSIZE 2048
27
28Task_Struct task0Struct;
29Char task0Stack[TASKSTACKSIZE];
30
31Task_Struct task1Struct;
32Char task1Stack[TASKSTACKSIZE];
33
34#define OPT3001
35#define HDC1080
36#define BMP280
37#define MPU9250
38#define TMP007
39
40/* Pin driver handle */
41static PIN_Handle ledPinHandle;
42static PIN_State ledPinState;
43
44/* Semaphore */
45Semaphore_Struct semStruct;
46Semaphore_Handle semHandle;
47
48/*
49 * Application LED pin configuration table:
50 * - All LEDs board LEDs are off.
51 */
52PIN_Config ledPinTable[] = {
53 Board_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
54 Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
55 PIN_TERMINATE
56};
57
58Void taskFxn(UArg arg0, UArg arg1)
59{
60 uint8_t txBuffer[1];
61 uint8_t rxBuffer[2];
62 I2C_Handle i2c;
63 I2C_Params i2cParams;
64 I2C_Transaction i2cTransaction;
65
66 /* Create I2C for usage */
67 I2C_Params_init(&i2cParams);
68 i2cParams.bitRate = I2C_100kHz;
69 i2c = I2C_open(Board_I2C0, &i2cParams);
70 if (i2c == NULL) {
71 System_abort("Error Initializing I2C\r\n");
72 }
73
74 //while(1) {
75 {
76
77#ifdef OPT3001
78 /* OPT3001 */
79 txBuffer[0] = 0x7E;
80 i2cTransaction.slaveAddress = Board_OPT3001_ADDR;
81 i2cTransaction.writeBuf = txBuffer;
82 i2cTransaction.writeCount = 1;
83 i2cTransaction.readBuf = rxBuffer;
84 i2cTransaction.readCount = 2;
85
86 if (I2C_transfer(i2c, &i2cTransaction)) {
87 uint16_t data = (rxBuffer[0] << 8) | (rxBuffer[1] << 0);
88 if (data != 0x5449) {
89 PIN_setOutputValue(ledPinHandle, Board_LED0,1);
90 Task_exit();
91 }
92 System_printf("OPT3001 ID 0x5449: %x\r\n",data);
93 }else{
94 PIN_setOutputValue(ledPinHandle, Board_LED0,1);
95 Task_exit();
96 }
97
98#endif
99
100#ifdef HDC1080
101 //txBuffer[0] = 0xFE;
102 txBuffer[0] = 0xFF;
103 i2cTransaction.slaveAddress = Board_HDC1080_ADDR;
104 i2cTransaction.writeBuf = txBuffer;
105 i2cTransaction.writeCount = 1;
106 i2cTransaction.readBuf = rxBuffer;
107 i2cTransaction.readCount = 2;
108
109 if (I2C_transfer(i2c, &i2cTransaction)) {
110 uint16_t data = (rxBuffer[0] << 8) | (rxBuffer[1] << 0);
111 if (data != 0x1050) {
112 PIN_setOutputValue(ledPinHandle, Board_LED0,1);
113 Task_exit();
114 }
115 //System_printf("HDC1080 Manufactured ID 0x5449: %x\n",data);
116 System_printf("HDC1080 Device ID 0x1050: %x\r\n",data);
117 }
118 else{
119 PIN_setOutputValue(ledPinHandle, Board_LED0,1);
120 Task_exit();
121 }
122#endif
123
124#ifdef TMP007
125 //txBuffer[0] = 0xFE;
126 /*
127 txBuffer[0] = 0x1E;
128 i2cTransaction.slaveAddress = Board_TMP007_ADDR;
129 i2cTransaction.writeBuf = txBuffer;
130 i2cTransaction.writeCount = 1;
131 i2cTransaction.readBuf = rxBuffer;
132 i2cTransaction.readCount = 2;
133
134 if (I2C_transfer(i2c, &i2cTransaction)) {
135 uint16_t data = (rxBuffer[0] << 8) | (rxBuffer[1] << 0);
136 if (data != 0x5449) {
137 PIN_setOutputValue(ledPinHandle, Board_LED0,1);
138 Task_exit();
139 }
140 System_printf("TMP007 Manufactured ID 0x5449: %x\r\n",data);
141 }else{
142 PIN_setOutputValue(ledPinHandle, Board_LED0,1);
143 Task_exit();
144 }
145
146 */
147
148 txBuffer[0] = 0x1F;
149 i2cTransaction.slaveAddress = Board_TMP007_ADDR;
150 i2cTransaction.writeBuf = txBuffer;
151 i2cTransaction.writeCount = 1;
152 i2cTransaction.readBuf = rxBuffer;
153 i2cTransaction.readCount = 2;
154
155 if (I2C_transfer(i2c, &i2cTransaction)) {
156 uint16_t data = (rxBuffer[0] << 8) | (rxBuffer[1] << 0);
157 if (data != 0x0078) {
158 PIN_setOutputValue(ledPinHandle, Board_LED0,1);
159 Task_exit();
160 }
161 System_printf("TMP007 Device ID 0x0078: %x\r\n",data);
162 }else{
163 PIN_setOutputValue(ledPinHandle, Board_LED0,1);
164 Task_exit();
165 }
166
167#endif
168
169#ifdef BMP280
170 /* BMP280 */
171 txBuffer[0] = 0xD0;
172 i2cTransaction.slaveAddress = Board_BMP280_ADDR;
173 i2cTransaction.writeBuf = txBuffer;
174 i2cTransaction.writeCount = 1;
175 i2cTransaction.readBuf = rxBuffer;
176 i2cTransaction.readCount = 1;
177
178 if (I2C_transfer(i2c, &i2cTransaction)) {
179 uint16_t data = (rxBuffer[0]);
180 if (data != 0x58) {
181 PIN_setOutputValue(ledPinHandle, Board_LED0,1);
182 Task_exit();
183 }
184 System_printf("BMP280 ID 0x58: %x\r\n",data);
185 }else{
186 PIN_setOutputValue(ledPinHandle, Board_LED0,1);
187 Task_exit();
188 }
189#endif
190
191#ifdef MPU9250
192 txBuffer[0] = 0x75;
193 i2cTransaction.slaveAddress = Board_MPU9250_ADDR;
194 i2cTransaction.writeBuf = txBuffer;
195 i2cTransaction.writeCount = 1;
196 i2cTransaction.readBuf = rxBuffer;
197 i2cTransaction.readCount = 1;
198
199 if (I2C_transfer(i2c, &i2cTransaction)) {
200 uint8_t data = rxBuffer[0];
201 if (data != 0x71) {
202 PIN_setOutputValue(ledPinHandle, Board_LED0,1);
203 Task_exit();
204 }
205 System_printf("MPU9250 WHOIAM 0x71: %x\r\n",data);
206 }else{
207 PIN_setOutputValue(ledPinHandle, Board_LED0,1);
208 Task_exit();
209 }
210#endif
211
212 Semaphore_post(semHandle);
213 System_printf("***\r\n");
214 Task_sleep((UInt)arg0);
215 }
216
217 /* Deinitialized I2C */
218 I2C_close(i2c);
219}
220
221/*
222 * ======== heartBeatFxn ========
223 * Toggle the Board_LED0. The Task_sleep is determined by arg0 which
224 * is configured for the heartBeat Task instance.
225 */
226Void heartBeatFxn(UArg arg0, UArg arg1)
227{
228 Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
229 while (1) {
230 Task_sleep((UInt)arg0);
231 //PIN_setOutputValue(ledPinHandle, Board_LED0,!PIN_getOutputValue(Board_LED0));
232 PIN_setOutputValue(ledPinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1));
233 }
234}
235
236/*
237 * ======== main ========
238 */
239int main(void)
240{
241 Task_Params taskParams;
242 Semaphore_Params semParams;
243
244 /* Call board init functions */
245 Board_initGeneral();
246 Board_initI2C();
247 // Board_initSPI();
248 // Board_initUART();
249 // Board_initWatchdog();
250
251 UART_Params uartParams;
252 UART_Params_init(&uartParams);
253 uartParams.baudRate = 115200;
254 UartPrintf_init(UART_open(Board_UART, &uartParams));
255
256 System_printf("Uart open\r\n");
257
258 /* Construct heartBeat Task thread */
259 Task_Params_init(&taskParams);
260 taskParams.arg0 = 100000 / Clock_tickPeriod;
261 taskParams.stackSize = TASKSTACKSIZE;
262 taskParams.stack = &task0Stack;
263 Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL);
264
265
266 Task_Params_init(&taskParams);
267 taskParams.arg0 = 2000000 / Clock_tickPeriod;
268 taskParams.stackSize = TASKSTACKSIZE;
269 taskParams.stack = &task1Stack;
270 Task_construct(&task1Struct, (Task_FuncPtr)taskFxn, &taskParams, NULL);
271
272 /* Construct Semaphore */
273 Semaphore_Params_init(&semParams);
274 Semaphore_construct(&semStruct, 0, &semParams);
275 semHandle = Semaphore_handle(&semStruct);
276
277
278 /* Open LED pins */
279 ledPinHandle = PIN_open(&ledPinState, ledPinTable);
280 if(!ledPinHandle) {
281 System_abort("Error initializing board LED pins\n");
282 }
283
284 PIN_setOutputValue(ledPinHandle, Board_LED0, 0);
285 PIN_setOutputValue(ledPinHandle, Board_LED1, 0);
286
287 /* Start BIOS */
288 BIOS_start();
289
290 return (0);
291}
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/uart_printf.c b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/uart_printf.c
new file mode 100644
index 0000000..140b3da
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/uart_printf.c
@@ -0,0 +1,173 @@
1/**************************************************************************************************
2 Filename: uart_printf.c
3
4 Description: This file contains the TI-RTOS hooks for printing to UART via
5 System_printf(..).
6
7 This is a very basic implementation made for the purposes of
8 terminal feedback in workshops, trainings and debug.
9
10 Copyright 2015 Texas Instruments Incorporated. All rights reserved.
11
12 IMPORTANT: Your use of this Software is limited to those specific rights
13 granted under the terms of a software license agreement between the user
14 who downloaded the software, his/her employer (which must be your employer)
15 and Texas Instruments Incorporated (the "License"). You may not use this
16 Software unless you agree to abide by the terms of the License. The License
17 limits your use, and you acknowledge, that the Software may not be modified,
18 copied or distributed unless embedded on a Texas Instruments microcontroller
19 or used solely and exclusively in conjunction with a Texas Instruments radio
20 frequency transceiver, which is integrated into your product. Other than for
21 the foregoing purpose, you may not use, reproduce, copy, prepare derivative
22 works of, modify, distribute, perform, display or sell this Software and/or
23 its documentation for any purpose.
24
25 YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
26 PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
27 INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
28 NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
29 TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
30 NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
31 LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
32 INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
33 OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
34 OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
35 (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
36
37 Should you have any questions regarding your right to use this Software,
38 contact Texas Instruments Incorporated at www.TI.com.
39**************************************************************************************************/
40
41/*********************************************************************
42 * INCLUDES
43 */
44#include <Board.h>
45#include <ti/drivers/UART.h>
46#include <ti/drivers/uart/UARTCC26XX.h>
47#include <stdint.h>
48
49/*********************************************************************
50 * CONSTANTS
51 */
52#define UART_PRINTF_BUF_LEN 1024
53
54/*********************************************************************
55 * TYPEDEFS
56 */
57
58/*********************************************************************
59 * LOCAL VARIABLES
60 */
61static uint8_t uartPrintf_outArray[UART_PRINTF_BUF_LEN];
62static uint16_t uartPrintf_head = 0;
63static uint16_t uartPrintf_tail = 0;
64static UART_Handle hUart = NULL;
65
66
67/*********************************************************************
68 * PUBLIC FUNCTIONS
69 */
70
71/*********************************************************************
72 * @fn UartPrintf_init
73 *
74 * @brief Initializes the putchar hooks with the handle to the UART.
75 *
76 * @param handle - UART driver handle to an initialized and opened UART.
77 *
78 * @return None.
79 */
80void UartPrintf_init(UART_Handle handle)
81{
82 hUart = handle;
83}
84
85/*********************************************************************
86 * SYSTEM HOOK FUNCTIONS
87 */
88
89/*********************************************************************
90 * @fn uartPrintf_putch
91 *
92 * @brief User supplied PutChar function.
93 * typedef Void (*SysCallback_PutchFxn)(Char);
94 *
95 * This function is called whenever the System module needs
96 * to output a character.
97 *
98 * This implementation fills a very basic ring-buffer, and relies
99 * on another function to flush this buffer out to UART.
100 *
101 * Requires SysCallback to be the system provider module.
102 * Initialized via SysCallback.putchFxn = "&uartPrintf_putch"; in the
103 * TI-RTOS configuration script.
104 *
105 * @param ch - Character
106 *
107 * @return None.
108 *
109 * @post ::uartPrintf_head is incremented by one with wrap at UART_PRINTF_BUF_LEN
110 * if there is room.
111 */
112void uartPrintf_putch(char ch)
113{
114 // uartPrintf_tail should never catch up with uartPrintf_head. Discard in-between bytes.
115 if ( (uartPrintf_head + 1) % UART_PRINTF_BUF_LEN == uartPrintf_tail )
116 return;
117
118 uartPrintf_outArray[uartPrintf_head] = ch;
119 uartPrintf_head++;
120
121 if (uartPrintf_head >= UART_PRINTF_BUF_LEN)
122 uartPrintf_head = 0;
123}
124
125/*********************************************************************
126 * @fn uartPrintf_flush
127 *
128 * @brief Printf-buffer flush function
129 *
130 * In this implementation it is intended to be called by the
131 * Idle task when nothing else is running.
132 *
133 * This is achieved by setting up the Idle task in the TI-RTOS
134 * configuration script like so:
135 *
136 * var Idle = xdc.useModule('ti.sysbios.knl.Idle');
137 * Idle.addFunc('&uartPrintf_flush');
138 *
139 * @param None. Relies on global state.
140 *
141 * @return None.
142 *
143 * @post ::uartPrintf_tail is incremented to where uartPrintf_head
144 * was at the time the function was called.
145 */
146void uartPrintf_flush()
147{
148 // Abort in case UART hasn't been initialized.
149 if (NULL == hUart)
150 return;
151
152 // Lock head position to avoid race conditions
153 uint16_t curHead = uartPrintf_head;
154
155 // Find out how much data must be output, and how to output it.
156 bool needWrap = curHead < uartPrintf_tail;
157 uint16_t outLen = needWrap?(UART_PRINTF_BUF_LEN-uartPrintf_tail+curHead):(curHead-uartPrintf_tail);
158
159 if (outLen)
160 {
161 if (needWrap)
162 {
163 UART_write(hUart, &uartPrintf_outArray[uartPrintf_tail], UART_PRINTF_BUF_LEN - uartPrintf_tail);
164 UART_write(hUart, uartPrintf_outArray, curHead);
165 }
166 else
167 {
168 UART_write(hUart, &uartPrintf_outArray[uartPrintf_tail], outLen);
169 }
170 }
171
172 uartPrintf_tail = curHead;
173}
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/uart_printf.h b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/uart_printf.h
new file mode 100644
index 0000000..84b82fe
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_I2C_Sensors/uart_printf.h
@@ -0,0 +1,81 @@
1/**************************************************************************************************
2 Filename: uart_printf.c
3
4 Description: This file contains the TI-RTOS hooks for printing to UART via
5 System_printf(..).
6
7 This is a very basic implementation made for the purposes of
8 terminal feedback in workshops, trainings and debug.
9
10 Copyright 2015 Texas Instruments Incorporated. All rights reserved.
11
12 IMPORTANT: Your use of this Software is limited to those specific rights
13 granted under the terms of a software license agreement between the user
14 who downloaded the software, his/her employer (which must be your employer)
15 and Texas Instruments Incorporated (the "License"). You may not use this
16 Software unless you agree to abide by the terms of the License. The License
17 limits your use, and you acknowledge, that the Software may not be modified,
18 copied or distributed unless embedded on a Texas Instruments microcontroller
19 or used solely and exclusively in conjunction with a Texas Instruments radio
20 frequency transceiver, which is integrated into your product. Other than for
21 the foregoing purpose, you may not use, reproduce, copy, prepare derivative
22 works of, modify, distribute, perform, display or sell this Software and/or
23 its documentation for any purpose.
24
25 YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
26 PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
27 INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
28 NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
29 TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
30 NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
31 LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
32 INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
33 OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
34 OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
35 (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
36
37 Should you have any questions regarding your right to use this Software,
38 contact Texas Instruments Incorporated at www.TI.com.
39**************************************************************************************************/
40
41#ifndef UART_PRINTF_H
42#define UART_PRINTF_H
43
44#ifdef __cplusplus
45extern "C"
46{
47#endif
48/*********************************************************************
49 * INCLUDES
50 */
51#include <ti/drivers/UART.h>
52
53/*********************************************************************
54 * CONSTANTS
55 */
56
57/*********************************************************************
58 * TYPEDEFS
59 */
60
61/*********************************************************************
62 * PUBLIC FUNCTIONS
63 */
64
65/*********************************************************************
66 * @fn UartPrintf_init
67 *
68 * @brief Initializes the putchar hooks with the handle to the UART.
69 *
70 * @param handle - UART driver handle to an initialized and opened UART.
71 *
72 * @return None.
73 */
74void UartPrintf_init(UART_Handle handle);
75
76
77#ifdef __cplusplus
78}
79#endif
80
81#endif // UART_PRINTF_H