45 #include <ti/drivers/PIN.h> 46 #include <ti/drivers/Power.h> 47 #include <ti/drivers/power/PowerCC26XX.h> 48 #include <ti/drivers/pin/PINCC26XX.h> 49 #include <ti/drivers/timer/GPTimerCC26XX.h> 57 #error "Board file doesn't define pin Board_BUZZER" 59 #define BUZZER_PIN Board_BUZZER 61 static const PIN_Config pin_table[] = {
62 BUZZER_PIN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW,
66 static PIN_State pin_state;
67 static PIN_Handle pin_handle;
69 static GPTimerCC26XX_Handle gpt_handle;
72 static volatile bool is_running;
81 GPTimerCC26XX_Params gpt_params;
82 GPTimerCC26XX_Params_init(&gpt_params);
84 gpt_params.mode = GPT_CONFIG_16BIT;
85 gpt_params.mode = GPT_MODE_PERIODIC_UP;
86 gpt_params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;
88 gpt_handle = GPTimerCC26XX_open(Board_GPTIMER0A, &gpt_params);
120 pin_handle = PIN_open(&pin_state, pin_table);
125 Power_setDependency(PowerCC26XX_XOSC_HF);
127 PINCC26XX_setMux(pin_handle, BUZZER_PIN, GPT_PIN_0A);
130 GPTimerCC26XX_Value load_value = (48 * 1000 * 1000) / freq;
132 GPTimerCC26XX_setLoadValue(gpt_handle, load_value);
133 GPTimerCC26XX_start(gpt_handle);
150 Power_releaseDependency(PowerCC26XX_XOSC_HF);
152 GPTimerCC26XX_stop(gpt_handle);
154 PIN_close(pin_handle);
void buzzer_stop()
Stop the buzzer.
bool buzzer_init()
Initialise the buzzer.
bool buzzer_running()
Retrieve the buzzer state.
Header file for the Sensortag Buzzer.
bool buzzer_start(uint32_t freq)
Start the buzzer.