GadgetSeed
0.9.6
|
圧電ブザードライバ [詳解]
#include "sysconfig.h"
#include "device.h"
#include "device/buzzer_ioctl.h"
#include "timer.h"
#include "tkprintf.h"
#include "stm32f4xx_hal.h"
関数 | |
void | MX_TIM3_Init (void) |
void | HAL_TIM_Base_MspInit (TIM_HandleTypeDef *htim_base) |
void | start_tim3 (void) |
void | on_buzzer (long cycle) |
void | off_buzzer (void) |
static int | buzzer_register (struct st_device *dev, char *param) |
static int | buzzer_unregister (struct st_device *dev) |
static int | buzzer_open (struct st_device *dev) |
static int | buzzer_close (struct st_device *dev) |
static int | buzzer_ioctl (struct st_device *dev, unsigned int com, unsigned int arg, void *param) |
static int | buzzer_suspend (struct st_device *dev) |
static int | buzzer_resume (struct st_device *dev) |
変数 | |
TIM_HandleTypeDef | htim3 |
const struct st_device | buzzer_device |
圧電ブザードライバ
接続
圧電ブザー STM32F4(CPU PIN)
DIN PB1(27pin)
ブザー音のパルスはTIM3で作成
使用方法
ioctl(0:Off/1:On, 周波数(Hz))
tim3_buzzer.c に定義があります。
const struct st_device buzzer_device |
tim3_buzzer.c の 166 行目に定義があります。