久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

標題: KeyMatrix-Library (STM32F4)源碼 [打印本頁]

作者: JAVADSALAR    時間: 2017-12-19 19:16
標題: KeyMatrix-Library (STM32F4)源碼
KeyMatrix Library (STM32F4)

Here is a library with which you can connect a keypad that is built as an X / Y matrix to the STM32F4.

It does not matter what the arrangement of the key matrix is (3 × 3, 4 × 3, 2 × 5, etc.).
No external diodes or pull-ups are needed.

In the H-file the size of the keyboard matrix is set (in the example 3 × 4)
and in the C-File the GPIO pins are assigned to the X and Y direction.

There is a function to read out the pressed key, which returns "0" if no key is pressed. If one or more keys are pressed, the key number of the first key found is returned. (In Example 1 to 12)

To debounce the buttons no timer but only a loop counter is used.
(this event needs to be adapted for you)

Note: if the return value is> 0 even if no keyboard is connected, external pull-ups (4k7) must be attached to the Y-lines.

Images :



//--------------------------------------------------------------
// File     : main.c
// Datum    : 02.05.2014
// Version  : 1.0
// Autor    : UB
// EMail    : mc-4u(@)t-online.de
// CPU      : STM32F4
// IDE      : CooCox CoIDE 1.7.4
// GCC      : 4.7 2012q4
// Module   : CMSIS_BOOT, M4_CMSIS_CORE
// Funktion : Demo der Key-Matrix-Library
// Hinweis  : Diese zwei Files muessen auf 8MHz stehen
//              "cmsis_boot/stm32f4xx.h"
//              "cmsis_boot/system_stm32f4xx.c"
//--------------------------------------------------------------

#include "main.h"
#include "stm32_ub_keymatrix.h"
#include "stm32_ub_led.h"

int main(void)
{
  uint8_t key_value;

  SystemInit(); // Quarz Einstellungen aktivieren

  // init der LEDs
  UB_Led_Init();

  // init der Tastatur-Matrix
  UB_KeyMatrix_Init();

  while(1)
  {
    // Tastatur-Matrix abfragen
    key_value=UB_KeyMatrix_Scan();
    // LEDs je nach Tasten-Nr schalten
    if(key_value==1) UB_Led_On(LED_GREEN); else UB_Led_Off(LED_GREEN);
    if(key_value==2) UB_Led_On(LED_RED); else UB_Led_Off(LED_RED);
    if(key_value==3) UB_Led_On(LED_BLUE); else UB_Led_Off(LED_BLUE);
    if(key_value==4) UB_Led_On(LED_ORANGE); else UB_Led_Off(LED_ORANGE);
  }
}

全部資料51hei下載地址:
Demo_83_KEY_Matrix.zip (173.43 KB, 下載次數: 12)







歡迎光臨 (http://m.zg4o1577.cn/bbs/) Powered by Discuz! X3.1
主站蜘蛛池模板: 午夜精品视频 | 黄色网址av| 久久88 | 亚洲免费视频网站 | 中文字幕免费高清 | 久久国产亚洲 | 国产日韩欧美在线观看 | 久久久久久伊人 | 免费观看全黄做爰的视频 | 国产亚洲天堂 | 黄色录像一级片 | 色综合五月 | 成年在线观看 | 欧美日韩精品在线观看 | 蜜桃精品噜噜噜成人av | 国产福利网 | av大全在线观看 | 国产一级片网站 | 日韩一级黄色片 | 在线成人小视频 | 亚洲网站在线 | 女人av在线 | 日韩欧美一级片 | 日本特黄特色aaa大片免费 | 国产精品免费一区二区三区 | www..com黄| 黄色片免费观看 | 国产一区二区三区免费 | 日韩在线视频网站 | 一区二区三区四区精品 | 精品国产福利 | 国产视频www| 亚洲欧美日韩一区二区三区四区 | 在线欧美| 中文字字幕在线 | 成人在线视频观看 | 不卡的av在线 | 天堂在线www| 一区在线视频 | 三级av在线 | 中文字幕网址在线 |