2 * Copyright (C) 2012-2013 Czech Technical University in Prague
4 * Created on: 28.2.2013
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 * This file contains command for reading adc port.
38 * @brief Read ADC port
40 * Command syntax: readadc
42 * @param[in] cmd_io Pointer to IO stack
43 * @param[in] des Pointer to command descriptor
44 * @param[in] param Parameters of command
45 * @return 0 when OK or error code lower than 0
47 int cmd_do_read_adc1_values(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
49 uint32_t i; // Cycle control variable
52 rpp_sci_printf("ADC1: values: ");
53 /* conversion results : */
54 for (i = 0; i < PORT_ADC_CHANNEL_NUM; i++) {
55 rpp_sci_printf((uint8_t *)"\r\nChannel: %d\tvalue: %d\t%h", i+1, rpp_ain_get(i+1), rpp_ain_get(i+1));
62 /** Descriptor of command for adc port reading */
63 cmd_des_t const cmd_des_read_adc1={
65 "readadc","Reads values from ADC1",
66 "=== Description ===\n"
68 "This command reads values on all ADIN 1-12 channels and prints it as\n"
69 "channel-value (hexadecimal) table.\n"
71 "=== Command syntax ===\n"
74 CMD_HANDLER(cmd_do_read_adc1_values), (void *)&cmd_list_adc
77 /** List of commands for adc, defined as external */
78 cmd_des_t const *cmd_list_adc[]={