Skip to content

Commit

Permalink
FIXME: initial buzzer support
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Wilson <[email protected]>
  • Loading branch information
cdwilson committed May 30, 2024
1 parent 2aa9b25 commit 91c4612
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions boards/aludel_elixir_ns.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@ CONFIG_BOOTLOADER_MCUBOOT=y

# Use Golioth Ostentus Faceplate
CONFIG_LIB_OSTENTUS=y

# Enable Golioth buzzer PWM library
CONFIG_PWM=y
CONFIG_PWM_BUZZER=y
CONFIG_PWM_BUZZER_SONGS=y
24 changes: 24 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(golioth_rd_template, LOG_LEVEL_DBG);
#include <samples/common/net_connect.h>
#include <samples/common/sample_credentials.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/pwm.h>

#ifdef CONFIG_SOC_NRF9160
#include <modem/lte_lc.h>
Expand All @@ -33,6 +34,18 @@ LOG_MODULE_REGISTER(golioth_rd_template, LOG_LEVEL_DBG);
#include <modem/modem_info.h>
#endif

#ifdef CONFIG_PWM_BUZZER
#include <pwm_buzzer.h>
#endif /* CONFIG_PWM_BUZZER */

#ifdef CONFIG_PWM_BUZZER_SONGS
#include <pwm_buzzer_songs.h>
#endif /* CONFIG_PWM_BUZZER_SONGS */

#if DT_NODE_EXISTS(DT_ALIAS(pwm_buzzer0))
const struct pwm_dt_spec buzzer = PWM_DT_SPEC_GET(DT_ALIAS(pwm_buzzer0));
#endif /* DT_NODE_EXISTS(DT_ALIAS(pwm_buzzer0)) */

/* Current firmware version; update in prj.conf or via build argument */
static const char *_current_version = CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION;

Expand Down Expand Up @@ -254,6 +267,17 @@ int main(void)
slideshow(30000);
));

#ifdef CONFIG_PWM_BUZZER
pwm_buzzer_init(&buzzer);
// pwm_buzzer_beep(&buzzer);
#endif /* CONFIG_PWM_BUZZER */

#ifdef CONFIG_PWM_BUZZER_SONGS
// pwm_buzzer_play_funkytown(&buzzer);
pwm_buzzer_play_mario(&buzzer);
// pwm_buzzer_play_golioth(&buzzer);
#endif /* CONFIG_PWM_BUZZER_SONGS */

while (true) {
app_sensors_read_and_stream();

Expand Down
5 changes: 5 additions & 0 deletions west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,10 @@ manifest:
revision: v1.1.1
url: https://github.com/golioth/zephyr-network-info

- name: reference-design-common
path: deps/modules/lib/reference-design-common
revision: 73843d3d0e41e31715d6f663eb87b3d0724ed532
url: https://github.com/golioth/reference-design-common

self:
path: app

0 comments on commit 91c4612

Please sign in to comment.