Skip to content

Commit a5812a1

Browse files
committed
Bluetooth: samples: Fine-tune mesh_demo on bbc_microbit
Fine tune the mesh_demo app for bbc_microbit. Signed-off-by: Johan Hedberg <[email protected]>
1 parent 23f8897 commit a5812a1

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed

samples/bluetooth/mesh_demo/boards/bbc_microbit.conf

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
CONFIG_ISR_STACK_SIZE=768
1+
CONFIG_ISR_STACK_SIZE=700
22
CONFIG_MAIN_STACK_SIZE=512
3-
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1200
3+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=256
44
CONFIG_GPIO=y
55
CONFIG_DISPLAY=y
66
CONFIG_MICROBIT_DISPLAY=y
77
CONFIG_PWM=y
88

9-
CONFIG_BT_RX_STACK_SIZE=1280
9+
CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT=1
10+
CONFIG_BT_MESH_ADV_STACK_SIZE=200
11+
12+
CONFIG_BT_RX_STACK_SIZE=2000
1013
CONFIG_BT_CTLR_DUP_FILTER_LEN=0
1114
CONFIG_BT_PHY_UPDATE=n
1215
CONFIG_BT_DATA_LEN_UPDATE=n
1316
CONFIG_BT_EXT_ADV=n
14-
CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT=15
17+
CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT=1
1518

1619
CONFIG_BT_MESH_SEG_BUFS=6
1720
CONFIG_BT_MESH_ADV_BUF_COUNT=3

samples/bluetooth/mesh_demo/src/microbit.c

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,14 @@
2020

2121
#define SCROLL_SPEED 300
2222

23-
#define BUZZER_PWM_CHANNEL 0
24-
#define BEEP_DURATION K_MSEC(60)
25-
2623
#define SEQ_PER_BIT 976
2724
#define SEQ_PAGE (NRF_FICR->CODEPAGESIZE * (NRF_FICR->CODESIZE - 1))
2825
#define SEQ_MAX (NRF_FICR->CODEPAGESIZE * 8 * SEQ_PER_BIT)
2926

3027
static const struct gpio_dt_spec button_a =
31-
GPIO_DT_SPEC_GET(DT_NODELABEL(buttona), gpios);
28+
GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios);
3229
static const struct gpio_dt_spec button_b =
33-
GPIO_DT_SPEC_GET(DT_NODELABEL(buttonb), gpios);
34-
static const struct device *const nvm =
35-
DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller));
36-
static const struct device *const pwm =
37-
DEVICE_DT_GET_ANY(nordic_nrf_sw_pwm);
30+
GPIO_DT_SPEC_GET(DT_ALIAS(sw1), gpios);
3831

3932
static struct k_work button_work;
4033

@@ -64,6 +57,13 @@ static void button_pressed(const struct device *dev, struct gpio_callback *cb,
6457
}
6558
}
6659

60+
#if defined(CONFIG_PWM)
61+
#define BUZZER_PWM_CHANNEL 0
62+
#define BEEP_DURATION K_MSEC(60)
63+
64+
static const struct device *const pwm =
65+
DEVICE_DT_GET_ANY(nordic_nrf_sw_pwm);
66+
6767
static const struct {
6868
char note;
6969
uint32_t period;
@@ -139,6 +139,11 @@ void board_play_tune(const char *str)
139139
pwm_set(pwm, BUZZER_PWM_CHANNEL, 0, 0, 0);
140140
}
141141
}
142+
#else
143+
void board_play_tune(const char *str)
144+
{
145+
}
146+
#endif /* CONFIG_PWM */
142147

143148
void board_heartbeat(uint8_t hops, uint16_t feat)
144149
{
@@ -267,13 +272,6 @@ int board_init(uint16_t *addr)
267272
{
268273
struct mb_display *disp = mb_display_get();
269274

270-
if (!(device_is_ready(nvm) && device_is_ready(pwm) &&
271-
gpio_is_ready_dt(&button_a) &&
272-
gpio_is_ready_dt(&button_b))) {
273-
printk("One or more devices are not ready\n");
274-
return -ENODEV;
275-
}
276-
277275
*addr = NRF_UICR->CUSTOMER[0];
278276
if (!*addr || *addr == 0xffff) {
279277
#if defined(NODE_ADDR)

0 commit comments

Comments
 (0)