aboutsummaryrefslogtreecommitdiffstats
path: root/src/lm75.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lm75.c')
-rw-r--r--src/lm75.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/lm75.c b/src/lm75.c
index 2e14738..3754a56 100644
--- a/src/lm75.c
+++ b/src/lm75.c
@@ -12,7 +12,7 @@
-extern uint16 devicef;
+//extern uint16 devicef;
extern void bus_err(int ern);
extern void print_help(void);
extern uchar *xchg_data (uchar *buf, uint8 wrlen, uint8 waitlen, uint8 rdlen);
@@ -20,7 +20,7 @@ uchar buf[32];
-void lm75_print_all(void)
+void lm75_print_all(const uchar *opts)
{
printf(
"============ LM75xx interface ===========\n"
@@ -121,11 +121,11 @@ void lm75_read_all(const uchar *opts){ // Print out whole device's data
// {
// printf("00:%f\n", calc_temp(strtof(opts, NULL)));
// } else {
- printf("00:%f\n", calc_temp(0.0));
+ fprintf(stdout, "00:%f\n", calc_temp(0.0));
// }
- printf("01:0x%x\n", read_conf());
- printf("02:%f\n", read_thys());
- printf("03:%f\n", read_tos());
+ fprintf(stdout, "01:0x%x\n", read_conf());
+ fprintf(stdout, "02:%f\n", read_thys());
+ fprintf(stdout, "03:%f\n", read_tos());
}
@@ -142,9 +142,9 @@ void lm75_read_one(const uchar *opts){ // Prints the selected r
} else {
if( !isdigit(*(opts+i)) ){ //# Check the register string
- printf("The Register address must be an integer!\n");
+ fprintf(stderr, "The Register address must be an integer!\n");
print_help();
- lm75_print_all();
+ lm75_print_all(NULL);
exit (EXIT_FAILURE);
}
temp[i] = *(opts+i); //# copy register string
@@ -158,16 +158,16 @@ void lm75_read_one(const uchar *opts){ // Prints the selected r
switch (id) //# Which register is selected?
{
case 0x00:
- printf("%f\n", calc_temp(atof((char*)temp))); //# with the offset
+ fprintf(stdout, "%f\n", calc_temp(atof((char*)temp))); //# with the offset
break;
case 0x01:
- printf("0x%x\n", read_conf());
+ fprintf(stdout, "0x%x\n", read_conf());
break;
case 0x02:
- printf("%f\n", read_thys());
+ fprintf(stdout, "%f\n", read_thys());
break;
case 0x03:
- printf("%f\n", read_tos());
+ fprintf(stdout, "%f\n", read_tos());
break;
default:
print_help();
@@ -253,7 +253,7 @@ void lm75_conf_set(const uchar *opts){ // Prints the selected r
}
else
{
- lm75_print_all();
+ lm75_print_all(NULL);
exit(EXIT_FAILURE);
}
buf[0] = 0x01;
@@ -274,7 +274,7 @@ void lm75_conf_set(const uchar *opts){ // Prints the selected r
}
else
{
- lm75_print_all();
+ lm75_print_all(NULL);
exit(EXIT_FAILURE);
}
buf[0] = 0x01;
@@ -295,7 +295,7 @@ void lm75_conf_set(const uchar *opts){ // Prints the selected r
}
else
{
- lm75_print_all();
+ lm75_print_all(NULL);
exit(EXIT_FAILURE);
}
buf[0] = 0x01;
@@ -325,7 +325,7 @@ void lm75_conf_set(const uchar *opts){ // Prints the selected r
}
else
{
- lm75_print_all();
+ lm75_print_all(NULL);
exit(EXIT_FAILURE);
}
buf[0] = 0x01;
@@ -337,7 +337,7 @@ void lm75_conf_set(const uchar *opts){ // Prints the selected r
// if( !isxdigit(*(opts+i)) || *(opts+i) !='x' || opts[i] != ','){ //# Check the register string
// printf("The Register address, and value must be a hex, or an integer!\n");
print_help();
- lm75_print_all();
+ lm75_print_all(NULL);
exit (EXIT_FAILURE);
// }
// }