Skip to content

Commit 3e28976

Browse files
author
Wayne Ren
committed
Merge branch 'feature/iotdk_fix'
2 parents 9b15e0f + 55632a2 commit 3e28976

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

example/freertos/iot/coap/coap_server/FreeRTOSConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
8787
#define configMAX_PRIORITIES ( 10 )
8888
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 104 )
89-
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10 * 1024 ) )
89+
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 16 * 1024 ) )
9090
#define configMAX_TASK_NAME_LEN ( 10 )
9191
#define configUSE_TRACE_FACILITY 0
9292
#define configUSE_16_BIT_TICKS 0

example/freertos/iot/coap/coap_server/main.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,26 @@
7676
#include "embARC_debug.h"
7777
#include "lwip/netif.h"
7878
#include "coap.h"
79+
80+
#if defined(BOARD_EMSK)
7981
#include "adt7420.h"
82+
#endif
8083

8184
#define min(x,y) ((x) < (y) ? (x) : (y))
8285

8386
#define TSKPRI_COAP_SERVER (configMAX_PRIORITIES-2) /**< coap server task priority */
84-
#define TSKPRI_TEMPTX (configMAX_PRIORITIES-3)
8587

8688
static void task_coap_server(void *par);
87-
static void task_temp_tx(void *par);
8889

8990
static TaskHandle_t task_coap_server_handle = NULL;
90-
static TaskHandle_t task_temptx_handle = NULL;
91-
9291
static coap_resource_t *temp_resource = NULL;
92+
93+
#if defined(BOARD_EMSK)
94+
#define TSKPRI_TEMPTX (configMAX_PRIORITIES-3)
95+
static TaskHandle_t task_temptx_handle = NULL;
96+
static void task_temp_tx(void *par);
9397
static ADT7420_DEFINE(temp, BOARD_TEMP_SENSOR_IIC_ID, TEMP_I2C_SLAVE_ADDRESS);
98+
#endif
9499

95100
int main(void)
96101
{
@@ -132,7 +137,7 @@ static void hnd_get_temp(coap_context_t *ctx, struct coap_resource_t *resource,
132137
coap_opt_iterator_t opt_iter;
133138
unsigned char buf[40];
134139
size_t len;
135-
float temp_val;
140+
float temp_val = 10.0;
136141
coap_subscription_t *subscription;
137142

138143
response->hdr->code = COAP_RESPONSE_CODE(205);
@@ -159,9 +164,11 @@ static void hnd_get_temp(coap_context_t *ctx, struct coap_resource_t *resource,
159164
coap_add_option(response, COAP_OPTION_MAXAGE,
160165
coap_encode_var_bytes(buf, 60), buf);
161166

167+
#if defined(BOARD_EMSK)
162168
if (adt7420_sensor_read(temp, &temp_val) != E_OK) {
163169
temp_val = 0.0f;
164170
}
171+
#endif
165172

166173
len = snprintf((char *)buf,
167174
min(sizeof(buf), response->max_size - response->length),
@@ -243,12 +250,15 @@ static void task_coap_server(void *par)
243250

244251
init_resources(ctx);
245252

253+
#if defined(BOARD_EMSK)
246254
if (xTaskCreate(task_temp_tx, "temperature update task", 128, (void *)1,
247255
TSKPRI_TEMPTX, &task_temptx_handle) != pdPASS) {
248256
EMBARC_PRINTF("create temperature update task failed\r\n");
249257
vTaskDelete(NULL);
250258
return;
251259
}
260+
#endif
261+
252262
/**
253263
* every 100 ticks, the server will the incoming data.
254264
* FIXME: add semaphore post in received_package(coap/net.c) to
@@ -262,7 +272,7 @@ static void task_coap_server(void *par)
262272
coap_free_context(ctx);
263273
}
264274

265-
275+
#if defined(BOARD_EMSK)
266276
static void task_temp_tx(void *par)
267277
{
268278
adt7420_sensor_init(temp);
@@ -272,5 +282,6 @@ static void task_temp_tx(void *par)
272282
vTaskDelay(2000);
273283
}
274284
}
285+
#endif
275286

276287
/** @} */

example/freertos/iot/coap/coap_server/makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# Application name
22
APPL ?= freertos_iot_coap_server
33

4-
EXT_DEV_LIST += wifi/mrf24g sensor/temperature/adt7420
4+
EXT_DEV_LIST += wifi/mrf24g
5+
6+
ifeq ($(BOARD), emsk)
7+
EXT_DEV_LIST += sensor/temperature/adt7420
8+
endif
59

610
# root dir of embARC
711
#

example/freertos/iot/lwm2m/lwm2m_client/makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ EXT_DEV_LIST += wifi/mrf24g
1010
HEAPSZ ?= 8192
1111
STACKSZ ?= 2048
1212

13+
14+
OLEVEL = Os
15+
1316
#
1417
# root dir of embARC
1518
#

example/freertos/iot/lwm2m/lwm2m_server/makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ EXT_DEV_LIST += wifi/mrf24g
1010
HEAPSZ ?= 8192
1111
STACKSZ ?= 2048
1212

13+
OLEVEL = Os
14+
1315
#
1416
# root dir of embARC
1517
#

0 commit comments

Comments
 (0)