Cjson update
This commit is contained in:
parent
88146af0ad
commit
4056473705
2 changed files with 15 additions and 2 deletions
12
cjson/Makefile
Normal file
12
cjson/Makefile
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
CC ?= gcc
|
||||
CFLAGS ?= -Wall -O2 -lcjson
|
||||
|
||||
TARGET = main.elf
|
||||
SRC = main.c
|
||||
|
||||
$(TARGET): $(SRC)
|
||||
@echo CC $@
|
||||
@$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
|
|
@ -6,9 +6,10 @@ char *build_set_level_command(int level) {
|
|||
cJSON_AddStringToObject(root, "cmd", "set_level");
|
||||
cJSON_AddNumberToObject(root, "level", level);
|
||||
|
||||
char *message = cJSON_PrintUnformatted(root);
|
||||
// char *message = cJSON_PrintUnformatted(root);
|
||||
char *msg2 = cJSON_Print(root);
|
||||
cJSON_Delete(root);
|
||||
return message; // Remember to free this when done!
|
||||
return msg2; // Remember to free this when done!
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
Loading…
Add table
Add a link
Reference in a new issue