DJI::OSDK::MFIO Class Reference

APIs for Multi-Function Input-Output functionality. More...

#include <dji_mfio.hpp>

Public Types

enum  MODE {
  MODE_PWM_OUT = 0,
  MODE_PWM_IN = 1,
  MODE_GPIO_OUT = 2,
  MODE_GPIO_IN = 3,
  MODE_ADC = 4
}
 
enum  CHANNEL {
  CHANNEL_0 = 0,
  CHANNEL_1 = 1,
  CHANNEL_2 = 2,
  CHANNEL_3 = 3,
  CHANNEL_4 = 4,
  CHANNEL_5 = 5,
  CHANNEL_6 = 6,
  CHANNEL_7 = 7
}
 
typedef enum DJI::OSDK::MFIO::MODE MODE
 
typedef enum DJI::OSDK::MFIO::CHANNEL CHANNEL
 

Public Member Functions

 MFIO (Vehicle *vehicle)
 
void config (MODE mode, CHANNEL channel, uint32_t defaultValue, uint16_t freq, VehicleCallBack fn=0, UserData userData=0)
 Non-blocking call for initializing an MFIO channel. More...
 
void setValue (CHANNEL channel, uint32_t value, VehicleCallBack fn=0, UserData data=0)
 Non-blocking call for setting an MFIO value to a channel. More...
 
void getValue (CHANNEL channel, VehicleCallBack fn=0, UserData data=0)
 Non-blocking call for getting data from an MFIO channel. More...
 
ACK::ErrorCode config (MODE mode, CHANNEL channel, uint32_t defaultValue, uint16_t freq, int wait_timeout)
 Blocking call for initializing an MFIO channel. More...
 
ACK::ErrorCode setValue (CHANNEL channel, uint32_t value, int wait_timeout)
 
ACK::MFIOGet getValue (CHANNEL channel, int wait_timeout)
 

Detailed Description

APIs for Multi-Function Input-Output functionality.

This class offers control over the F-channel pins on DJI products. Five modes are available through the F-channels:

  1. PWM Input (not supported yet)
  2. PWM Output
  3. Digital Input (GPI)
  4. Digital Output (GPO)
  5. Analog-Digital Conversion (ADC) Input
Note
You must map F-channels to SDK channels through DJI Assistant 2 to use MFIO functionality.

Member Function Documentation

◆ config() [1/2]

void MFIO::config ( MFIO::MODE  mode,
CHANNEL  channel,
uint32_t  defaultValue,
uint16_t  freq,
VehicleCallBack  fn = 0,
UserData  userData = 0 
)

Non-blocking call for initializing an MFIO channel.

Supported Platforms : A3, N3
Parameters
modeThe mode (PWM, GPIO, ADC) to initialize to
channelThe channel (0-7) to initialize
defaultValueThe starting value [for output]
freqThe frequency
fnCallback function you want called upon ACK
userDataAdditional data you want the callback function to have access to

◆ config() [2/2]

ACK::ErrorCode MFIO::config ( MFIO::MODE  mode,
CHANNEL  channel,
uint32_t  defaultValue,
uint16_t  freq,
int  wait_timeout 
)

Blocking call for initializing an MFIO channel.

Supported Platforms : A3, N3
Parameters
modeThe mode (PWM, GPIO, ADC) to initialize to
channelThe channel (0-7) to initialize
defaultValueThe starting value [for output]
freqThe frequency
wait_timeoutTime(in s) you want the function to wait for an ACK
Returns
ACK::ErrorCode struct containing the ACK and metadata

◆ getValue() [1/2]

void MFIO::getValue ( MFIO::CHANNEL  channel,
VehicleCallBack  fn = 0,
UserData  data = 0 
)

Non-blocking call for getting data from an MFIO channel.

Supported Platforms : A3, N3
Parameters
channelThe channel (0-7) to get the value from
fnCallback function you want called upon ACK
dataAdditional data you want the callback function to have access to

◆ getValue() [2/2]

ACK::MFIOGet MFIO::getValue ( CHANNEL  channel,
int  wait_timeout 
)

Blocking call for getting data from an MFIO channel

Supported Platforms : A3, N3
Parameters
channelThe channel (0-7) to get the value from
wait_timeoutTime(in s) you want the function to wait for an ACK
Returns
ACK::ErrorCode struct containing the ACK and metadata

◆ setValue() [1/2]

void MFIO::setValue ( MFIO::CHANNEL  channel,
uint32_t  value,
VehicleCallBack  fn = 0,
UserData  data = 0 
)

Non-blocking call for setting an MFIO value to a channel.

Supported Platforms : A3, N3
Parameters
channelThe channel (0-7) to set the value to
valueThe value you want to set
fnCallback function you want called upon ACK
dataAdditional data you want the callback function to have access to

◆ setValue() [2/2]

ACK::ErrorCode MFIO::setValue ( CHANNEL  channel,
uint32_t  value,
int  wait_timeout 
)

Blocking call for setting an MFIO value to a channel

Supported Platforms : A3, N3
Parameters
channelThe channel (0-7) to set the value to
valueThe value you want to set
wait_timeoutTime(in s) you want the function to wait for an ACK
Returns
ACK::ErrorCode struct containing the ACK and metadata

The documentation for this class was generated from the following files: