|
|
@ -222,11 +222,6 @@ int PWMOut::set_pwm_rate(unsigned rate_map, unsigned default_rate, unsigned alt_ |
|
|
|
return OK; |
|
|
|
return OK; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int PWMOut::set_i2c_bus_clock(unsigned bus, unsigned clock_hz) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return device::I2C::set_bus_clock(bus, clock_hz); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PWMOut::update_current_rate() |
|
|
|
void PWMOut::update_current_rate() |
|
|
|
{ |
|
|
|
{ |
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -695,7 +690,7 @@ void PWMOut::update_params() |
|
|
|
_num_disarmed_set = num_disarmed_set; |
|
|
|
_num_disarmed_set = num_disarmed_set; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int PWMOut::ioctl(file *filp, int cmd, unsigned long arg) |
|
|
|
int PWMOut::ioctl(device::file_t *filp, int cmd, unsigned long arg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int ret = pwm_ioctl(filp, cmd, arg); |
|
|
|
int ret = pwm_ioctl(filp, cmd, arg); |
|
|
|
|
|
|
|
|
|
|
@ -707,7 +702,7 @@ int PWMOut::ioctl(file *filp, int cmd, unsigned long arg) |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg) |
|
|
|
int PWMOut::pwm_ioctl(device::file_t *filp, int cmd, unsigned long arg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int ret = OK; |
|
|
|
int ret = OK; |
|
|
|
|
|
|
|
|
|
|
@ -1094,34 +1089,6 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg) |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void PWMOut::sensor_reset(int ms) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (ms < 1) { |
|
|
|
|
|
|
|
ms = 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
board_spi_reset(ms, 0xffff); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PWMOut::peripheral_reset(int ms) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (ms < 1) { |
|
|
|
|
|
|
|
ms = 10; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
board_peripheral_reset(ms); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int fmu_new_i2c_speed(unsigned bus, unsigned clock_hz) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return PWMOut::set_i2c_bus_clock(bus, clock_hz); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int PWMOut::test(const char *dev) |
|
|
|
int PWMOut::test(const char *dev) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int fd; |
|
|
|
int fd; |
|
|
@ -1267,50 +1234,6 @@ int PWMOut::custom_command(int argc, char *argv[]) |
|
|
|
|
|
|
|
|
|
|
|
const char *verb = argv[myoptind]; |
|
|
|
const char *verb = argv[myoptind]; |
|
|
|
|
|
|
|
|
|
|
|
/* does not operate on a FMU instance */ |
|
|
|
|
|
|
|
if (!strcmp(verb, "i2c")) { |
|
|
|
|
|
|
|
if (argc > 2) { |
|
|
|
|
|
|
|
int bus = strtol(argv[1], 0, 0); |
|
|
|
|
|
|
|
int clock_hz = strtol(argv[2], 0, 0); |
|
|
|
|
|
|
|
int ret = fmu_new_i2c_speed(bus, clock_hz); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ret) { |
|
|
|
|
|
|
|
PX4_ERR("setting I2C clock failed"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ret; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return print_usage("not enough arguments"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!strcmp(verb, "sensor_reset")) { |
|
|
|
|
|
|
|
if (argc > 1) { |
|
|
|
|
|
|
|
int reset_time = strtol(argv[1], nullptr, 0); |
|
|
|
|
|
|
|
sensor_reset(reset_time); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
sensor_reset(0); |
|
|
|
|
|
|
|
PX4_INFO("reset default time"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!strcmp(verb, "peripheral_reset")) { |
|
|
|
|
|
|
|
if (argc > 2) { |
|
|
|
|
|
|
|
int reset_time = strtol(argv[2], 0, 0); |
|
|
|
|
|
|
|
peripheral_reset(reset_time); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
peripheral_reset(0); |
|
|
|
|
|
|
|
PX4_INFO("reset default time"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* start pwm_out if not running */ |
|
|
|
/* start pwm_out if not running */ |
|
|
|
if (!is_running()) { |
|
|
|
if (!is_running()) { |
|
|
|
|
|
|
|
|
|
|
@ -1394,15 +1317,6 @@ By default the module runs on a work queue with a callback on the uORB actuator_ |
|
|
|
|
|
|
|
|
|
|
|
PRINT_MODULE_USAGE_NAME("pwm_out", "driver"); |
|
|
|
PRINT_MODULE_USAGE_NAME("pwm_out", "driver"); |
|
|
|
PRINT_MODULE_USAGE_COMMAND("start"); |
|
|
|
PRINT_MODULE_USAGE_COMMAND("start"); |
|
|
|
|
|
|
|
|
|
|
|
PRINT_MODULE_USAGE_COMMAND_DESCR("sensor_reset", "Do a sensor reset (SPI bus)"); |
|
|
|
|
|
|
|
PRINT_MODULE_USAGE_ARG("<ms>", "Delay time in ms between reset and re-enabling", true); |
|
|
|
|
|
|
|
PRINT_MODULE_USAGE_COMMAND_DESCR("peripheral_reset", "Reset board peripherals"); |
|
|
|
|
|
|
|
PRINT_MODULE_USAGE_ARG("<ms>", "Delay time in ms between reset and re-enabling", true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PRINT_MODULE_USAGE_COMMAND_DESCR("i2c", "Configure I2C clock rate"); |
|
|
|
|
|
|
|
PRINT_MODULE_USAGE_ARG("<bus_id> <rate>", "Specify the bus id (>=0) and rate in Hz", false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PRINT_MODULE_USAGE_COMMAND_DESCR("test", "Test outputs"); |
|
|
|
PRINT_MODULE_USAGE_COMMAND_DESCR("test", "Test outputs"); |
|
|
|
PRINT_MODULE_USAGE_DEFAULT_COMMANDS(); |
|
|
|
PRINT_MODULE_USAGE_DEFAULT_COMMANDS(); |
|
|
|
|
|
|
|
|
|
|
|