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:
- 5:b4f73f5851fb
- Parent:
- 4:fac0c70570b6
- Child:
- 6:b911485a6f4d
--- a/ACM1602NI.hpp Thu Dec 04 04:17:11 2014 +0000 +++ b/ACM1602NI.hpp Tue Dec 09 04:27:10 2014 +0000 @@ -11,7 +11,7 @@ // I2C2 PB_3(D3) PB_10(D6) // I2C3 PB_4(D5) or PC_9 PA_8(D7) // -// 2014/12/04, Copyright (c) 2014 MIKAMI, Naoki +// 2014/12/09, Copyright (c) 2014 MIKAMI, Naoki //------------------------------------------------------- // I2C_TypeDef: See stm32f401xe.h on following URL // http://mbed.org/users/mbed_official/code/mbed/file/ @@ -22,6 +22,7 @@ #define ACM1602NI_HPP #include "mbed.h" +#include <string> namespace Mikami { @@ -38,17 +39,26 @@ bool GetOk() { return connected_; } // All clear bool Clear(); + // Send command bool WriteCmd(uint8_t cmd) { return LcdTx(0x00, cmd); } + // Write character void WriteChar(char data) { LcdTx(0x80, data); } // Specify display position, x: 0 - 15, y: 0, 1 + void SetXY(uint8_t x = 0, uint8_t y = 0) { WriteCmd(x + y*0x40 | 0x80);} + // Write string void WriteString(const char str[]); + void WriteString(const string str) { WriteString(str.c_str()); } + // Write string from specified position void WriteStringXY(const char str[], uint8_t x, uint8_t y); + void WriteStringXY(const string str, uint8_t x, uint8_t y) + { WriteStringXY(str.c_str(), x, y); } + // Clear of specified line void ClearLine(uint8_t line) { WriteStringXY(" ", 0, line); }