-
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
Add Bangle.JS2 smart watch board support #18554
base: master
Are you sure you want to change the base?
Conversation
boards: bangle-js2, remove no more needed module boards: bangle/js2, remove sector count, will get auto detected boards: bangle-js2, reformat comments for coding style boards: bangle-js2, remove unnecessary definition of openocd
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.
static tests have some complains and // C++ comments
should be converted to /* C-style comments */
USEMODULE += mtd_spi_nor | ||
endif | ||
|
||
USEMODULE += cst816s |
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.
USEMODULE += cst816s | |
ifneq (,$(filter touch_dev,$(USEMODULE))) | |
USEMODULE += cst816s | |
endif |
|
||
void board_power_off(void) | ||
{ | ||
ztimer_sleep(ZTIMER_MSEC, 5); |
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.
Nothing happens before the sleep - what is is good for?
}; | ||
|
||
mtd_dev_t *mtd0 = (mtd_dev_t *)&banglejs2_nor_dev; | ||
#endif /* MODULE_MTD */ |
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.
If you want to have a file system on the external flash you could add
#ifdef MODULE_VFS_DEFAULT
#include "vfs_default.h"
VFS_AUTO_MOUNT(littlefs2, VFS_MTD(banglejs2_nor_dev), VFS_DEFAULT_NVM(0), 0);
#endif
here and
ifneq (,$(filter vfs_default,$(USEMODULE)))
USEPKG += littlefs2
USEMODULE += mtd
endif
to Makefile.dep
@@ -0,0 +1,102 @@ | |||
Bangle.js 2 - Pinout |
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.
This should go to doc.txt
.dev = NRF_SPIM2, | ||
.sclk = LCD_SCK, | ||
.mosi = LCD_MOSI, | ||
//.miso = GPIO_UNDEF, |
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.
better set .miso = GPIO_UNDEF,
since GPIO_UNDEF
is not necessarily 0.
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.
Looks good to me. Some comments inline, mostly style nitpicks.
#include "timex.h" | ||
#include "ztimer.h" | ||
|
||
|
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.
The CI dislikes more than one consecutive blank line
static const mtd_spi_nor_params_t _banglejs2_nor_params = { | ||
.opcode = &mtd_spi_nor_opcode_default, | ||
.wait_chip_erase = 9LU * US_PER_SEC, | ||
.wait_32k_erase = 160LU *US_PER_MS, |
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.
.wait_32k_erase = 160LU *US_PER_MS, | |
.wait_32k_erase = 160LU * US_PER_MS, |
mtd_dev_t *mtd0 = (mtd_dev_t *)&banglejs2_nor_dev; | ||
#endif /* MODULE_MTD */ | ||
|
||
|
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.
} | ||
|
||
if (pwm_init(PWM_DEV(1), PWM_RIGHT, 1250, 100) > 0) { | ||
pwm_set(PWM_DEV(1), 0, 50); /* 50% duty cylce @ 125kHz for EXTCOM ? */ |
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.
This will likely contribute to power consumption. I am not sure how PWM is implemented on the nRF5x, but mostly a high frequency timer peripheral is used. This in turn leads to the PLL generating the CPU clock remaining active.
/* power off peripherals as much as we can */ | ||
gpio_clear(LCD_DISP); | ||
pwm_poweroff(PWM_DEV(0)); /* LCD ExtCOM */ | ||
pwm_poweroff(PWM_DEV(1)); /* LCD backlight */ |
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.
The comments regarding LCD extcom / backlight are in reverse order compared to the init functions. I didn't check which one is correct.
// LCD backlight | ||
{ NRF_PWM0, { LCD_BACKLIGHT, GPIO_UNDEF, GPIO_UNDEF, GPIO_UNDEF } }, | ||
// LCD EXTCOM | ||
{ NRF_PWM1, { LCD_EXTCOMIN, GPIO_UNDEF, GPIO_UNDEF, GPIO_UNDEF } }, |
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.
I wonder if the LCD backlight and ghe LCD EXTCOM couldbe driven from the same PWM device, just as channel 0 and channel 1. This would of course only work if the same frequency would work with both. But it may make handling easier, if those need to be enabled simultaneously anyway.
* @{ | ||
*/ | ||
static const pwm_conf_t pwm_config[] = { | ||
// LCD backlight |
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.
// LCD backlight | |
/* LCD backlight */ |
static const pwm_conf_t pwm_config[] = { | ||
// LCD backlight | ||
{ NRF_PWM0, { LCD_BACKLIGHT, GPIO_UNDEF, GPIO_UNDEF, GPIO_UNDEF } }, | ||
// LCD EXTCOM |
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.
// LCD EXTCOM | |
/* LCD EXTCOM */ |
{ NRF_PWM0, { LCD_BACKLIGHT, GPIO_UNDEF, GPIO_UNDEF, GPIO_UNDEF } }, | ||
// LCD EXTCOM | ||
{ NRF_PWM1, { LCD_EXTCOMIN, GPIO_UNDEF, GPIO_UNDEF, GPIO_UNDEF } }, | ||
// vibration motor |
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.
// vibration motor | |
/* vibration motor */ |
#define PWM_NUMOF ARRAY_SIZE(pwm_config) | ||
|
||
/** @} */ | ||
|
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.
@nica-f ping 😉 |
Should we take over this PR? |
@@ -0,0 +1,13 @@ | |||
# use JLink Segger RTT by default | |||
RIOT_TERMINAL ?= jlink |
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.
Shouldn't this be openocd-rtt?
boards: bangle-js2, remove no more needed module
boards: bangle/js2, remove sector count, will get auto detected
boards: bangle-js2, reformat comments for coding style
boards: bangle-js2, remove unnecessary definition of openocd
boards: Add Bangle-JS2 smart watch board support
Adds board support for the Bangle-JS2 smart watch.
Running on my watch for several days :-)
Resolves #18553