Skip to content

Commit

Permalink
Merge pull request #29 from rosetree/feature/external-module
Browse files Browse the repository at this point in the history
Convert from application to external module
  • Loading branch information
MatthiasBraeuer authored Jan 6, 2020
2 parents a4c7ed4 + aeefcd4 commit ea04df3
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 134 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

64 changes: 1 addition & 63 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,63 +1 @@
# name of your application
APPLICATION = saul_coap

# If no BOARD is found in the environment, use this default:
BOARD ?= native

# This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/RIOT

BOARD_INSUFFICIENT_MEMORY := arduino-duemilanove arduino-leonardo arduino-nano \
arduino-uno

# Include packages that pull up and auto-init the link layer.
# NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present
USEMODULE += gnrc_netdev_default
USEMODULE += auto_init_gnrc_netif
# Specify the mandatory networking modules
USEMODULE += gnrc_ipv6_default
USEMODULE += gcoap
# Additional networking modules that can be dropped if not needed
USEMODULE += gnrc_icmpv6_echo
USEMODULE += gnrc_icmpv6_error

# Specify the mandatory networking modules for IPv6 routing
USEMODULE += gnrc_ipv6_router_default

# Required by gcoap example
USEMODULE += od
USEMODULE += fmt

# we want to use SAUL:
USEMODULE += saul_default
# include the shell:
USEMODULE += shell
USEMODULE += shell_commands
# additional modules for debugging:
USEMODULE += ps

# Module for registering to Resource Directory (RD)
USEMODULE += cord_ep

# needed so that the board can be reached
USEMODULE += netstats_l2
#
# Include tinycbor for data representation
USEPKG += tinycbor
INCLUDE += $(RIOTPKG)/tinycbor/cbor.h

CFLAGS += -DGNRC_IPV6_NIB_CONF_SLAAC=1

# For debugging and demonstration purposes the lifetime is limited to 30s
CFLAGS += -DCORD_LT=30

# Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
# development process:
DEVELHELP ?= 1

# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1

include $(RIOTBASE)/Makefile.include

include $(RIOTBASE)/Makefile.base
40 changes: 40 additions & 0 deletions Makefile.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Include packages that pull up and auto-init the link layer.
# NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present
USEMODULE += gnrc_netdev_default
USEMODULE += auto_init_gnrc_netif
# Specify the mandatory networking modules
USEMODULE += gnrc_ipv6_default
USEMODULE += gcoap
# Additional networking modules that can be dropped if not needed
USEMODULE += gnrc_icmpv6_echo
USEMODULE += gnrc_icmpv6_error

# Specify the mandatory networking modules for IPv6 routing
USEMODULE += gnrc_ipv6_router_default

# Required by gcoap example
USEMODULE += od
USEMODULE += fmt

# we want to use SAUL:
USEMODULE += saul_default
# include the shell:
USEMODULE += shell
USEMODULE += shell_commands
# additional modules for debugging:
USEMODULE += ps

# Module for registering to Resource Directory (RD)
USEMODULE += cord_ep

# needed so that the board can be reached
USEMODULE += netstats_l2
#
# Include tinycbor for data representation
USEPKG += tinycbor
INCLUDE += $(RIOTPKG)/tinycbor/cbor.h

CFLAGS += -DGNRC_IPV6_NIB_CONF_SLAAC=1

# For debugging and demonstration purposes the lifetime is limited to 30s
CFLAGS += -DCORD_LT=30
3 changes: 3 additions & 0 deletions Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Use an immediate variable to evaluate `MAKEFILE_LIST` now
USEMODULE_INCLUDES_saul_coap := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
USEMODULE_INCLUDES += $(USEMODULE_INCLUDES_saul_coap)
1 change: 0 additions & 1 deletion RIOT
Submodule RIOT deleted from b38f48
67 changes: 0 additions & 67 deletions main.c

This file was deleted.

2 changes: 2 additions & 0 deletions saul_coap.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "net/gcoap.h"
#include "cbor.h"

#include "saul_coap.h"

static ssize_t _saul_cnt_handler(coap_pkt_t* pdu, uint8_t *buf, size_t len, void *ctx);
static ssize_t _saul_dev_handler(coap_pkt_t* pdu, uint8_t *buf, size_t len, void *ctx);
static ssize_t _saul_sensortype_handler(coap_pkt_t* pdu, uint8_t *buf, size_t len, void *ctx);
Expand Down
37 changes: 37 additions & 0 deletions saul_coap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2019 HAW Hamburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*
* @ingroup pkg
* @{
*
* @file
* @brief Adapt SAUL registry for CoAP.
*
* @author Micha Rosenbaum <[email protected]>
*
* @}
*/
#ifndef SAUL_COAP_H
#define SAUL_COAP_H

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Initialize and register the saul-coap resources.
*
* @warning This function must only be called once (typically during system
* initialization)
*/
void saul_coap_init(void);

#ifdef __cplusplus
}
#endif

#endif /* SAUL_COAP_H */

0 comments on commit ea04df3

Please sign in to comment.