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
Revision 13:68b93c16fd1d, committed 2016-04-01
- Comitter:
- MikamiUitOpen
- Date:
- Fri Apr 01 04:28:15 2016 +0000
- Parent:
- 12:b7c761c179c9
- Commit message:
- 14
Changed in this revision
ACM1602NI.cpp | Show annotated file Show diff for this revision Revisions of this file |
ACM1602NI.hpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b7c761c179c9 -r 68b93c16fd1d ACM1602NI.cpp --- a/ACM1602NI.cpp Sat Jul 25 06:29:39 2015 +0000 +++ b/ACM1602NI.cpp Fri Apr 01 04:28:15 2016 +0000 @@ -1,7 +1,7 @@ //------------------------------------------------------- // Class for LCD, ACM1602Ni // -// 2015/07/25, Copyright (c) 2015 MIKAMI, Naoki +// 2016/04/01, Copyright (c) 2016 MIKAMI, Naoki //------------------------------------------------------- #include "ACM1602NI.hpp" @@ -21,7 +21,7 @@ if ( ((sda == PC_9) || (sda == PB_4)) && (scl == PA_8) ) myI2c_ = (I2C_TypeDef*)I2C_3; // I2C3 will be used - + if (clock != 100000) i2c_.frequency(clock); wait_ms(40); @@ -101,5 +101,3 @@ return false; } } - -
diff -r b7c761c179c9 -r 68b93c16fd1d ACM1602NI.hpp --- 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