APM:Libraries
Macros | Variables
RCOutput_AeroIO.cpp File Reference
#include "RCOutput_AeroIO.h"
#include <utility>
#include <AP_HAL/AP_HAL.h>
#include <AP_HAL/utility/sparse-endian.h>
#include <AP_Math/AP_Math.h>
Include dependency graph for RCOutput_AeroIO.cpp:

Go to the source code of this file.

Macros

#define DEVICE_NAME   "aeroio"
 
#define PWM_CHAN_COUNT   16
 
#define ALL_CHAN_MASK   ((1 << PWM_CHAN_COUNT) - 1)
 
#define DEFAULT_FREQ   400
 
#define DEFAULT_DUTY   0
 
#define WADDRESS(x)   ((x) | 0x8000)
 
#define RADDRESS(x)   ((x) & 0x7FFF)
 
#define READ_PREFIX   0x80
 
#define WRITE_PREFIX   0x40
 

Variables

static const AP_HAL::HALhal = AP_HAL::get_HAL()
 

Macro Definition Documentation

◆ ALL_CHAN_MASK

#define ALL_CHAN_MASK   ((1 << PWM_CHAN_COUNT) - 1)

Definition at line 34 of file RCOutput_AeroIO.cpp.

Referenced by Linux::RCOutput_AeroIO::init().

◆ DEFAULT_DUTY

#define DEFAULT_DUTY   0

Definition at line 40 of file RCOutput_AeroIO.cpp.

Referenced by Linux::RCOutput_AeroIO::init().

◆ DEFAULT_FREQ

#define DEFAULT_FREQ   400

Definition at line 37 of file RCOutput_AeroIO.cpp.

Referenced by Linux::RCOutput_AeroIO::init().

◆ DEVICE_NAME

#define DEVICE_NAME   "aeroio"

Definition at line 28 of file RCOutput_AeroIO.cpp.

Referenced by Linux::RCOutput_AeroIO::init().

◆ PWM_CHAN_COUNT

#define PWM_CHAN_COUNT   16

◆ RADDRESS

#define RADDRESS (   x)    ((x) & 0x7FFF)

Definition at line 44 of file RCOutput_AeroIO.cpp.

Referenced by Linux::RCOutput_AeroIO::_hw_read().

◆ READ_PREFIX

#define READ_PREFIX   0x80

Definition at line 47 of file RCOutput_AeroIO.cpp.

Referenced by Linux::RCOutput_AeroIO::_hw_read().

◆ WADDRESS

#define WADDRESS (   x)    ((x) | 0x8000)

Definition at line 43 of file RCOutput_AeroIO.cpp.

Referenced by Linux::RCOutput_AeroIO::_hw_write().

◆ WRITE_PREFIX

#define WRITE_PREFIX   0x40

Variable Documentation

◆ hal

const AP_HAL::HAL& hal = AP_HAL::get_HAL()
static

The data_array uses 3 elements to perform the data transaction. The first element is a data byte that provides to FPGA's hardware the transaction type that will be realized inside the SPI module. Where:

╔═════════╦═════════╦══════════╦══════════╦══════════╦══════════╦══════════╦═══════════╗ ║ MSB ║ ║ ║ ║ ║ ║ ║ LSB ║ ╠═════════╬═════════╬══════════╬══════════╬══════════╬══════════╬══════════╬═══════════╣ ║ wr_addr ║ rd_addr ║ reserved ║ reserved ║ reserved ║ reserved ║ reserved ║ reserved ║ ╚═════════╩═════════╩══════════╩══════════╩══════════╩══════════╩══════════╩═══════════╝

╔═══════════╦═════════╦═════════╗ ║ Register ║ wr_addr ║ rd_addr ║ ╠═══════════╬═════════╬═════════╣ ║ write ║ 0 ║ X ║ ╠═══════════╬═════════╬═════════╣ ║ read ║ X ║ 0 ║ ╠═══════════╬═════════╬═════════╣ ║ status ║ 1 ║ 1 ║ ╚═══════════╩═════════╩═════════╝

So, to perform a write transaction in the SPI module it's necessary to send. E.g: 0b 01xx xxxx And to a read transaction.. 0b 10xx xxxx

The PWM frequency is always even and the duty cycle percentage odd. E.g: pwm_01: Address 0x0000 frequency : Address 0x0001 duty cycle pwm_02: Address 0x0002 frequency Eg of allowed values: // PWM channel in 100Hz uint16_t freq = 100;

// duty cycle in (1823/65535) that's 2.78% of 100Hz: // the signal will hold high until 278 usec uint16_t duty = 1823;

Definition at line 94 of file RCOutput_AeroIO.cpp.