修改拼写错误

This commit is contained in:
Riggin 2023-08-04 14:50:09 +08:00
parent 492571c777
commit 3ec5425cdf
3 changed files with 10 additions and 12 deletions

View File

@ -118,7 +118,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.
@ -129,5 +129,3 @@ int main()
{} {}
} }
``` ```

View File

@ -12,8 +12,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 handle: the button handle struct.
* @param pin_level: read the HAL GPIO of the connet button level. * @param pin_level: read the HAL GPIO of the connected button level.
* @param active_level: pressed GPIO level. * @param active_level: pressed GPIO level.
* @param button_id: the button id. * @param button_id: the button id.
* @retval None * @retval None
@ -30,7 +30,7 @@ void button_init(struct Button* handle, uint8_t(*pin_level)(uint8_t), uint8_t ac
/** /**
* @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
@ -42,7 +42,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)
@ -52,7 +52,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
*/ */
void button_handler(struct Button* handle) void button_handler(struct Button* handle)
@ -69,7 +69,7 @@ void button_handler(struct Button* handle)
handle->button_level = read_gpio_level; handle->button_level = read_gpio_level;
handle->debounce_cnt = 0; handle->debounce_cnt = 0;
} }
} else { //leved not change ,counter reset. } else { //level not change ,counter reset.
handle->debounce_cnt = 0; handle->debounce_cnt = 0;
} }
@ -156,7 +156,7 @@ 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)
@ -173,7 +173,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)

View File

@ -11,7 +11,7 @@
//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)