Просмотр исходного кода

修正拼写错误

from:
https://github.com/0x1abin/MultiButton/commit/3ec5425cdf7556dd80420cca24ad5656d62f81db

https://github.com/0x1abin/MultiButton/commit/3e5fb48a6b775bcff750433f7a9e1291d5965422
Meco Man 2 лет назад
Родитель
Сommit
69fd2d7597
3 измененных файлов с 13 добавлено и 16 удалено
  1. 2 5
      README.md
  2. 8 8
      multi_button.c
  3. 3 3
      multi_button.h

+ 2 - 5
README.md

@@ -105,7 +105,7 @@ int main()
 	button_attach(&btn1, SINGLE_CLICK,     BTN1_SINGLE_Click_Handler);
 	button_attach(&btn1, SINGLE_CLICK,     BTN1_SINGLE_Click_Handler);
 	button_attach(&btn1, DOUBLE_CLICK,     BTN1_DOUBLE_Click_Handler);
 	button_attach(&btn1, DOUBLE_CLICK,     BTN1_DOUBLE_Click_Handler);
 	button_attach(&btn1, LONG_PRESS_START, BTN1_LONG_PRESS_START_Handler);
 	button_attach(&btn1, LONG_PRESS_START, BTN1_LONG_PRESS_START_Handler);
-	button_attach(&btn2, LONG_PRESS_HOLD,  BTN1_LONG_PRESS_HOLD_Handler);
+	button_attach(&btn1, LONG_PRESS_HOLD,  BTN1_LONG_PRESS_HOLD_Handler);
 	button_start(&btn1);
 	button_start(&btn1);
 	
 	
 	//make the timer invoking the button_ticks() interval 5ms.
 	//make the timer invoking the button_ticks() interval 5ms.
@@ -116,11 +116,8 @@ int main()
 	{}
 	{}
 }
 }
 
 
-...
 ```
 ```
 
 
-
-
 ## 状态图
 ## 状态图
 
 
-![states.png](states.png)
+![states.png](states.png)

+ 8 - 8
multi_button.c

@@ -24,8 +24,8 @@ static struct button* head_handle = NULL;
 
 
 /**
 /**
   * @brief  Initializes the button struct handle.
   * @brief  Initializes the button struct handle.
-  * @param  handle: the button handle strcut.
-  * @param  pin_level: read the pin of the connet button level.
+  * @param  handle: the button handle struct.
+  * @param  pin_level: read the pin of the connected button level.
   * @param  active_level: pin pressed level.
   * @param  active_level: pin pressed level.
   * @retval None
   * @retval None
   */
   */
@@ -40,7 +40,7 @@ void button_init(struct button* handle, uint8_t(*pin_level)(void), uint8_t activ
 
 
 /**
 /**
   * @brief  Attach the button event callback function.
   * @brief  Attach the button event callback function.
-  * @param  handle: the button handle strcut.
+  * @param  handle: the button handle struct.
   * @param  event: trigger event type.
   * @param  event: trigger event type.
   * @param  cb: callback function.
   * @param  cb: callback function.
   * @retval None
   * @retval None
@@ -52,7 +52,7 @@ void button_attach(struct button* handle, PressEvent event, BtnCallback cb)
 
 
 /**
 /**
   * @brief  Inquire the button event happen.
   * @brief  Inquire the button event happen.
-  * @param  handle: the button handle strcut.
+  * @param  handle: the button handle struct.
   * @retval button event.
   * @retval button event.
   */
   */
 PressEvent get_button_event(struct button* handle)
 PressEvent get_button_event(struct button* handle)
@@ -62,7 +62,7 @@ PressEvent get_button_event(struct button* handle)
 
 
 /**
 /**
   * @brief  button driver core function, driver state machine.
   * @brief  button driver core function, driver state machine.
-  * @param  handle: the button handle strcut.
+  * @param  handle: the button handle struct.
   * @retval None
   * @retval None
   */
   */
 static void button_handler(struct button* handle)
 static void button_handler(struct button* handle)
@@ -88,7 +88,7 @@ static void button_handler(struct button* handle)
     }
     }
     else
     else
     {
     {
-        // leved not change ,counter reset.
+        // level not change ,counter reset.
         handle->debounce_cnt = 0;
         handle->debounce_cnt = 0;
     }
     }
 
 
@@ -201,7 +201,7 @@ static void button_handler(struct button* handle)
 
 
 /**
 /**
   * @brief  Start the button work, add the handle into work list.
   * @brief  Start the button work, add the handle into work list.
-  * @param  handle: target handle strcut.
+  * @param  handle: target handle struct.
   * @retval 0: succeed. -1: already exist.
   * @retval 0: succeed. -1: already exist.
   */
   */
 int button_start(struct button* handle)
 int button_start(struct button* handle)
@@ -226,7 +226,7 @@ int button_start(struct button* handle)
 
 
 /**
 /**
   * @brief  Stop the button work, remove the handle off work list.
   * @brief  Stop the button work, remove the handle off work list.
-  * @param  handle: target handle strcut.
+  * @param  handle: target handle struct.
   * @retval None
   * @retval None
   */
   */
 void button_stop(struct button* handle)
 void button_stop(struct button* handle)

+ 3 - 3
multi_button.h

@@ -1,12 +1,12 @@
 #ifndef __MULTI_BUTTON_H_
 #ifndef __MULTI_BUTTON_H_
 #define __MULTI_BUTTON_H_
 #define __MULTI_BUTTON_H_
 
 
-#include "stdint.h"
-#include "string.h"
+#include <stdint.h>
+#include <string.h>
 
 
 //According to your need to modify the constants.
 //According to your need to modify the constants.
 #define TICKS_INTERVAL    5 //ms
 #define TICKS_INTERVAL    5 //ms
-#define DEBOUNCE_TICKS    3 //MAX 8
+#define DEBOUNCE_TICKS    3 //MAX 7 (0 ~ 7)
 #define SHORT_TICKS       (300  / TICKS_INTERVAL)
 #define SHORT_TICKS       (300  / TICKS_INTERVAL)
 #define LONG_TICKS        (1000 / TICKS_INTERVAL)
 #define LONG_TICKS        (1000 / TICKS_INTERVAL)
 #define LONG_HOLD_CYC     (500 / TICKS_INTERVAL)
 #define LONG_HOLD_CYC     (500 / TICKS_INTERVAL)