samples: bluetooth: mesh_demo: Align with changes in pwm_nrf5_sw driver
- add an overlay file for the bbc_microbit board with specification of GPIO that should be used as the PWM output to buzzer - update a PWM related macro in the microbit specific code to refer to PWM channel instead of pin Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
92b3cc78e7
commit
00f878f6f3
|
@ -8,8 +8,6 @@ project(mesh_demo)
|
||||||
|
|
||||||
target_sources(app PRIVATE src/main.c)
|
target_sources(app PRIVATE src/main.c)
|
||||||
target_sources_ifdef(CONFIG_BOARD_BBC_MICROBIT app PRIVATE src/microbit.c)
|
target_sources_ifdef(CONFIG_BOARD_BBC_MICROBIT app PRIVATE src/microbit.c)
|
||||||
zephyr_include_directories_ifdef(CONFIG_BOARD_BBC_MICROBIT
|
|
||||||
${ZEPHYR_BASE}/boards/arm/bbc_microbit)
|
|
||||||
|
|
||||||
if(NODE_ADDR)
|
if(NODE_ADDR)
|
||||||
zephyr_compile_definitions(NODE_ADDR=${NODE_ADDR})
|
zephyr_compile_definitions(NODE_ADDR=${NODE_ADDR})
|
||||||
|
|
4
samples/bluetooth/mesh_demo/boards/bbc_microbit.overlay
Normal file
4
samples/bluetooth/mesh_demo/boards/bbc_microbit.overlay
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
&sw_pwm {
|
||||||
|
status = "okay";
|
||||||
|
channel-gpios = <&edge_connector 0 GPIO_ACTIVE_HIGH>;
|
||||||
|
};
|
|
@ -7,7 +7,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <drivers/gpio.h>
|
#include <drivers/gpio.h>
|
||||||
#include <board.h>
|
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include <sys/printk.h>
|
#include <sys/printk.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -22,7 +21,7 @@
|
||||||
|
|
||||||
#define SCROLL_SPEED 300
|
#define SCROLL_SPEED 300
|
||||||
|
|
||||||
#define BUZZER_PIN EXT_P0_GPIO_PIN
|
#define BUZZER_PWM_CHANNEL 0
|
||||||
#define BEEP_DURATION K_MSEC(60)
|
#define BEEP_DURATION K_MSEC(60)
|
||||||
|
|
||||||
#define SEQ_PER_BIT 976
|
#define SEQ_PER_BIT 976
|
||||||
|
@ -130,14 +129,14 @@ void board_play_tune(const char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (period) {
|
if (period) {
|
||||||
pwm_pin_set_usec(pwm, BUZZER_PIN, period, period / 2U,
|
pwm_pin_set_usec(pwm, BUZZER_PWM_CHANNEL,
|
||||||
0);
|
period, period / 2U, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
k_sleep(K_MSEC(duration));
|
k_sleep(K_MSEC(duration));
|
||||||
|
|
||||||
/* Disable the PWM */
|
/* Disable the PWM */
|
||||||
pwm_pin_set_usec(pwm, BUZZER_PIN, 0, 0, 0);
|
pwm_pin_set_usec(pwm, BUZZER_PWM_CHANNEL, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue