GadgetSeed  0.9.6
tim12_buzzer.c ファイル

圧電ブザードライバ [詳解]

#include "sysconfig.h"
#include "device.h"
#include "device/buzzer_ioctl.h"
#include "timer.h"
#include "tkprintf.h"
#include "stm32f7xx_hal.h"
#include "stm32f7xx_hal_tim.h"
#include "dkprintf.h"
tim12_buzzer.c の依存先関係図:

[ソースコード]

マクロ定義

#define ARDUINO_PWM_D6_Pin   GPIO_PIN_6
 
#define ARDUINO_PWM_D6_GPIO_Port   GPIOH
 

関数

static void MX_TIM12_Init (void)
 
void HAL_TIM_Base_MspInit (TIM_HandleTypeDef *htim_base)
 
void start_tim12 (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, long com, long arg)
 
static int buzzer_suspend (struct st_device *dev)
 
static int buzzer_resume (struct st_device *dev)
 

変数

TIM_HandleTypeDef htim12
 
const device buzzer_device
 

詳解

圧電ブザードライバ

日付
2017.02.04
著者
Takashi SHUDO

接続

圧電ブザー STM32F7(CPU PIN)


DIN PH6

ブザー音のパルスはTIM12で作成

使用方法

ioctl(0:Off/1:On, 周波数(Hz))

tim12_buzzer.c に定義があります。

変数詳解

◆ buzzer_device

const device buzzer_device
初期値:
= {
.explan = "STM32F7 TIM12 buzzer",
.register_dev = buzzer_register,
.unregister_dev = buzzer_unregister,
.open = buzzer_open,
.close = buzzer_close,
.ioctl = buzzer_ioctl,
.suspend = buzzer_suspend,
.resume = buzzer_resume,
}
#define DEF_DEV_NAME_BUZZER
標準ブザーデバイス名
Definition: buzzer_ioctl.h:15

tim12_buzzer.c205 行目に定義があります。