Skip to content

Commit

Permalink
Add full libc requirement and print float in sample
Browse files Browse the repository at this point in the history
The requirement is added to node library. Printing the float variable
in the sample allows to quickly check if float printing is enabled
(this is not the default even for full libc).
  • Loading branch information
martinjaeger committed Jul 22, 2023
1 parent f5b26ce commit 5eea70e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions samples/counter/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
#include "thingset/sdk.h"

static uint32_t counter;
static float pi = 3.14F;

#define APP_ID_SAMPLE 0x05
#define APP_ID_SAMPLE_RCOUNTER 0x050
#define APP_ID_SAMPLE_WCOUNTER 0x051
#define APP_ID_SAMPLE_CPI 0x052

THINGSET_ADD_GROUP(TS_ID_ROOT, APP_ID_SAMPLE, "Sample", THINGSET_NO_CALLBACK);

Expand All @@ -22,6 +24,9 @@ THINGSET_ADD_ITEM_UINT32(APP_ID_SAMPLE, APP_ID_SAMPLE_RCOUNTER, "rCounter", &cou
THINGSET_ADD_ITEM_UINT32(APP_ID_SAMPLE, APP_ID_SAMPLE_WCOUNTER, "wCounter", &counter,
THINGSET_ANY_RW, TS_SUBSET_LIVE | TS_SUBSET_SUMMARY);

THINGSET_ADD_ITEM_FLOAT(APP_ID_SAMPLE, APP_ID_SAMPLE_CPI, "cPi", &pi, 2, THINGSET_ANY_R,
TS_SUBSET_LIVE | TS_SUBSET_SUMMARY);

int main(void)
{
while (true) {
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ manifest:
- picolibc
- name: thingset-node-c
remote: thingset
revision: 961bb0ba4c2087499c9ce4ac91173dcce03e5b7a
revision: 0f97b99eb061848cd9b7b4ea242f95c7b254f3c4
path: modules/thingset-node-c
import: true

0 comments on commit 5eea70e

Please sign in to comment.