xtos_ bci_ set_ sampling_ rate
Requests an integer sampling rate through ioctl and updates the session cache after success.
On this page
Declaration
#include <xtos/bci.h>
int xtos_bci_set_sampling_rate(xtos_bci_session_t *session, uint32_t rate);Parameters
| Parameter | Type | Description |
|---|---|---|
| session | xtos_bci_session_t * | Non-NULL session handle. |
| rate | uint32_t | Sampling rate in Hz; the library does not check the device support list. |
Return value
Returns 0 and updates info.sampling_rate after ioctl success; returns -1 without updating the cache on failure.
Errors
| errno | Condition |
|---|---|
| EINVAL | session is NULL or the driver considers rate invalid. |
| ENOTTY/EOPNOTSUPP | The device does not support setting the sampling rate. |
| system errno | Preserves driver or system errno from ioctl failure. |
Notes
- The pinned Cyton path supports only 250 Hz: when stopped it reads registers and validates/commits configuration, without sending ~6, which resets all ADS state. 500, 1000 and 2000 Hz return EOPNOTSUPP; other values return EINVAL; active receiving returns EBUSY.
- Externally serialize every API on one session; the SDK has no internal lock. Calls may block or allocate and establish no real-time deadline guarantee.
- The SDK updates info.sampling_rate only after ioctl success. Cyton driver success means verified readback and a configuration commit; failure may invalidate configuration. Use get_config for the verified generation. Source behavior is not a physical rate measurement.
Example
Source
This reference describes headers and implementation in OpenXTOS v1.0.2 (c24e923717670c4724cdaf24c7c105caee8dc2fb).