Description
I am new here. Not a professional developer (just hobby) and not very knowledgeable in C. I know a bad start!
I am trying to get some bindings working for the Nim programming language. I like this language a lot (it looks like python, performs like C, very good interoperability with C, C++, JS, … and many many more features). Nim can generate C code, which is what I am doing here.
I managed to implement in Nim the example showing a Hello World label under linux: examples/ex02_label.nim
. Now I am trying to do the same for the button example: examples/ex03_button.nim
.
What MCU/Processor/Board and compiler are you using?
Linux
Nim / gcc
What do you want to achieve?
I want to get working the callback function in the example of the button, which is not working in my example.
I understand you don’t know Nim, but maybe you can spot something obvious to you, or maybe you can get an idea about why I am having the following behaviour.
What have you tried so far?
My example compiles and shows the window with the button. I added in the callback a line to print pressed
when the callback is called. When I press the button it does notthing, but when the code starts it shows 17 times pressed
before I actually press the button.
Since I am starting, I don’t know yet if the issue is about what I did in Nim or if it is a lack of understanding of LVGL. For this reason, I also asked about Nim specific topics here.
Code to reproduce
In order to reproduce, it would be needed:
- to clone my repo: GitHub - mantielero/lvgl.nim: A wrapper for the Light Versatile Graphic Library (LVGL)
- having Nim installed
- compiling and running the example:
$ cd examples
$ nim c -r ex03_button
...
CC: ex03_button.nim
Hint: [Link]
Hint: gc: refc; opt: none (DEBUG BUILD, `-d:release` generates faster code)
76110 lines; 6.774s; 117.305MiB peakmem; proj: /home/jose/src/nimlang/lvgl.nim/examples/ex03_button.nim; out: /home/jose/src/nimlang/lvgl.nim/examples/ex03_button [SuccessX]
Hint: /home/jose/src/nimlang/lvgl.nim/examples/ex03_button [Exec]
pressed
pressed
pressed
pressed
pressed
pressed
pressed
pressed
pressed
pressed
pressed
pressed
pressed
pressed
pressed
pressed
pressed
Screenshot and/or video
I managed to get this in Linux: