Bienvenue sur le site de la LibLapin.
Jetez un coup d'oeil en bas de la page pour choisir votre niveau de documentation en fonction de votre niveau avec la LibLapin.
Pour l'instant, c'est réglé sur 'Manuel complet'. Si c'est votre première fois avec la LibLapin, il vaudrait mieux choisir 'Débutant'.
De même, n'oubliez pas de préciser une version de la bibliothèque.

LibLapin's logo

LibLapin

Hardware





The hardware module is desined to establish a link between a Velleman VM110N and your program, to (later) use the board of an RPI or (later) exploit a connected arduino.

You may need to be super user.

The hardware module header is lapin/hardware.h.
typedef struct s_bunny_vm110n
{
     const void *const _private;
     const int id;
     const bool digital_inputs[5];
     const double analog_inputs[2];
     bool digital_outputs[8];
     double analog_outputs[2];

} t‌_‌b‌u‌n‌n‌y‌_‌v‌m‌1‌1‌0‌n;

Description

     This structure represents the VM110N board. It is partially abstract. Some fields are read only and are modified only by the bunny vm110n functions, some can be modified to change the board status.

Attributes

  • const void *const _private:
         Private field you should not modify or your program may crash.
  • const int id:
         The id of the board. Four boards can be supported.
  • const bool digital_inputs[5]:
         The status of digital inputs on the board.
  • const double analog_inputs[2]:
         The status of analog inputs on the board. Analog values varies between 0 and 1.
  • bool digital_outputs[8];
         Editable field that allow you to set a board status on some pins. After editing this field, calling b‌u‌n‌n‌y‌_‌v‌m‌1‌1‌0‌n‌_‌w‌r‌i‌t‌e will transform your values into reality.
  • double analog_outputs[2]:
         Editable field that allow you to set a board status on some pins. After editing this field, calling b‌u‌n‌n‌y‌_‌v‌m‌1‌1‌0‌n‌_‌w‌r‌i‌t‌e will transform your values into reality. Analog values can varies between 0 and 1.


INDEX


Description

     Open a link with a connected VM110N with the sent id. The returned data must be freed with b‌u‌n‌n‌y‌_‌d‌e‌l‌e‌t‌e‌_‌v‌m‌1‌1‌0‌n.

Parameters

  • size_t id:
         The id of the board, depending of jumpers on it.

Return value


Error values and logs

On error, $Vb‌u‌n‌n‌y‌_‌e‌r‌r‌n‌o is set to:


  • ENOMEM:

    Out of memory.

  • BE_CANT_GENERATE_RESSOURCE:

    Cannot connect to the board with the sent id. It may be because there is no board, because the id is bad or because you do not have the right to connect to a USB device (And then, running your process as root will make this call successful)


Logs written by this function are tagged with the "vm110n" label.




INDEX


Description

     Close the sent board.

Parameters




INDEX


Description

     Read the status on board and copy it to the sent vm110n structure. digital_inputs and analog_inputs will be overwritten.

Parameters


Return value

true if the reading was done, false on error.


Error values and logs

On error, $Vb‌u‌n‌n‌y‌_‌e‌r‌r‌n‌o is set to:


  • EAGAIN:

    Retry later. Maybe the board was not ready yet.


Logs written by this function are tagged with the "vm110n" label.




INDEX


Description

     Write the status on board. Fields digital_outsputs and analog_outputs are applied when this function is called.

Parameters


Return value

true if the reading was done, false on error.


Error values and logs

On error, $Vb‌u‌n‌n‌y‌_‌e‌r‌r‌n‌o is set to:


  • EINVAL:

    One of the analog output value was incorrect. They should be between 0 and 1.

  • EWOULDBLOCK:

    Retry later, maybe the board was not ready.


Logs written by this function are tagged with the "vm110n" label.




INDEX