application: improve target show display, and show signal voltages
This commit is contained in:
parent
1bcbf3fd5f
commit
66f26f3093
|
@ -131,6 +131,24 @@ static float* measure_voltages(void)
|
||||||
return voltages;
|
return voltages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** measure and print target voltage */
|
||||||
|
static void print_voltage_target(void)
|
||||||
|
{
|
||||||
|
gpio_set(GPIO_PORT(SIGNAL_PU_PIN), GPIO_PIN(SIGNAL_PU_PIN)); // ensure we are not pulling up the signal
|
||||||
|
gpio_set(GPIO_PORT(SIGNAL_PD_PIN), GPIO_PIN(SIGNAL_PD_PIN)); // ensure we are not pulling down the signal
|
||||||
|
gpio_set(GPIO_PORT(TARGET_EN), GPIO_PIN(TARGET_EN)); // ensure the level shifters pulling up the signals are not enabled
|
||||||
|
float* voltages = measure_voltages(); // measure voltages
|
||||||
|
puts("target voltage: ");
|
||||||
|
print_voltage(voltages[1], 2);
|
||||||
|
puts(" V");
|
||||||
|
if (voltages[1] > 3.25) {
|
||||||
|
puts(" (warning: signal voltage may exceed 3.30 V limit)");
|
||||||
|
} else if (voltages[1] < 1.0) {
|
||||||
|
puts(" (warning: target voltage seems not connected)");
|
||||||
|
}
|
||||||
|
putc('\n');
|
||||||
|
}
|
||||||
|
|
||||||
/** select channel of multiplexer
|
/** select channel of multiplexer
|
||||||
* @param[in] channel channel to select, or -1 to disable multiplexer
|
* @param[in] channel channel to select, or -1 to disable multiplexer
|
||||||
*/
|
*/
|
||||||
|
@ -199,15 +217,15 @@ static void command_swd_scan(void* argument)
|
||||||
static void command_voltages(void* argument)
|
static void command_voltages(void* argument)
|
||||||
{
|
{
|
||||||
(void)argument; // we won't use the argument
|
(void)argument; // we won't use the argument
|
||||||
float* voltages = measure_voltages(); // measure voltages
|
float* voltages;
|
||||||
puts("voltages:\n");
|
print_voltage_target(); // print target voltage (also sets measurement conditions)
|
||||||
puts("- target: ");
|
puts("signal voltages:\n");
|
||||||
print_voltage(voltages[1], 2);
|
for (uint8_t i = 0; i < SIGNAL_NUMBERS; i++) {
|
||||||
puts(" V\n");
|
puts("- ");
|
||||||
if (voltages[2] >= 3.25) {
|
puts(signal_names[i]);
|
||||||
puts("- signal: >= 3.30 V\n");
|
mux_select(i); // select the channel
|
||||||
} else {
|
voltages = measure_voltages(); // measure raw voltages
|
||||||
puts("- signal: ");
|
puts(" ");
|
||||||
print_voltage(voltages[2], 2);
|
print_voltage(voltages[2], 2);
|
||||||
puts(" V\n");
|
puts(" V\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue