|
GadgetSeed
0.9.6
|
圧電ブザードライバ [詳解]
#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"
マクロ定義 | |
| #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 |
圧電ブザードライバ
接続
圧電ブザー STM32F7(CPU PIN)
DIN PH6
ブザー音のパルスはTIM12で作成
使用方法
ioctl(0:Off/1:On, 周波数(Hz))
tim12_buzzer.c に定義があります。
| const device buzzer_device |
tim12_buzzer.c の 205 行目に定義があります。