Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Analog axis API

Analog axis API . More...

Data Structures

struct  analog_axis_calibration
 Analog axis calibration data structure. More...
 

Typedefs

typedef void(* analog_axis_raw_data_t) (const struct device *dev, int channel, int16_t raw_val)
 Analog axis raw data callback.
 

Functions

void analog_axis_set_raw_data_cb (const struct device *dev, analog_axis_raw_data_t cb)
 Set a raw data callback.
 
int analog_axis_num_axes (const struct device *dev)
 Get the number of defined axes.
 
int analog_axis_calibration_get (const struct device *dev, int channel, struct analog_axis_calibration *cal)
 Get the axis calibration data.
 
int analog_axis_calibration_set (const struct device *dev, int channel, struct analog_axis_calibration *cal)
 Set the axis calibration data.
 
int analog_axis_calibration_save (const struct device *dev)
 Save the calibration data.
 

Detailed Description

Analog axis API .

Typedef Documentation

◆ analog_axis_raw_data_t

typedef void(* analog_axis_raw_data_t) (const struct device *dev, int channel, int16_t raw_val)

#include <zephyr/input/input_analog_axis.h>

Analog axis raw data callback.

Parameters
devAnalog axis device.
channelChannel number.
raw_valRaw value for the channel.

Function Documentation

◆ analog_axis_calibration_get()

int analog_axis_calibration_get ( const struct device * dev,
int channel,
struct analog_axis_calibration * cal )

#include <zephyr/input/input_analog_axis.h>

Get the axis calibration data.

Parameters
devAnalog axis device.
channelChannel number.
calPointer to an analog_axis_calibration structure that is going to get set with the current calibration data.
Return values
0If successful.
-EINVALIf the specified channel is not valid.

◆ analog_axis_calibration_save()

int analog_axis_calibration_save ( const struct device * dev)

#include <zephyr/input/input_analog_axis_settings.h>

Save the calibration data.

Save the calibration data permanently on the specifided device, requires the Settings subsystem to be configured and initialized.

Parameters
devAnalog axis device.
Return values
0If successful.
-errnoIn case of any other error.

◆ analog_axis_calibration_set()

int analog_axis_calibration_set ( const struct device * dev,
int channel,
struct analog_axis_calibration * cal )

#include <zephyr/input/input_analog_axis.h>

Set the axis calibration data.

Parameters
devAnalog axis device.
channelChannel number.
calPointer to an analog_axis_calibration structure with the new calibration data
Return values
0If successful.
-EINVALIf the specified channel is not valid.

◆ analog_axis_num_axes()

int analog_axis_num_axes ( const struct device * dev)

#include <zephyr/input/input_analog_axis.h>

Get the number of defined axes.

Return values
nThe number of defined axes for dev.

◆ analog_axis_set_raw_data_cb()

void analog_axis_set_raw_data_cb ( const struct device * dev,
analog_axis_raw_data_t cb )

#include <zephyr/input/input_analog_axis.h>

Set a raw data callback.

Set a callback to receive raw data for the specified analog axis device. This is meant to be use in the application to acquire the data to use for calibration. Set cb to NULL to disable the callback.

Parameters
devAnalog axis device.
cbAn analog_axis_raw_data_t callback to use, NULL disable.