summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean2015-09-10 14:49:14 -0500
committerSean2015-09-10 14:49:14 -0500
commit774e619ba8f01e4b8744c15ed56e75c56000c918 (patch)
tree140f88f9ee5ebecce16730e9cbb2d1dc293eef29
downloadrtos-task-example-master.tar.gz
rtos-task-example-master.tar.xz
rtos-task-example-master.zip
Initial CommitHEADmaster
-rw-r--r--RTOS Task Wiki_1.0_manifest.html357
-rw-r--r--notificationTask.c257
-rw-r--r--notificationTask.h79
3 files changed, 693 insertions, 0 deletions
diff --git a/RTOS Task Wiki_1.0_manifest.html b/RTOS Task Wiki_1.0_manifest.html
new file mode 100644
index 0000000..9a7d4c3
--- /dev/null
+++ b/RTOS Task Wiki_1.0_manifest.html
@@ -0,0 +1,357 @@
1<!--
2Texas Instruments Manifest Format 2.0
3-->
4
5<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
6<html>
7
8<head>
9<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
10<!-- @Start Style -->
11<!-- Default style in case someone doesnt have Internet Access -->
12<style type="text/css" id="internalStyle">
13 body, div, p {
14 font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
15 font-size: 13px;
16 line-height: 1.3;
17 }
18 body {
19 margin: 20px;
20 }
21 h1 {
22 font-size: 150%;
23 }
24 h2 {
25 font-size: 120%;
26 }
27 h3 {
28 font-size: 100%;
29 }
30 img {
31 border: 0px;
32 vertical-align: middle;
33 }
34 table, th, td, tr {
35 border: 1px solid black;
36 font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
37 font-size: 13px;
38 line-height: 1.3;
39 empty-cells: show;
40 padding: 5px;
41 }
42 table {
43 border-collapse: collapse;
44 width: 100%;
45 }
46 tr {
47 page-break-inside: avoid;
48 }
49 #TIlogoLeft {
50 background-color: black;
51 padding: 0;
52 width: 20%;
53 }
54 #TIlogoRight {
55 background-color: red;
56 padding: 0;
57 }
58 #ProductName {
59 text-align: center;
60 }
61 #ReleaseDate {
62 text-align: center;
63 }
64 .LogoSection {
65 margin: 0;
66 padding: 0;
67 }
68 .HeaderSection {
69 margin: 25px 0 25px 0;
70 padding: 0;
71 }
72 .LegendSection {
73 margin: 25px 0 25px 0;
74 }
75 .ExportSection {
76 margin: 25px 0 25px 0;
77 }
78 .DisclaimerSection {
79 margin: 25px 0 25px 0;
80 }
81 .CreditSection {
82 margin: 25px 0 25px 0;
83 }
84 .LicenseSection {
85 margin: 25px 0 25px 0;
86 }
87 .ManifestTable {
88 margin: 25px 0 25px 0;
89 }
90</style>
91<!-- Override style from TI if they have Internet Access -->
92<link type="text/css" rel="stylesheet" href="timanifeststyle.css">
93<!-- @End Style -->
94<title>Texas Instruments Manifest</title>
95</head>
96
97<body><!-- Logo display, will need to fix up the URLs, this is just for testing.. Image alternate display not wporking well yet -->
98<div class="LogoSection">
99<table>
100 <tbody>
101 <tr>
102 <td id="TIlogoLeft">
103 <a href="http://www.ti.com/">
104 <!-- img src="tilogo.gif" alt="Texas Instruments Incorporated" -->
105 <img alt="" src="data:image/gif;base64,R0lGODlh3gA2AKIAAAAAAP///7u7u29vbz8/PwYGBujo6BgYGCH5BAAAAAAALAAAAADeADYAAAP/CLrc/jDKSau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru987//AoHBILBqPyKRyyWw6n9CodHorDALYLIHKJVqz2q44eAUHtoDB4DBu48rgLQErcNtnX7NhMDcICIB3gix5ZmtqAAZZew8EAo+QkQIDNVZqiIM1cHGKZ4YPAmaiAWw0c1gFmZqjB3SbZ6kNe6WhsAeOlDV0qjSFAXUAp7lwuREFtVsFgMvLB7fNAM+BCs+lDLd8BNYOuxfV22PL0RiWlwO1u3kDqejAEsjR6GB86FsHoYwA6gxWnVgGEegUuIelWJk6jswAGlXQ36J1xBSoQwfulIEDr/6l+VeK/+AehrAGOHRnAWRBbbWegckXAV6wk4AeRQtDQBEaBYsYlMl2hUCsBt0iKgilT9EfAlfO7SmzdKkrkQUT/fqZSECqLCSlntH375IAA1tqGUilLIBSNVnU+NmJNBRVChlF1QwAdlRWBy5P3QymwCLBYhs73cTHYBq3X33nDQ2wcWuBgef0FRD4GK3jU3VCZZUJAIw1OGg0P+4bFiubOWoOsEP1+KvZn3wurDbZ6lfcuw3yYkFjRSeYzRe7ARAbW0K3PmGIMi0OFDG1Mmha+RnufAHn3xL9ha6uTZ/rXagZ1GKAtTsHeWb+FEQvHILuX4+mLzj2j2r4TrFesTwMbE5Cuv8JzbTSGuRV1xgfUJFC3WbA0JWFalcItpgf8YU2yT/qATaedent5cBb8zk0DzIitgfKbonRFV9Wp2xl3UXq5Ccibp05598BnRigiAIJmrZAexkJQIuBwzX4CB3SQbeYQkPVAUco63DI2HzsAdYAiAvEZdYlaVQ5wXs3+bQAjovEUoBRR9LVAFLaPXCcY/KMqVRasQB5kiJgLcYgTkJiuCWKC2ZpIY/z/LRhYefkBAGW1HTyRy2UjObLHxSAOZ948EUVGCSC3SLZbB7iZKOLc2GRRgMH/VhdHnJwFCgD8iEGx0VKvpqbO+hoaCppEg3UiTES1CTkhNaQ+Qs4LQGql07/lET4mIQ6SvTSVGZ9Bmhz/bkYzK+PFKtpje6wumRm1wrLZzSdQASoZvyswdmSuk7p616HfkjBTxZBQucFgqXCFKdn1NpiUlQJhs8kteBWG0AbATbXS2tBlaeoVkmJRova4KkGPmhMFdiSYmq8cbTRYhrlkiHaNufJ9mIgVqEXnAOJM5JE4sgjudQ8bF82x+cKBP4Iiedecyjgx2/WtMNjjhcL9h+S4xq9RYJgsbeeUbmdrPTSQbPccsyijEXOfI8xyuinVJH1wdkS/MQ2Bc5Iq08DyHYwGglvPyCilbz0fa8GLV7r9+Btb7CJ14Qnzg8HpdKoOOF5Py752JNXvrblNphzEHnmnF/a+ecTbA465qKPXnnppkuOeuqKr8465K+z7nrsfc9Ouyq23z5I7rrfwXvvbhSQAAA7" />
106 </a>
107 </td>
108 <td id="TILogoRight">
109 <!-- img src="titagline.gif" alt="Technology for Innovators(tm)"-->
110 <img alt="" src="data:image/gif;base64,R0lGODlhOgEaALMAAP8AAP////92dv+3t/+Njf/W1v/t7f8hIf/19f+jo//Hx/8/P/9cXP/j4//6+v/+/iH5BAAAAAAALAAAAAA6ARoAAAT/EMhJq7046827/2AojmRpnmiqrmzrvnAsz3Rt33iu73zv/8CgcEgsGo/IpHLJbDqft0NDMCBQodis1jcADBKE7nYcCpjPgU5AQBKkVYOHAeRudqtXsh60/vRHdSoBBCGBNAkLe4o4f2psgG8pjR6GM5OLmDB/DA0GBoQADAgICRIBBQUOYgwGCg2kEgudBgUHAIGcBg0MsZ0NCnMGYgsBtqEGAbCynrW3AQONgcIFBgiErK6wAAfUtLbCscWiowoAyLDczLZu0AIJCAYOoJn0G38ObAwPEvLEts/O1vUhsA8AAjGonEmA9W6hGAVpEjiQoKBAhT8HJSRkVyEQQAAJ//a5YeMPQIFyACqCnJjSIgFCB4oB+HOSokWOAB6wIWCxnk8MfYh5QsYg5sVHfQLVMSqhztJIxWIaC6QzJy8KfZgqrNT0zR+nUNl8fSMvZ6IDwJCJRfoI7IR4Cub9nDsha6RwR02xUZpGq1utUWUq9FKgYV6/abgOHjt45tquEgY0SDDHoJg+fxhXolKNrmfH/EoR5EdAKmjQfB1qvPmGIQIJ3g4gC2egVF7LqxtP8Ng2cViTKFUCIGbNFKEEmB/VbDlYdqLRn+du8oTg6jjbmfe+CbTM2+BcuySgbQVtQoOCt7s3U8wbsqGs3ZppZLnylwFe8Uql825ogANPckUnYDoOCogxQGXADajggjcw4AA8DSSyTQASMmjhhTQscBWGHHbo4YcghijiiCSWaOKJKKao4oostugiFBEAADs=" />
111 </td>
112 </tr>
113 </tbody>
114</table>
115</div><div class="HeaderSection">
116<h1 id="ProductName">
117<!-- @Start Product -->
118RTOS Task Wiki Manifest
119<!-- @End Product -->
120</h1>
121
122<h2 id="ReleaseDate">
123<!-- @Start Date -->
12409-09-2015
125<!-- @End Date -->
126</h2>
127
128
129<h2 id="SRASID">
130<!-- @Start Date -->
131Manifest ID - SRAS00002103
132<!-- @End Date -->
133</h2>
134</div><div class="LegendSection">
135<h2>Legend</h2>
136<p>(explanation of the fields in the Manifest Table below)</p>
137<table>
138<tbody>
139<tr>
140<td>
141<b>Software Name </b>
142</td>
143<td>
144The name of the application or file
145</td>
146</tr>
147<tr>
148<td>
149<b>Version</b>
150</td>
151<td>
152Version of the application or file
153</td>
154</tr>
155<tr>
156<td>
157<b>License Type</b>
158</td>
159<td>
160Type of license(s) under which TI will be providing
161software to the licensee (e.g. BSD-3-Clause, GPL-2.0, TI TSPA License, TI
162Commercial License). The license could be under Commercial terms or Open Source. See Open Source Reference License Disclaimer in
163the Disclaimers Section. Whenever possible, TI will use an <a href="http://spdx.org/licenses/"> SPDX Short Identifier </a> for an Open Source
164License. TI Commercial license terms are not usually included in the manifest and are conveyed through a variety
165of means such as a clickwrap license upon install,
166a signed license agreement and so forth.
167</td>
168</tr>
169<tr>
170<td>
171<b>Location</b>
172</td>
173<td>
174The directory name and path on the media or a specific file where the Software is located. Typically fully qualified path names
175are not used and instead the relevant top level directory of the application is given.
176A notation often used in the manifests is [as installed]/directory/*. Note that the asterisk implies that all
177files under that directory are licensed as the License Type field denotes. Any exceptions to this will
178generally be denoted as [as installed]/directory/* except as noted below which means as shown in subsequent rows of
179the manifest.
180</td>
181</tr>
182<tr>
183<td>
184<b>Delivered As</b>
185</td>
186<td>
187This field will either be &#8220;Source&#8221;, &#8220;Binary&#8221; or &#8220;Source
188and Binary&#8221; and is the primary form the content of the Software is delivered
189in. If the Software is delivered in an archive format, this field
190applies to the contents of the archive. If the word Limited is used
191with Source, as in &#8220;Limited Source&#8221; or &#8220;Limited Source and Binary&#8221; then
192only portions of the Source for the application are provided.
193</td>
194</tr>
195<tr>
196<td>
197<b>Modified by TI</b>
198</td>
199<td>
200This field will either be &#8220;Yes&#8221; or &#8220;No&#8221;. A &#8220;Yes&#8221; means
201TI has made changes to the Software. A &#8220;No&#8221; means TI has not made any
202changes. Note: This field is not applicable for Software &#8220;Obtained
203from&#8221; TI.
204</td>
205</tr>
206<tr>
207<td>
208<b>Obtained from</b>
209</td>
210<td>
211This field specifies from where or from whom TI obtained
212the Software. It may be a URL to an Open Source site, a 3<sup>rd</sup>
213party licensor, or TI. See Links Disclaimer in the Disclaimers
214Section.
215</td>
216</tr>
217</tbody>
218</table>
219</div><div class="DisclaimerSection">
220<h2>Disclaimers</h2>
221<h3>Export Control Classification Number (ECCN)</h3>
222<p>Any use of ECCNs listed in the Manifest is at the user&#8217;s risk
223and without recourse to TI. Your
224company, as the exporter of record, is responsible for determining the
225correct classification of any item at
226the time of export. Any export classification by TI of Software is for
227TI&#8217;s internal use only and shall not be construed as a representation
228or warranty
229regarding the proper export classification for such Software or whether
230an export
231license or other documentation is required for exporting such Software</p>
232<h3>Links in the Manifest</h3>
233<p>Any
234links appearing on this Manifest
235(for example in the &#8220;Obtained from&#8221; field) were verified at the time
236the Manifest was created. TI makes no guarantee that any listed links
237will
238remain active in the future.</p>
239<h3>Open Source License References</h3>
240<p>Your company is responsible for confirming the
241applicable license terms for any open source Software
242listed in this Manifest that was not &#8220;Obtained from&#8221; TI. Any open
243source license
244specified in this Manifest for Software that was
245not &#8220;Obtained from&#8221; TI is for TI&#8217;s internal use only and shall not be
246construed as a representation or warranty regarding the proper open
247source license terms
248for such Software.</p>
249</div><div class="ExportSection">
250<h2>Export Information</h2>
251<p>ECCN for Software included in this release:</p>
252Publicly Available - Open Source or TI TSPA License
253</div><div class="ManifestTable">
254<!-- h2>Manifest Table</h2 -->
255
256 <table>
257 <tbody>
258
259 <h2>
260 RTOS Task Wiki Manifest Table
261 </h2>
262
263
264 <p>
265
266 See the Legend above for a description of these columns.
267
268 </p>
269
270 <table id="targetpackages" name="targetpackages">
271 <thead>
272 <tr>
273 <td><b>Software Name</b></td>
274 <td><b>Version</b></td>
275 <td><b>License Type</b></td>
276 <td><b>Delivered As</b></td>
277 <td><b>Modified by TI</b></td>
278 <td></td>
279 <td></td>
280 </tr>
281 </thead>
282
283
284 <tbody>
285 <tr>
286 <td id="name" name="name" rowspan="2">
287 notificationTask.c
288 </td>
289 <td id="version" name="version" rowspan="2">
290 1.0
291 </td>
292 <td id="license" name="license" rowspan="2">
293 BSD-3-Clause
294 </td>
295 <td id="delivered" name="delivered" rowspan="2">
296 Source
297 </td>
298 <td id="modified" name="modified" rowspan="2">
299 N/A
300 </td>
301 <td><b>Location</b></td>
302 <td id="location" name="location">
303 [Install Directory]\
304 </td>
305 </tr>
306 <tr>
307 <td><b>Obtained from</b></td>
308 <td id="obtained" name="obtained">
309 TI
310 </td>
311 </tr>
312
313 <tbody>
314 <tr>
315 <td id="name" name="name" rowspan="2">
316 notificationTask.h
317 </td>
318 <td id="version" name="version" rowspan="2">
319 1.0
320 </td>
321 <td id="license" name="license" rowspan="2">
322 BSD-3-Clause
323 </td>
324 <td id="delivered" name="delivered" rowspan="2">
325 Source
326 </td>
327 <td id="modified" name="modified" rowspan="2">
328 N/A
329 </td>
330 <td><b>Location</b></td>
331 <td id="location" name="location">
332 [Install Directory]\
333 </td>
334 </tr>
335 <tr>
336 <td><b>Obtained from</b></td>
337 <td id="obtained" name="obtained">
338 TI
339 </td>
340 </tr>
341
342 </tbody>
343 </table>
344
345 </p>
346 </p>
347 <p>
348
349</div><div class="CreditSection">
350<h2>Credits</h2>
351<BR> <BR><BR><BR><BR>
352</div><div class="LicenseSection">
353<h2>Licenses</h2>
354<BR><h3><b> RTOS Task Wiki Licenses </b></h3><BR> <BR><BR>/*<BR> * Filename: notificationTask.c<BR> *<BR> * Description: Additional Task that sends a notification when the select<BR> * button is pressed on the SmartRF06 board. This is a dummy<BR> * task to be used as a framework for making a more complex<BR> * task. <BR> *<BR> * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ <BR> * <BR> * <BR> * Redistribution and use in source and binary forms, with or without <BR> * modification, are permitted provided that the following conditions <BR> * are met:<BR> * <BR> * Redistributions of source code must retain the above copyright <BR> * notice, this list of conditions and the following disclaimer.<BR> *<BR> * Redistributions in binary form must reproduce the above copyright <BR> * notice, this list of conditions and the following disclaimer in the <BR> * documentation and/or other materials provided with the <BR> * distribution.<BR> *<BR> * Neither the name of Texas Instruments Incorporated nor the names of<BR> * its contributors may be used to endorse or promote products derived<BR> * from this software without specific prior written permission.<BR> *<BR> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <BR> * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT <BR> * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR<BR> * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT <BR> * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, <BR> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT <BR> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,<BR> * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY<BR> * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT <BR> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE <BR> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<BR> *<BR>*/<BR><BR><BR><BR>
355</div>
356
357</body></html> \ No newline at end of file
diff --git a/notificationTask.c b/notificationTask.c
new file mode 100644
index 0000000..d1b6b0c
--- /dev/null
+++ b/notificationTask.c
@@ -0,0 +1,257 @@
1/*
2 * Filename: notificationTask.c
3 *
4 * Description: Additional Task that sends a notification the the select
5 * button is pressed on the SmartRF06 board. This is a dummy
6 * task to be used as a framework for making a more comlex
7 * task.
8 *
9 * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
10 *
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 *
16 * Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 *
19 * Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the
22 * distribution.
23 *
24 * Neither the name of Texas Instruments Incorporated nor the names of
25 * its contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40*/
41/*********************************************************************
42 * INCLUDES
43 */
44#include <string.h>
45
46#include <ti/sysbios/knl/Task.h>
47#include <ti/sysbios/knl/Clock.h>
48#include <ti/sysbios/knl/Semaphore.h>
49#include <ti/sysbios/knl/Queue.h>
50#include <ti/sysbios/family/arm/cc26xx/PowerCC2650.h>
51#include <ti/sysbios/family/arm/m3/Hwi.h>
52#include <ti/drivers/pin/PINCC26XX.h>
53#include <ti/sysbios/knl/Task.h>
54#include <ti/sysbios/knl/Swi.h>
55
56
57#include "gatt.h"
58
59
60#include "inc/hw_memmap.h"
61#include "inc/hw_ints.h"
62
63#include "board_key.h"
64#include "Board.h"
65#include "notificationTask.h"
66
67
68#include <ti/drivers/lcd/LCDDogm1286.h>
69/*********************************************************************
70 * CONSTANTS
71 */
72#define NOTIFY_TASK_PRIORITY 1
73
74#ifndef NOTIFY_TASK_STACK_SIZE
75#define NOTIFY_TASK_STACK_SIZE 644
76#endif
77#define TASK_NUM_ATTR_SUPPORTED 1
78
79#define NOTIFY_TASK_SELECT_EVT 0x0001
80
81
82/*********************************************************************
83 * LOCAL VARIABLES
84 */
85static PIN_Config notifySelectPinCfg[] =
86{
87 Board_KEY_SELECT | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_EN | PIN_PULLUP,
88 PIN_TERMINATE
89};
90//! \brief PIN State for select pin on SmartRF06 board
91static PIN_State notifySelectPinState;
92
93//! \brief PIN Handles for select pin on SmartRF06 board
94static PIN_Handle hNotifySelectPin;
95// Entity ID globally used to check for source and/or destination of messages
96static ICall_EntityID selfEntity;
97
98// Semaphore globally used to post events to the application thread
99static ICall_Semaphore sem;
100
101// Clock instances for internal periodic events.
102static Clock_Struct periodicClock;
103
104// Task configuration
105Task_Struct notifyTask;
106Char notifyTaskStack[NOTIFY_TASK_STACK_SIZE];
107// events flag for internal application events.
108static uint16_t events;
109//Dummy Data to send in notificaiton
110const UInt32 dataToNotify = 0xAAAA5555;
111
112/*********************************************************************
113 * LOCAL FUNCTIONS
114 */
115
116static void NotificationTask_init( void );
117static void NotificationTask_taskFxn(UArg a0, UArg a1);
118static void NotificationTask_selectPINHwiFxn(PIN_Handle hPin, PIN_Id pinId);
119
120/*********************************************************************
121 * PROFILE CALLBACKS
122 */
123
124
125
126/*********************************************************************
127 * PUBLIC FUNCTIONS
128 */
129
130/*********************************************************************
131 * @fn NotificationTask_createTask
132 *
133 * @brief Task creation function for the Notification Task
134 *
135 * @param None.
136 *
137 * @return None.
138 */
139void NotificationTask_createTask(void)
140{
141 Task_Params taskParams;
142
143 // Configure task
144 Task_Params_init(&taskParams);
145 taskParams.stack = notifyTaskStack;
146 taskParams.stackSize = NOTIFY_TASK_STACK_SIZE;
147 taskParams.priority = NOTIFY_TASK_PRIORITY;
148
149 Task_construct(&notifyTask, NotificationTask_taskFxn, &taskParams, NULL);
150}
151
152/*********************************************************************
153 * @fn NotificationTask_init
154 *
155 * @brief Called during initialization and contains application
156 * specific initialization (ie. hardware initialization/setup,
157 * table initialization, power up notification, etc), and
158 * profile initialization/setup.
159 *
160 * @param None.
161 *
162 * @return None.
163 */
164static void NotificationTask_init(void)
165{
166 // ******************************************************************
167 // N0 STACK API CALLS CAN OCCUR BEFORE THIS CALL TO ICall_registerApp
168 // ******************************************************************
169 // Register the current thread as an ICall dispatcher application
170 // so that the application can send and receive messages.
171 ICall_registerApp(&selfEntity, &sem);
172
173 //Open the select pin on the board, and register it for interrupts
174 hNotifySelectPin = PIN_open(&notifySelectPinState, notifySelectPinCfg);
175 PIN_registerIntCb(hNotifySelectPin, NotificationTask_selectPINHwiFxn);
176 PIN_setConfig(hNotifySelectPin,
177 PIN_BM_IRQ,
178 Board_KEY_SELECT | PIN_IRQ_BOTHEDGES);
179
180 // Enable wakeup
181 PIN_setConfig(hNotifySelectPin,
182 PINCC26XX_BM_WAKEUP,
183 Board_KEY_SELECT | PINCC26XX_WAKEUP_NEGEDGE);
184
185
186}
187/*********************************************************************
188 * @fn NotificationTask_taskFxn
189 *
190 * @brief Application task entry point for the Notification Task.
191 *
192 * @param a0, a1 - not used.
193 *
194 * @return None.
195 */
196static void NotificationTask_taskFxn(UArg a0, UArg a1)
197{
198 // Initialize application
199 NotificationTask_init();
200
201 // Application main loop
202 for (;;)
203 {
204 // Waits for a signal to the semaphore associated with the calling thread.
205 // Note that the semaphore associated with a thread is signaled when a
206 // message is queued to the message receive queue of the thread or when
207 // ICall_signal() function is called onto the semaphore.
208 ICall_Errno errno = ICall_wait(ICALL_TIMEOUT_FOREVER);
209
210
211 if (events & NOTIFY_TASK_SELECT_EVT)
212 {
213 //Set up notificaiton data
214 uint16 len = sizeof(UInt32);
215 attHandleValueNoti_t noti;
216 bStatus_t status;
217 noti.handle = 0x1E;
218 noti.len = len;
219
220
221 //attempt to allocate payload
222 noti.pValue = (uint8 *)GATT_bm_alloc( 0, ATT_HANDLE_VALUE_NOTI, GATT_MAX_MTU, &len );
223
224 if ( noti.pValue != NULL ) //if allocated
225 {
226 //place index
227 noti.pValue[0] = (dataToNotify >> 24) & 0xFF;
228 noti.pValue[1] = (dataToNotify >> 16) & 0xFF;
229 noti.pValue[2] = (dataToNotify >> 8) & 0xFF;
230 noti.pValue[3] = dataToNotify & 0xFF;
231 status = GATT_Notification( 0, &noti, 0 ); //attempt to send
232 if ( status != SUCCESS ) //if noti not sent
233 {
234 GATT_bm_free( (gattMsg_t *)&noti, ATT_HANDLE_VALUE_NOTI );
235 }
236 }
237 else
238 {
239 //bleNoResources
240 asm(" NOP");
241 }
242 //Clear the event
243 events &= ~NOTIFY_TASK_SELECT_EVT;
244 }
245
246 }
247}
248
249static void NotificationTask_selectPINHwiFxn(PIN_Handle hPin, PIN_Id pinId)
250{
251 if (sem != NULL)
252 {
253 //Set the event and wake up the task
254 events |= NOTIFY_TASK_SELECT_EVT;
255 Semaphore_post(sem);
256 }
257}
diff --git a/notificationTask.h b/notificationTask.h
new file mode 100644
index 0000000..c3d348c
--- /dev/null
+++ b/notificationTask.h
@@ -0,0 +1,79 @@
1/*
2 * Filename: notificationTask.h
3 *
4 * Description: Additional Task that sends a notification the the select
5 * button is pressed on the SmartRF06 board. This is a dummy
6 * task to be used as a framework for making a more comlex
7 * task.
8 *
9 *
10 * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
11 *
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 *
17 * Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 *
20 * Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the
23 * distribution.
24 *
25 * Neither the name of Texas Instruments Incorporated nor the names of
26 * its contributors may be used to endorse or promote products derived
27 * from this software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 *
41*/
42#ifndef NOTIFICATIONTASK_H
43#define NOTIFICATIONTASK_H
44
45#ifdef __cplusplus
46extern "C"
47{
48#endif
49
50/*********************************************************************
51 * INCLUDES
52 */
53
54/*********************************************************************
55* EXTERNAL VARIABLES
56*/
57
58/*********************************************************************
59 * CONSTANTS
60 */
61
62/*********************************************************************
63 * FUNCTIONS
64 */
65
66/*
67 * Task creation function for the Simple BLE Peripheral.
68 */
69extern void NotificationTask_createTask(void);
70
71
72/*********************************************************************
73*********************************************************************/
74
75#ifdef __cplusplus
76}
77#endif
78
79#endif /* NOTIFICATIONTASK_H */