Library for LCD ACM1602NI connected using I2C on Nucleo F401 is not to be found. Using I2C class offered by mbed, I cannot program for this LCD on Nucleo F401. So I programmed for this LCD to control by direct accsessing registors for I2C in STM32F401RE. Nucleo F401 で使用できる,I2C 接続の LCD ACM1602NI 用のライブラリ.このライブラリでは,I2C クラスのコンストラクタとクロック周波数設定のメンバ関数は使っているが,その他のメンバ関数などは使っていない.その理由は,タイミングの関係だと思うが,I2C クラスのメンバ関数では正常に動くプログラムを,どうしても作れないことによる.しょうがないので,MCU の I2C 関係のレジスタに直接アクセスするようなプログラムを作ったたところ,動くようになった.Nucleo の F401RE 以外については確認していない.動かない場合は,I2C 用のレジスタのアドレスを,使っている MCU に応じて書きかえる必要がある.
Dependents: ACM1602NI_Nucleo_Demo
Diff: ACM1602NI.hpp
- Revision:
- 1:cace20837286
- Parent:
- 0:8167316a0a40
--- a/ACM1602NI.hpp Thu Aug 28 08:53:52 2014 +0000 +++ b/ACM1602NI.hpp Sat Sep 13 08:01:47 2014 +0000 @@ -55,19 +55,19 @@ bool LcdTx(uint8_t cmdData, uint8_t data); bool Start(); - // Forbit to use copy constructor + // Forbid to use copy constructor Acm1602Ni(const Acm1602Ni&); - // Forbit to use substitution operator + // Forbid to use substitution operator Acm1602Ni& operator=(const Acm1602Ni&); - uint16_t* i2c_cr1_; // pointer to I2C_CR1 (control register 1) - uint16_t* i2c_dr_; // pointer to I2C_DR (data register) - uint16_t* i2c_sr1_; // pointer to I2C_SR1 (status register 1) - uint16_t* i2c_sr2_; // pointer to I2C_SR2 (status register 2) + uint32_t* i2c_cr1_; // pointer to I2C_CR1 (control register 1) + uint32_t* i2c_dr_; // pointer to I2C_DR (data register) + uint32_t* i2c_sr1_; // pointer to I2C_SR1 (status register 1) + uint32_t* i2c_sr2_; // pointer to I2C_SR2 (status register 2) I2C i2c_; // Object of I2C // For check contents of register - bool Check(uint16_t* rg, uint16_t value) + bool Check(uint32_t* rg, uint16_t value) { return value == ((*rg) & value); } void TxDR(uint8_t data) { *i2c_dr_ = data; }