@@ -72,81 +72,9 @@ void analogin_test(PinName pin)
72
72
tester.gpio_write (MbedTester::LogicalPinGPIO0, 0 , false );
73
73
}
74
74
75
- void analogin_full_test (PinName pin)
76
- {
77
- /* Test analog input */
78
-
79
- printf (" Testing AnalogIn\r\n " );
80
-
81
- // Remap pins for test
82
- tester.reset ();
83
-
84
- // Reset tester stats and select GPIO
85
- tester.peripherals_reset ();
86
- tester.select_peripheral (MbedTester::PeripheralGPIO);
87
-
88
- analogin_t analogin;
89
- analogin_init (&analogin, pin);
90
-
91
- // enable analog MUX
92
- tester.set_mux_enable (true );
93
-
94
- // set MUX address
95
- tester.set_mux_addr (pin);
96
-
97
- float voltage = 0.0 ;
98
- bool enable = true ;
99
- uint32_t period = 100 ;
100
- uint32_t duty_cycle = 0 ;
101
- // enable FPGA system PWM
102
- tester.set_analog_out (voltage, enable);
103
-
104
- TEST_ASSERT_EQUAL (true , tester.get_pwm_enable ());
105
- TEST_ASSERT_EQUAL (period, tester.get_pwm_period ());
106
- TEST_ASSERT_EQUAL (duty_cycle, tester.get_pwm_cycles_high ());
107
- // test duty cycles 0-100% at 1000ns period
108
- for (int i = 0 ; i < 11 ; i += 1 ) {
109
- voltage = (float )i * 0 .1f ;
110
- duty_cycle = 10 * i;
111
- tester.set_analog_out (voltage, enable);
112
- wait_us (10 );
113
- // read analog input
114
- // assert pwm duty_cycle is correct based on set analog voltage
115
- TEST_ASSERT_EQUAL (duty_cycle, tester.get_pwm_cycles_high ());
116
- TEST_ASSERT_FLOAT_WITHIN (DELTA_FLOAT, 0 .01f * (float )duty_cycle, analogin_read (&analogin));
117
- }
118
- tester.set_pwm_enable (false );
119
- TEST_ASSERT_EQUAL (false , tester.get_pwm_enable ());
120
- wait_us (10 );
121
-
122
- // assert Mbed pin correctly drives AnalogMuxIn
123
- tester.pin_map_set (pin, MbedTester::LogicalPinGPIO0);
124
-
125
- tester.gpio_write (MbedTester::LogicalPinGPIO0, 0 , true );
126
- TEST_ASSERT_EQUAL (0 , tester.sys_pin_read (MbedTester::AnalogMuxIn));
127
- wait_us (10 );
128
- tester.gpio_write (MbedTester::LogicalPinGPIO0, 1 , true );
129
- TEST_ASSERT_EQUAL (1 , tester.sys_pin_read (MbedTester::AnalogMuxIn));
130
- wait_us (10 );
131
- tester.gpio_write (MbedTester::LogicalPinGPIO0, 0 , true );
132
- TEST_ASSERT_EQUAL (0 , tester.sys_pin_read (MbedTester::AnalogMuxIn));
133
- wait_us (10 );
134
- tester.gpio_write (MbedTester::LogicalPinGPIO0, 0 , false );
135
- wait_us (10 );
136
- tester.set_mux_enable (false );
137
- wait_us (10 );
138
-
139
- TEST_ASSERT_EQUAL (1 , tester.self_test_control_current ());// assert control channel still functioning properly
140
- }
141
-
142
75
Case cases[] = {
143
76
// This will be run for all pins
144
77
Case (" AnalogIn - init test" , all_ports<AnaloginPort, DefaultFormFactor, analogin_init>),
145
- // This test case is disabled for now due to hardware issue in the first rev of FPGA Test Shield
146
- #if 0
147
- Case("AnalogIn - full test", all_ports<AnaloginPort, DefaultFormFactor, analogin_full_test>),
148
- #endif
149
-
150
78
// This will be run for single pin
151
79
Case (" AnalogIn - read test" , all_ports<AnaloginPort, DefaultFormFactor, analogin_test>),
152
80
};
0 commit comments