sys/arduino: use fmt_float to print float values
This commit is contained in:
parent
f46572a308
commit
1be6bd7567
@ -13,6 +13,7 @@ ifneq (,$(filter arduino,$(USEMODULE)))
|
|||||||
FEATURES_OPTIONAL += arduino_pwm
|
FEATURES_OPTIONAL += arduino_pwm
|
||||||
FEATURES_OPTIONAL += periph_adc
|
FEATURES_OPTIONAL += periph_adc
|
||||||
FEATURES_REQUIRED += periph_gpio
|
FEATURES_REQUIRED += periph_gpio
|
||||||
|
USEMODULE += fmt
|
||||||
USEMODULE += xtimer
|
USEMODULE += xtimer
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ extern "C" {
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "fmt.h"
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +149,7 @@ size_t SerialPort::print(float val)
|
|||||||
size_t SerialPort::print(float val, int format)
|
size_t SerialPort::print(float val, int format)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
size_t len = sprintf(buf, "%.*f", format, (double)val);
|
size_t len = fmt_float(buf, val, format);
|
||||||
write(buf, len);
|
write(buf, len);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user