EGD_ACQ_SETUP(3)

✨ EGD_ACQ_SETUP ✨ (that's a section 3 manual page from the EEGDEV library manual, bestie πŸ’–)

okay so real talk, this is egd_acq_setup from eegdev.h and it's genuinely one of the most important lil functions you'll ever meet 🫢


🌸 NAME 🌸

egd_acq_setup β€” tell the library which channel data you want and how you want it delivered πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <eegdev.h>

int egd_acq_setup(struct eegdev* dev,
                  unsigned int narr, const size_t *strides,
                  unsigned int ngrp, const struct grpconf *grp);

πŸŽ€ DESCRIPTION πŸŽ€

egd_acq_setup() sets up how data is gonna be handed to you by the device that dev points at, and this config is what the next calls to egd_get_data(3) will use. so like, this is you telling the device "hey bestie, THIS is how I want my data served" πŸ‘‘

The narr argument is the number of buffers you're gonna supply in the argument list of egd_get_data(3). and strides should point to an array of narr values, where each one is the stride for the corresponding buffer β€” meaning the size in bytes between the data of two successive samples in that buffer. it's giving "how far apart are my samples living" πŸ“

The channel data that must be returned in those buffers is defined by ngrp groups of consecutive channels. those group definitions get passed through grp, which points to an array of ngrp structures, defined like this:

struct grpconf {
    unsigned int sensortype;    /* type of channel */
    unsigned int index;         /* index of the first channel */
    unsigned int nch;           /* number of channels */
    unsigned int iarray;        /* index of the array */
    unsigned int arr_offset;    /* offset in the array */
    unsigned int datatype;      /* type in the array */
};

the different fields in that struct define the properties of the group, so let's go one by one, no skipping, periodt:

  • sensortype specifies the type of channel. it must be one of the following values returned by egd_sensor_type(3).
  • index is the index of the first channel in the group. heads up tho: channel index i refers to the i-th channel of the type specified previously, which means channel index i actually refers to two different channels if sensortype differs. iykyk, this one trips people up 😭
  • nch is the number of consecutive channels that should be in the group.
  • iarray tells you which buffer the data of the channel group must be written to.
  • arr_offset defines the offset of the memory location of the data in the buffers, relative to the beginning of each sample.
  • datatype specifies the type of data that must be written to the buffer. it must be one of these values: EGD_INT32, EGD_FLOAT or EGD_DOUBLE. pick one, bestie, those are the options πŸ’«

⭐ RETURN VALUE ⭐

the function returns 0 when it's a success. otherwise, -1 is returned and errno is set accordingly. so like, check your errno, it's literally telling you what went wrong πŸ™ˆ


πŸ’€ ERRORS πŸ’€

egd_acq_setup() will fail if:

  • EINVAL β€” dev is NULL.
  • EPERM β€” the acquisition is running. (yeah, you can't reconfigure mid-run, sorry babe βœ‹)

🧚 THREAD SAFETY 🧚

egd_acq_setup() is thread-safe. slay, go off, multiple threads can vibe with it 🌈


🌸 EXAMPLE 🌸

See egd_get_data(3) for a example πŸ‘€


πŸ‘‘ SEE ALSO πŸ‘‘

egd_get_data(3), egd_start(3), egd_sensor_type(3)


and that's the whole page fr fr πŸ’œ this one came from EPFL, dated 2010 β€” yes it's older than most of our fave fandoms but it still ate, and it's living in the EEGDEV library manual where egd_acq_setup belongs. mwah, go configure those buffers bestie πŸŽ€βœ¨