Skip to content
Snippets Groups Projects
Commit 9cce6836 authored by bbartels's avatar bbartels Committed by dawehr
Browse files

wip: fix pwm_output test

parent 63ea76f8
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#define THROTTLE_PULSE_WIDTH_LOW 100000 // 1us #define THROTTLE_PULSE_WIDTH_LOW 100000 // 1us
#define THROTTLE_PULSE_WIDTH_HIGH 200000 // 2us #define THROTTLE_PULSE_WIDTH_HIGH 200000 // 2us
#define PERIOD_WIDTH 222222 // 100000000 ns / 450 #define PERIOD_WIDTH 222222 // 100000000 ns / 450
#define PULSE_WIDTH_ADDR_OFFSET 4 #define PULSE_WIDTH_ADDR_OFFSET 1
struct PWMOutputDriverState { struct PWMOutputDriverState {
int *outputs[4]; int *outputs[4];
......
...@@ -95,7 +95,7 @@ int test_zybo_pwm_inputs() { ...@@ -95,7 +95,7 @@ int test_zybo_pwm_inputs() {
for (i = 0; i < 6; i += 1) { for (i = 0; i < 6; i += 1) {
pwm_inputs.read(&pwm_inputs, i, &pwms[i]); pwm_inputs.read(&pwm_inputs, i, &pwms[i]);
} }
int temp = 0; continue;
} }
} }
...@@ -117,18 +117,22 @@ int test_zybo_pwm_inputs() { ...@@ -117,18 +117,22 @@ int test_zybo_pwm_inputs() {
int test_zybo_pwm_outputs() { int test_zybo_pwm_outputs() {
struct PWMOutputDriver pwm_outputs = create_zybo_pwm_outputs(); struct PWMOutputDriver pwm_outputs = create_zybo_pwm_outputs();
pwm_outputs.reset(&pwm_outputs); pwm_outputs.reset(&pwm_outputs);
struct SystemDriver sys = create_zybo_system();
sys.reset(&sys);
unsigned long pwms[4]; unsigned long pwms[4];
pwms[0] = 1000; pwms[0] = 100000;
pwms[1] = 1000; pwms[1] = 100000;
pwms[2] = 1000; pwms[2] = 100000;
pwms[3] = 1000; pwms[3] = 100000;
int n = 0;
while (1) { while (1) {
int i; int i;
for (i = 0; i < 4; i += 1) { for (i = 0; i < 4; i += 1) {
pwm_outputs.write(&pwm_outputs, i, pwms[i]); pwm_outputs.write(&pwm_outputs, i, pwms[i] + n++);
sys.sleep(&sys, 50);
} }
int temp = 0; continue;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment