30 static const CnvParams _hex = CNV_DEFAULT_HEX;
33 const char cmd_xadc_help[] =
"XADC - Read Temp and Voltages";
36 static int _tconv(
int x)
38 return (x*503975/4096-273150)/10;
41 static int _vmv(
int x)
59 bool cmd_xadc_exec(
int argc,
const char *args[])
67 if (argc < 1 || ((argc == 1) && (strcmp(args[0],
"help") == 0))) {
69 puts(
" xadc read <what> ;");
70 puts(
" <what> = temp, vccint, vccaux, vccbram, all");
73 puts(
" xadc power <what> ;");
74 puts(
" <what> = up, down, onlya");
75 puts(
" xadc alarm <type> <action>;");
76 puts(
" <type> = temp, vccint, vccaux, vccbram, ot ");
77 puts(
" <action> = read, flag, enable, disable, set ");
78 puts(
" if set -> <min,max> <val> (val in hexadecimal) ");
79 puts(
" xadc mode <how> ;");
80 puts(
" <how> = def,cont");
84 else if(argc == 2 && strcmp(args[0],
"read") == 0){
85 if( strcmp(args[1],
"temp")== 0 || strcmp(args[1],
"all")== 0 ){
87 printf(
"temp = %d (/100 C)(curr) -- %d (/100 C)(max) -- %d (/100 C)(min)\n",
88 TCONV(xadcGetMeas(xadcChanTemp, xadcTypeCur)),
89 TCONV(xadcGetMeas(xadcChanTemp, xadcTypeMax)),
90 TCONV(xadcGetMeas(xadcChanTemp, xadcTypeMin)));
92 if( strcmp(args[1],
"vccint")== 0|| strcmp(args[1],
"all")== 0){
94 printf(
"VccInt = %d mV(curr) -- %d mV(max) -- %d mV(min)\n",
95 VMV(xadcGetMeas(xadcChanVccInt, xadcTypeCur)),
96 VMV(xadcGetMeas(xadcChanVccInt, xadcTypeMax)),
97 VMV(xadcGetMeas(xadcChanVccInt, xadcTypeMin)) );
106 if( strcmp(args[1],
"vccbram")== 0|| strcmp(args[1],
"all")== 0){
108 printf(
"VccBram = %d mV(curr) -- %d mV(max) -- %d mV(min)\n",
109 VMV(xadcGetMeas(xadcChanVccBRAM,xadcTypeCur)),
110 VMV(xadcGetMeas(xadcChanVccBRAM,xadcTypeMax)),
111 VMV(xadcGetMeas(xadcChanVccBRAM,xadcTypeMin)));
Simple task scheduler for tasks.
#define CNV_DEFAULT
Default conversion/formatting parameters (base 10).
Manages the global system error.
This structure provides information about formatting and parsing.
This module is responsible for distributing error codes.
This module implements parsing and formating of strings and integers.