/* Program a command to ramp the brightness over time. 
In each step the PWM value is increased or decreased by 1/255th until the maximum or minimum value is reached or step_count steps have been done. */
static int lp5562_program_ramp(const struct device *dev, enum lp5562_led_sources engine, uint8_t command_index, uint32_t time_per_step, uint8_t step_count, enum lp5562_engine_fade_dirs fade_dir)
/* Program a command to ramp the brightness over time. 
In each step the PWM value is increased or decreased by 1/255th until the maximum or minimum value is reached or step_count steps have been done. */
static int lp5562_program_ramp(const struct device *dev, enum lp5562_led_sources engine, uint8_t command_index, uint32_t time_per_step, uint8_t step_count, enum lp5562_engine_fade_dirs fade_dir)
{
	struct lp5562_data *data = dev->data;
	struct led_data *dev_data = &data->dev_data;
	uint8_t prescale, step_time;
	if ((time_per_step < dev_data->min_period) ||
			(time_per_step > dev_data->max_period)) {
		return -EINVAL;
	}
	lp5562_ms_to_prescale_and_step(dev_data, time_per_step,
			&prescale, &step_time);
	return lp5562_program_command(dev, engine, command_index,
			LP5562_PROG_COMMAND_RAMP_TIME(prescale, step_time),
			LP5562_PROG_COMMAND_STEP_COUNT(fade_dir, step_count));
}