AP_HAL_Linux: adapt Heat_Pwm for Edge

This commit is contained in:
Georgii Staroselskii 2017-10-17 21:09:10 +03:00 committed by Lucas De Marchi
parent 069c98b8a9
commit 79c14a92a9

View File

@ -15,7 +15,10 @@
#include <AP_HAL/AP_HAL.h>
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || \
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO || \
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_EDGE
#include <cmath>
#include <fcntl.h>
#include <linux/limits.h>
@ -37,7 +40,13 @@ HeatPwm::HeatPwm(uint8_t pwm_num, float Kp, float Ki, uint32_t period_ns) :
_Ki(Ki),
_period_ns(period_ns)
{
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_EDGE
_pwm = new PWM_Sysfs(0, pwm_num);
hal.gpio->pinMode(26, HAL_GPIO_OUTPUT);
hal.gpio->write(26, 1);
#else
_pwm = new PWM_Sysfs_Bebop(pwm_num);
#endif
_pwm->init();
_pwm->set_period(_period_ns);
_pwm->set_duty_cycle(0);