Skip to content

Commit

Permalink
add TCC beep example
Browse files Browse the repository at this point in the history
  • Loading branch information
joeycastillo committed Aug 29, 2024
1 parent ff220ae commit 3a63198
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/beep_tcc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Keep this first line.
GOSSAMER_PATH = ../..

# If your firmware targets a specific board, specify it here,
# or omit it and provide it on the command line (make BOARD=foo).
BOARD=circuitplayground

# Leave this line here.
include $(GOSSAMER_PATH)/make.mk

SRCS += \
./app.c \

# Finally, leave this line at the bottom of the file.
include $(GOSSAMER_PATH)/rules.mk
22 changes: 22 additions & 0 deletions examples/beep_tcc/app.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "app.h"
#include "delay.h"
#include "tcc.h"

void app_init(void) {
}

void app_setup(void) {
HAL_GPIO_A1_out();
HAL_GPIO_A1_pmuxen(HAL_GPIO_PMUX_TC_TCC);

// 8 Mhz / 250 = 32 kHz
tcc_init(0, GENERIC_CLOCK_0, TCC_PRESCALER_DIV1);
tcc_set_wavegen(0, TCC_WAVEGEN_NORMAL_PWM);
tcc_set_period(0, 250, false);
tcc_set_cc(0, 1, 125, false);
tcc_enable(0);
}

bool app_loop(void) {
return false;
}

0 comments on commit 3a63198

Please sign in to comment.