33 lines
500 B
C
33 lines
500 B
C
/**
|
|
* @file magnet.h
|
|
* @brief 单 GPIO 电磁铁控制
|
|
*/
|
|
|
|
#ifndef MAGNET_H
|
|
#define MAGNET_H
|
|
|
|
#include <stdbool.h>
|
|
#include "driver/gpio.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief 初始化电磁铁 GPIO (推挽输出, 默认关闭)
|
|
* @param gpio GPIO 引脚号, 如 GPIO_NUM_5
|
|
*/
|
|
void magnet_init(int gpio);
|
|
|
|
/**
|
|
* @brief 设置电磁铁状态
|
|
* @param on true=吸合, false=释放
|
|
*/
|
|
void magnet_set(bool on);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* MAGNET_H */
|