API Documentation

API DOCUMENTATION

Documentation is updated from time to time. Be sure to clear your browser cache so that you get the latest version.

The latest API documentation can be found on line at:
https://docs.zymbit.com/

Legacy PDF documents

Python API
C++ API
C API

Hi, I finally received my zymkey 4i and it looks great!

I have a few question, I just tried to start to play to my zymkey:

  • I am using jessie
  • I installed all the packages thanks to your script
  • my zymkey looks to works ā€œgoodā€: blink and I also was able to run your two python examples scripts with success

I am interested to use C code. I look your API and tried to include ā€œ/home/zymbit/zk_app_utils/zk_app_utils.hā€ but I couldnā€™t find any zymkey user in /home !!

I finally was able to compile my C script with including <zymkey/zymkey.h> in my headers but got these error lines:

zymbit.c:(.text+0x18): undefined reference to ā€˜zkOpenā€™
zymbit.c:(.text+0x2c): undefined reference to ā€˜zkLEDFlashā€™
zymbit.c:(.text+0x34): undefined reference to ā€˜zkCloseā€™

Could you help me and tell me what I missed??

Thx by advance!

Hi

I can play fine the python module, but I still canā€™t use the C API.
Could you help me? Is there something I should link to my gcc line?

Thx by advance

@Tgratier sorry for the late response. The include files for C/C++ are located in /usr/include/zymkey. You can directly include this path in your C code #include "/usr/include/zymkey/zk_app_utils.h". Or, you could #include <zk_app_utils.h> and put the path on the gcc include line:
gcc -I /usr/include/zymkey my_zymkey_program.c -o my_zymkey_program

The reason that you donā€™t see a user directory for user zymbit in /home (/home/zymbit) is that the account is deliberately created in the systemd service with no /home directory for security.

Please let us know if you have further questions.

1 Like

Hi

Thx for your help.

I am sorry but it didnā€™t change anything, I have the same ā€œundefined reference toā€ errors than with
#include <zymkey/zk_app_utils.h>

You say the C/C++ files can be found in /usr/include/zymkey, but I only have these 3 files:

  • zkAppUtilsClass.h
  • zk_app_utils.h
  • zk_b64.h

I guess my code canā€™t find the code declaration of the functions I am calling. Where could I find the c code for these? donā€™t they should be in the same /usr/include/zymkey folder? If the answer is yes, could you help me to find what have I missed during my installation please?

Thx

@Tgratier
You will also need to reference the Zymkey App Utilities, located at /usr/lib/libzk_app_utils.so, with the -l directive. For example:
gcc -I /usr/include/zymkey -lzk_app_utils my_zymkey_program.c -o my_zymkey_program

Ok thx that was the thing I missed.

Hi (itā€™s me again ĀÆ_(惄)_/ĀÆ )

I just did a new clean install on a raspberry, but I suddenly have a segfault error just after these two lines:
zkCTX *ctx;
zkOpen(*ctx);

The compilation works fine with the previous help you told me above.
I am working on jessie distrib, and I enabled the I2C device, and the blue light of the zymbit is blinking every 3s.z

BTW The two python examples you gave are working fine.

Could you help me (again) to find what I forgot?

and I have the same results with two different zymkey 4i modules and different raspberry and SD cards :-/

You need to declare the Zymkey context plainly and then pass in the pointer to the context:

zkCTX ctx;
zkOpen(&ctx);
1 Like

Ok my badā€¦ thx again

No problem. Happy to help :slight_smile:

Hi, I have the same problem. I tried your solutions (path included in my C code or in the gcc command), but I cannot compile my code.
Please help me.