Class library for LCD character display ACM1602NI using I2C on Nucleo. Nucleo 用 I2C 接続の LCD キャラクタ・ディスプレー ACM1602Ni 用のクラス・ライブラリ.
Dependents: UIT2_VariableFIR_LPFHPF UIT2_VariableFIR_LPF UIT2_InputSW_LCD ADDA_Prototype_PollingSW ... more
Diff: ACM1602NI.hpp
- Revision:
- 13:68b93c16fd1d
- Parent:
- 12:b7c761c179c9
--- a/ACM1602NI.hpp Sat Jul 25 06:29:39 2015 +0000 +++ b/ACM1602NI.hpp Fri Apr 01 04:28:15 2016 +0000 @@ -11,7 +11,7 @@ // I2C2 PB_3(D3) PB_10(D6) // I2C3 PB_4(D5) or PC_9 PA_8(D7) // -// 2015/07/25, Copyright (c) 2015 MIKAMI, Naoki +// 2016/04/01, Copyright (c) 2016 MIKAMI, Naoki //------------------------------------------------------- // I2C_TypeDef: See stm32f401xe.h on following URL // http://mbed.org/users/mbed_official/code/mbed/file/ @@ -59,6 +59,22 @@ void ClearLine(uint8_t line) { WriteStringXY(" ", 0, line); } + // Write numerical value + template <typename T> void WriteValue(const char fmt[], T value) + { + char str[17]; + sprintf(str, fmt, value); + WriteString(str); + } + + // Write numerical value from specified position + template <typename T> + void WriteValueXY(const char fmt[], T value, uint8_t x, uint8_t y) + { + SetXY(x, y); + WriteValue(fmt, value); + } + private: // Slave address of ACM1602NI (0x50) // left-justified 7-bit address