APM:Libraries
|
#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>
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::HAL & | hal = AP_HAL::get_HAL() |
#define ALL_CHAN_MASK ((1 << PWM_CHAN_COUNT) - 1) |
Definition at line 34 of file RCOutput_AeroIO.cpp.
Referenced by Linux::RCOutput_AeroIO::init().
#define DEFAULT_DUTY 0 |
Definition at line 40 of file RCOutput_AeroIO.cpp.
Referenced by Linux::RCOutput_AeroIO::init().
#define DEFAULT_FREQ 400 |
Definition at line 37 of file RCOutput_AeroIO.cpp.
Referenced by Linux::RCOutput_AeroIO::init().
#define DEVICE_NAME "aeroio" |
Definition at line 28 of file RCOutput_AeroIO.cpp.
Referenced by Linux::RCOutput_AeroIO::init().
#define PWM_CHAN_COUNT 16 |
Definition at line 31 of file RCOutput_AeroIO.cpp.
Referenced by Linux::RCOutput_AioPRU::disable_ch(), Linux::RCOutput_AeroIO::disable_ch(), Linux::RCOutput_AioPRU::enable_ch(), Linux::RCOutput_AeroIO::enable_ch(), Linux::RCOutput_AioPRU::get_freq(), Linux::RCOutput_AeroIO::get_freq(), Linux::RCOutput_AeroIO::init(), Linux::RCOutput_AioPRU::push(), Linux::RCOutput_AeroIO::push(), Linux::RCOutput_AioPRU::read(), Linux::RCOutput_AeroIO::read(), Linux::RCOutput_AioPRU::set_freq(), Linux::RCOutput_AeroIO::set_freq(), and Linux::RCOutput_AioPRU::write().
Definition at line 44 of file RCOutput_AeroIO.cpp.
Referenced by Linux::RCOutput_AeroIO::_hw_read().
#define READ_PREFIX 0x80 |
Definition at line 47 of file RCOutput_AeroIO.cpp.
Referenced by Linux::RCOutput_AeroIO::_hw_read().
Definition at line 43 of file RCOutput_AeroIO.cpp.
Referenced by Linux::RCOutput_AeroIO::_hw_write().
#define WRITE_PREFIX 0x40 |
Definition at line 48 of file RCOutput_AeroIO.cpp.
Referenced by Linux::RCOutput_AeroIO::_hw_read(), and Linux::RCOutput_AeroIO::_hw_write().
|
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.