2023-09-13 08:50 PM
Hello everyone, I need help. I would like an example or library that supports the MPR121 capacitive keypad. I know it is out of date. But I want to use it. Please disturb everyone. i use with stm32f103c8t6 and use interrupt pin
best regards
thank you
2023-09-13 11:07 PM
Well, with your favourite search engine you should find some tips and libraries with terms like "+stm32 + mpr121". Otherwise, the forum of the manufacturer of this obsolete device might be a possible source.
Does it answer your question?
Regards
/Peter
2023-09-13 11:26 PM
https://github.com/search?q=stm32+mpr121&type=repositories
i searched in github and i try edit but keypad not respond (my keypad is work i check with arduino)
2023-09-14 12:36 AM
I'm afraid I don't really understand what your problem is. A quick search immediately gave me two libraries in Github, but you still need to check if it can be used with Arduino and perhaps adapt it (I work with STM32CubeIDE, IAR or Keil compiler):
Good luck!
/Peter
2023-09-14 01:05 AM
2023-09-14 01:09 AM
../Core/Src/mpr121.c:157:17: warning: implicit declaration of function 'I2C_SR2' [-Wimplicit-function-declaration]
157 | while ((I2C_SR2(I2C1) & I2C_SR2_BUSY) != 0);
| ^~~~~~~
../Core/Src/mpr121.c:157:25: error: 'I2C1' undeclared (first use in this function)
157 | while ((I2C_SR2(I2C1) & I2C_SR2_BUSY) != 0);
| ^~~~
../Core/Src/mpr121.c:157:25: note: each undeclared identifier is reported only once for each function it appears in
../Core/Src/mpr121.c:157:33: error: 'I2C_SR2_BUSY' undeclared (first use in this function)
157 | while ((I2C_SR2(I2C1) & I2C_SR2_BUSY) != 0);
| ^~~~~~~~~~~~
../Core/Src/mpr121.c:160:9: warning: implicit declaration of function 'i2c_send_start' [-Wimplicit-function-declaration]
160 | i2c_send_start(I2C1);
| ^~~~~~~~~~~~~~
../Core/Src/mpr121.c:161:17: warning: implicit declaration of function 'I2C_SR1' [-Wimplicit-function-declaration]
161 | while ((I2C_SR1(I2C1) & I2C_SR1_SB) == 0);
| ^~~~~~~
../Core/Src/mpr121.c:161:33: error: 'I2C_SR1_SB' undeclared (first use in this function)
161 | while ((I2C_SR1(I2C1) & I2C_SR1_SB) == 0);
| ^~~~~~~~~~
../Core/Src/mpr121.c:164:9: warning: implicit declaration of function 'i2c_send_7bit_address' [-Wimplicit-function-declaration]
164 | i2c_send_7bit_address(I2C1, MPR121_ADDRESS_BYTE, I2C_WRITE);
| ^~~~~~~~~~~~~~~~~~~~~
../Core/Src/mpr121.c:164:58: error: 'I2C_WRITE' undeclared (first use in this function)
164 | i2c_send_7bit_address(I2C1, MPR121_ADDRESS_BYTE, I2C_WRITE);
| ^~~~~~~~~
../Core/Src/mpr121.c:165:33: error: 'I2C_SR1_ADDR' undeclared (first use in this function)
165 | while ((I2C_SR1(I2C1) & I2C_SR1_ADDR) == 0);
| ^~~~~~~~~~~~
../Core/Src/mpr121.c:168:30: error: 'I2C_SR2_MSL' undeclared (first use in this function)
168 | if ((I2C_SR2(I2C1) & I2C_SR2_MSL) /* master mode */
| ^~~~~~~~~~~
../Core/Src/mpr121.c:172:17: warning: implicit declaration of function 'i2c_send_data' [-Wimplicit-function-declaration]
172 | i2c_send_data(I2C1, reg_addr);
| ^~~~~~~~~~~~~
../Core/Src/mpr121.c:173:41: error: 'I2C_SR1_TxE' undeclared (first use in this function)
173 | while ((I2C_SR1(I2C1) & I2C_SR1_TxE) == 0);
| ^~~~~~~~~~~
../Core/Src/mpr121.c:180:17: warning: implicit declaration of function 'i2c_send_stop' [-Wimplicit-function-declaration]
180 | i2c_send_stop(I2C1);
| ^~~~~~~~~~~~~
../Core/Src/mpr121.c: In function 'read_register':
../Core/Src/mpr121.c:197:25: error: 'I2C1' undeclared (first use in this function)
197 | while ((I2C_SR2(I2C1) & I2C_SR2_BUSY) != 0);
| ^~~~
../Core/Src/mpr121.c:197:33: error: 'I2C_SR2_BUSY' undeclared (first use in this function)
197 | while ((I2C_SR2(I2C1) & I2C_SR2_BUSY) != 0);
| ^~~~~~~~~~~~
../Core/Src/mpr121.c:201:33: error: 'I2C_SR1_SB' undeclared (first use in this function)
201 | while ((I2C_SR1(I2C1) & I2C_SR1_SB) == 0);
| ^~~~~~~~~~
../Core/Src/mpr121.c:204:58: error: 'I2C_WRITE' undeclared (first use in this function)
204 | i2c_send_7bit_address(I2C1, MPR121_ADDRESS_BYTE, I2C_WRITE);
| ^~~~~~~~~
../Core/Src/mpr121.c:205:33: error: 'I2C_SR1_ADDR' undeclared (first use in this function)
205 | while ((I2C_SR1(I2C1) & I2C_SR1_ADDR) == 0);
| ^~~~~~~~~~~~
../Core/Src/mpr121.c:208:30: error: 'I2C_SR2_MSL' undeclared (first use in this function)
208 | if ((I2C_SR2(I2C1) & I2C_SR2_MSL) /* master mode */
| ^~~~~~~~~~~
../Core/Src/mpr121.c:213:41: error: 'I2C_SR1_TxE' undeclared (first use in this function)
213 | while ((I2C_SR1(I2C1) & I2C_SR1_TxE) == 0);
| ^~~~~~~~~~~
../Core/Src/mpr121.c:220:66: error: 'I2C_READ' undeclared (first use in this function)
220 | i2c_send_7bit_address(I2C1, MPR121_ADDRESS_BYTE, I2C_READ);
| ^~~~~~~~
../Core/Src/mpr121.c:226:49: error: 'I2C_SR1_RxNE' undeclared (first use in this function)
226 | while ((I2C_SR1(I2C1) & I2C_SR1_RxNE) == 0);
| ^~~~~~~~~~~~
../Core/Src/mpr121.c:227:38: warning: implicit declaration of function 'i2c_get_data' [-Wimplicit-function-declaration]
227 | *value_ptr = i2c_get_data(I2C1);
| ^~~~~~~~~~~~
2023-09-14 01:15 AM
Well, no one said that the libraries would fit in your application without modification. If you cannot make these changes yourself, perhaps the author of these libraries can help you.