the latest failing version os spwm_test
@@ -27,6 +27,33 @@ int arg = 0;
struct pwm_dev *pwm;
//static int value = 10000;
+/**
+ * @brief Function to be called in timer interrupt.
+ *
+ * @param[in] p_context General purpose pointer (unused).
+ */
+void pwm_handler()
+{
+ uint8_t new_duty_cycle = 22;
+ /* uint32_t err_code; */
+ /* UNUSED_PARAMETER(p_context); */
+
+ /* low_power_pwm_t * pwm_instance = (low_power_pwm_t*)p_context; */
+ /* if(interval <= n_intervals && interval >= 0) */
+ /* { */
+ /* new_duty_cycle = pow (2, (interval / R)) - 1; */
+ /* err_code = low_power_pwm_duty_set(pwm_instance, new_duty_cycle); */
+ /* APP_ERROR_CHECK(err_code); */
+ /* interval += (up) ? 1 : -1; */
+ /* } */
+ /* else */
+ /* { */
+ /* interval += (up) ? -1 : 1; */
+ /* up = ! up; */
+ /* } */
+ pwm_enable_duty_cycle(pwm, 0, new_duty_cycle);
+}
+
int
main(int argc, char **argv)
{
@@ -45,9 +72,10 @@ main(int argc, char **argv)
NULL);
pwm = (struct pwm_dev *) os_dev_open("pwm", 0, NULL);
+ uint32_t pin = LED_1;
/* pwm_chan_config(pwm, 0, &chan_conf); */
- pwm_chan_config(pwm, 0, NULL);
- pwm_enable_duty_cycle(pwm, 0, 100);
+ pwm_chan_config(pwm, 0, &pin);
+ pwm_enable_duty_cycle(pwm, 0, 10);
/* chan_conf.pin = LED_2; */
/* pwm_chan_config(pwm, 1, &chan_conf); */
