Initial import of STM32 IoT sensor node
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#ifndef __BEEP_H
|
||||
#define __BEEP_H
|
||||
|
||||
/*
|
||||
* 蜂鸣器管脚: PC7
|
||||
* 根据电路原理图:
|
||||
* 输出高电平:响
|
||||
* 输出低电平:不响
|
||||
*/
|
||||
#include <stm32f10x_conf.h>
|
||||
|
||||
#define GPIOC_CRL *(volatile unsigned int *)(0x40011000 + 0x00)
|
||||
#define GPIOC_ODR *(volatile unsigned int *)(0x40011000 + 0x0C)
|
||||
|
||||
// 蜂鸣器初始化
|
||||
void beep_init(void);
|
||||
// 蜂鸣器开
|
||||
void beep_on(void);
|
||||
// 蜂鸣器关
|
||||
void beep_off(void);
|
||||
// 获取蜂鸣器状态,返回 0 为关,1 为开
|
||||
int beep_get_status(void);
|
||||
|
||||
#endif // __BEEP_H
|
||||
Reference in New Issue
Block a user