-
Notifications
You must be signed in to change notification settings - Fork 112
Installation
The source code can be downloaded from the GitHub repository: https://github.com/jedisct1/libhydrogen .
Review the Makefile file and use the make command to create a static libhydrogen.a library.
Alternatively, just add hydrogen.c to your project, and use hydrogen.h for prototypes definitions.
Use MingW with the standard Makefile.
Review the Makefile.arduino file and use the make -f Makefile.arduino command to create a zip file (requires the p7zip tool to be installed) that can be directly imported as a library in the Arduino IDE.
The header file to include in your projects is <hydrogen.h>.
Call hydro_init() as soon as possible in the setup() function of your sketch.
The hydrogen.h file contains the prototypes of all the public functions from the API, as well as the related macro definitions.
The hydro_init() function must be called before any other function of the library. This ensures optimal performance and correct initialization of the random numbers generator.
The function returns 0 on success, and -1 if the initialization procedure failed, but might complete if tried again at a later time.
#include <hydrogen.h>
void setup(void)
{
if (hydro_init() != 0) {
abort();
}
}The HYDRO_VERSION_MAJOR and HYDRO_VERSION_MINOR macros can be used for conditional compilation according to the library version. API and ABI changes will never occur without a change of the major version.