-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
boards: slstk3401a: add support (v2) #8630
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
MODULE = board | ||
|
||
DIRS = $(RIOTBOARD)/common/silabs | ||
|
||
include $(RIOTBASE)/Makefile.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ifneq (,$(filter saul_default,$(USEMODULE))) | ||
USEMODULE += saul_gpio | ||
USEMODULE += si7021 | ||
endif | ||
|
||
# include board common dependencies | ||
include $(RIOTBOARD)/common/silabs/Makefile.dep | ||
|
||
include $(RIOTCPU)/efm32/Makefile.dep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Put defined MCU peripherals here (in alphabetical order) | ||
FEATURES_PROVIDED += periph_adc | ||
FEATURES_PROVIDED += periph_gpio | ||
FEATURES_PROVIDED += periph_i2c | ||
FEATURES_PROVIDED += periph_rtc | ||
FEATURES_PROVIDED += periph_rtt | ||
FEATURES_PROVIDED += periph_spi | ||
FEATURES_PROVIDED += periph_timer | ||
FEATURES_PROVIDED += periph_uart | ||
|
||
# The board MPU family (used for grouping by the CI system) | ||
FEATURES_MCU_GROUP = cortex_m4_2 | ||
|
||
-include $(RIOTCPU)/efm32/Makefile.features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# define the cpu used by SLSTK3401A | ||
export CPU = efm32 | ||
export CPU_MODEL = efm32pg1b200f256gm48 | ||
|
||
# set default port depending on operating system | ||
PORT_LINUX ?= /dev/ttyACM0 | ||
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) | ||
|
||
# setup serial terminal | ||
include $(RIOTMAKE)/tools/serial.inc.mk | ||
|
||
# setup JLink for flashing | ||
export JLINK_DEVICE := $(CPU_MODEL) | ||
include $(RIOTMAKE)/tools/jlink.inc.mk | ||
|
||
# add board common drivers | ||
USEMODULE += boards_common_silabs | ||
USEMODULE += silabs_aem | ||
USEMODULE += silabs_bc | ||
|
||
# include board common | ||
include $(RIOTBOARD)/common/silabs/Makefile.include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (C) 2015-2018 Freie Universität Berlin | ||
* | ||
* 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 boards_slstk3401a | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board specific implementations SLSTK3401A board | ||
* | ||
* @author Hauke Petersen <[email protected]> | ||
* @author Bas Stottelaar <[email protected]> | ||
* | ||
* @} | ||
*/ | ||
|
||
#include "board.h" | ||
#include "board_common.h" | ||
#include "periph/gpio.h" | ||
|
||
void board_init(void) | ||
{ | ||
/* initialize the CPU */ | ||
cpu_init(); | ||
|
||
/* perform common board initialization */ | ||
board_common_init(); | ||
|
||
#ifdef MODULE_SI70XX | ||
/* initialize the Si7021 sensor */ | ||
gpio_init(SI7021_EN_PIN, GPIO_OUT); | ||
gpio_set(SI7021_EN_PIN); | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/* | ||
* Copyright (C) 2015-2018 Freie Universität Berlin | ||
* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* @defgroup boards_slstk3401a Silicon Labs SLSTK3401A starter kit | ||
* @ingroup boards | ||
* @brief Support for the Silicon Labs SLSTK3401A starter kit | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board specific definitions for the SLSTK3401A starter kit | ||
* | ||
* @author Hauke Petersen <[email protected]> | ||
* @author Bas Stottelaar <[email protected]> | ||
*/ | ||
|
||
#ifndef BOARD_H | ||
#define BOARD_H | ||
|
||
#include "cpu.h" | ||
#include "periph_conf.h" | ||
#include "periph/gpio.h" | ||
#include "periph/spi.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @name Xtimer configuration | ||
* | ||
* The timer runs at 250 KHz to increase accuracy. | ||
* @{ | ||
*/ | ||
#define XTIMER_HZ (250000UL) | ||
#define XTIMER_WIDTH (16) | ||
/** @} */ | ||
|
||
/** | ||
* @name Board controller configuration | ||
* | ||
* Define the GPIO pin to enable the BC, to allow serial communication | ||
* via the USB port. | ||
* @{ | ||
*/ | ||
#define BC_PIN GPIO_PIN(PA, 5) | ||
/** @} */ | ||
|
||
/** | ||
* @name Push button pin definitions | ||
* @{ | ||
*/ | ||
#define PB0_PIN GPIO_PIN(PF, 6) | ||
#define PB1_PIN GPIO_PIN(PF, 7) | ||
/** @} */ | ||
|
||
/** | ||
* @name LED pin definitions | ||
* @{ | ||
*/ | ||
#define LED0_PIN GPIO_PIN(PF, 4) | ||
#define LED1_PIN GPIO_PIN(PF, 5) | ||
/** @} */ | ||
|
||
/** | ||
* @name Macros for controlling the on-board LEDs | ||
* @{ | ||
*/ | ||
#define LED0_ON gpio_set(LED0_PIN) | ||
#define LED0_OFF gpio_clear(LED0_PIN) | ||
#define LED0_TOGGLE gpio_toggle(LED0_PIN) | ||
#define LED1_ON gpio_set(LED1_PIN) | ||
#define LED1_OFF gpio_clear(LED1_PIN) | ||
#define LED1_TOGGLE gpio_toggle(LED1_PIN) | ||
/** @} */ | ||
|
||
/** | ||
* @name Display configuration | ||
* | ||
* Connection to the on-board Sharp Memory LCD (LS013B7DH03). | ||
* @{ | ||
*/ | ||
#define DISP_SPI SPI_DEV(0) | ||
#define DISP_COM_PIN GPIO_PIN(PD, 13) | ||
#define DISP_CS_PIN GPIO_PIN(PD, 14) | ||
#define DISP_EN_PIN GPIO_PIN(PD, 15) | ||
/** @} */ | ||
|
||
/** | ||
* @name Temperature sensor configuration | ||
* | ||
* Connection to the on-board temperature/humidity sensor (Si7021). | ||
* @{ | ||
*/ | ||
#define SI7021_I2C I2C_DEV(0) | ||
#define SI7021_EN_PIN GPIO_PIN(PD, 9) | ||
|
||
#define SI70XX_PARAM_I2C_DEV SI7021_I2C | ||
/** @} */ | ||
|
||
/** | ||
* @brief Initialize the board (GPIO, sensors, clocks). | ||
*/ | ||
void board_init(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* BOARD_H */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright (C) 2016-2017 Bas Stottelaar <[email protected]> | ||
* | ||
* 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 boards_slstk3401a | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board specific configuration of direct mapped GPIOs | ||
* | ||
* @author Bas Stottelaar <[email protected]> | ||
*/ | ||
|
||
#ifndef GPIO_PARAMS_H | ||
#define GPIO_PARAMS_H | ||
|
||
#include "board.h" | ||
#include "saul/periph.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief GPIO pin configuration | ||
*/ | ||
static const saul_gpio_params_t saul_gpio_params[] = | ||
{ | ||
{ | ||
.name = "LED 0", | ||
.pin = LED0_PIN, | ||
.mode = GPIO_OUT | ||
}, | ||
{ | ||
.name = "LED 1", | ||
.pin = LED1_PIN, | ||
.mode = GPIO_OUT | ||
}, | ||
{ | ||
.name = "Button 1", | ||
.pin = PB0_PIN, | ||
.mode = GPIO_IN_PU, | ||
.flags = SAUL_GPIO_INVERTED | ||
}, | ||
{ | ||
.name = "Button 2", | ||
.pin = PB1_PIN, | ||
.mode = GPIO_IN_PU, | ||
.flags = SAUL_GPIO_INVERTED | ||
} | ||
}; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* GPIO_PARAMS_H */ | ||
/** @} */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to not use this module physically on the board? I mean, that you can disable it somehow so you need this guard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, removing this condition will always enable the sensor, even if you don't use it. I would therefore not want to remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what you mean is that this pin can turn on/off the sensor? If that's the case, then this is a kind of "software detachment".
IMHO it looks a bit strange to have it here, but I don't have in mind right now a better way to integrate this functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be done using the driver params, as you suggested before. But this is something that is not described in the sensor datasheet, a kind of external switch, only available on that board. So the actual solution is the best one I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify: this pin is not directly connected to the enable line of the Si7021: it's connected to a board-specific IC that will toggle VDD for the Si7021. The Si7021 does not have one.
So to use this Si7021, you have to enable this pin to supply it VDD. The reason to disable it, is to not take into account its consumption when profiling power consumption. The user manual calls it the enable pin, but it could also have been called toggle-power pin :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@basilfx Yes is what I thought, a real physical software controlled switch. That's why I didn't have an idea on how to integrate it, but I guess we should leave it as it is here and if the case comes across again we find a better integration.