# name of your application
APPLICATION = riot-os_dev

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

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

# 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:
CFLAGS += -DDEVELHELP

# HW FEATURE
USEMODULE += enc28j60

# default parameter definitions when module enc28j60 is used
ifneq (, $(filter enc28j60, $(USEMODULE)))

    # avoid multiple definitions when package depenedencies are resolved recursively
    ifndef ENC28J60_PARAM_DEFINED
        export ENC28J60_PARAM_DEFINED = 1

        # default definitions
        ENC28J60_PARAM_SPI ?= SPI_DEV\(1\)
        ENC28J60_PARAM_RESET ?= GPIO_PIN\(PORT_A,8\)
        ENC28J60_PARAM_CS ?= GPIO_PIN\(PORT_B,5\)
        ENC28J60_PARAM_INT ?= GPIO_PIN\(PORT_A,10\)

        CFLAGS += -DENC28J60_PARAM_SPI=$(ENC28J60_PARAM_SPI)
        CFLAGS += -DENC28J60_PARAM_CS=$(ENC28J60_PARAM_CS)
        CFLAGS += -DENC28J60_PARAM_INT=$(ENC28J60_PARAM_INT)
        CFLAGS += -DENC28J60_PARAM_RESET=$(ENC28J60_PARAM_RESET)

        # to satisfy variable defintions in tests/driver_enc28j60/Makefile
        ENC_SPI = $(ENC28J60_PARAM_SPI)
        ENC_CS  = $(ENC28J60_PARAM_CS)
        ENC_INT = $(ENC28J60_PARAM_INT)
        ENC_RST = $(ENC28J60_PARAM_RESET)

    endif
endif

# FW FEATURE
LWIP_IPV4 ?= 1
LWIP_IPV6 ?= 0
USEMODULE += ipv4_addr
CFLAGS += -DETHARP_SUPPORT_STATIC_ENTRIES=1

USEMODULE += od
USEMODULE += netdev_default
USEMODULE += lwip_ethernet

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

# Modules to include:
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps

# make sure we read the local enc28j60 params file
CFLAGS += -I$(CURDIR)


include $(RIOTBASE)/Makefile.include
