Initial import of STM32 IoT sensor node
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#ifndef __BUTTON_H
|
||||
#define __BUTTON_H
|
||||
|
||||
/*
|
||||
* ---按键-----+--PIN--+---输入方式---+--CNF 位的值--+--MODE 位的值--+--按下状态--
|
||||
* KEY0 | PC9 | 上拉输入 | 10 | 00 | 0
|
||||
* KEY1 | PC8 | 上拉输入 | 10 | 00 | 0
|
||||
* KEY2(WK_UP) | PA0 | 下拉输入 | 10 | 00 | 1
|
||||
*/
|
||||
|
||||
#include <stm32f10x_conf.h>
|
||||
|
||||
// PC 组针脚控制寄存器
|
||||
// #define GPIOC_CRH *(volatile unsigned int *)(0x40011000 + 0x04)
|
||||
// #define GPIOC_IDR *(volatile unsigned int *)(0x40011000 + 0x08)
|
||||
// #define GPIOC_ODR *(volatile unsigned int *)(0x40011000 + 0x0c)
|
||||
// PA 组针脚控制寄存器
|
||||
// #define GPIOA_CRL *(volatile unsigned int *)(0x40010800 + 0x00)
|
||||
// #define GPIOA_IDR *(volatile unsigned int *)(0x40010800 + 0x08)
|
||||
// #define GPIOA_ODR *(volatile unsigned int *)(0x40010800 + 0x0c)
|
||||
|
||||
|
||||
|
||||
// 初始化按键的 IO 针脚
|
||||
void button_init(void);
|
||||
// 获取某一个按键 nu 的状态
|
||||
// 返回 1 按下, 返回 0 抬起
|
||||
int button_status(int nu);
|
||||
|
||||
#endif // __BUTTON_H
|
||||
Reference in New Issue
Block a user