60 lines
2.0 KiB
C
60 lines
2.0 KiB
C
/**
|
|
* @file imp_comp_sg90.h
|
|
* @author Alvin Young (impressionyang@outlook.com)
|
|
* @brief
|
|
* @version 0.1
|
|
* @date 2025-04-14
|
|
*
|
|
* _ _
|
|
* (_)_ _ ___ _______ ___ ___ (_)__ ___ __ _____ ____ ___ _
|
|
* / / ' \/ _ \/ __/ -_|_-<(_-</ / _ \/ _ \/ // / _ `/ _ \/ _ `/
|
|
* /_/_/_/_/ .__/_/ \__/___/___/_/\___/_//_/\_, /\_,_/_//_/\_, /
|
|
* /_/ /___/ /___/
|
|
* @copyright Copyright (c) 2025 impressionyang
|
|
*
|
|
* @par 修改日志:
|
|
* <table>
|
|
* <tr><th>Date <th>Version <th>Author <th>Description
|
|
* <tr><td>2025-04-14 <td>v1.0 <td>Alvin Young <td>首次创建
|
|
* </table>
|
|
*
|
|
*/
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
#ifndef __IMP_COMP_SG90_H__
|
|
#define __IMP_COMP_SG90_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include <stdint.h>
|
|
#include "iot_servo.h"
|
|
/* define --------------------------------------------------------------------*/
|
|
/* typedef -------------------------------------------------------------------*/
|
|
|
|
typedef struct __imp_comp_sg90_t__
|
|
{
|
|
uint8_t is_init;
|
|
uint8_t speed_mode;
|
|
uint8_t servo_pin;
|
|
uint8_t servo_pwm_channel;
|
|
servo_config_t servo_config;
|
|
} imp_comp_sg90_t;
|
|
/* variables -----------------------------------------------------------------*/
|
|
/* Private function(only *.c) -----------------------------------------------*/
|
|
/* Exported functions --------------------------------------------------------*/
|
|
|
|
uint8_t imp_comp_sg90_init(imp_comp_sg90_t* handle, uint8_t gpio, uint8_t pwm_ch);
|
|
uint8_t imp_comp_sg90_set_angle(imp_comp_sg90_t* handle, float angle);
|
|
uint8_t imp_comp_sg90_get_angle(imp_comp_sg90_t* handle, float* angle);
|
|
uint8_t imp_comp_sg90_deinit(imp_comp_sg90_t* handle);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif //__IMP_COMP_SG90_H__
|
|
|
|
/*
|
|
* EOF
|
|
*/ |