Koduino
Public Member Functions | List of all members
VN100 Class Reference

VN100 hardware interface library. More...

#include <VN100.h>

Detailed Description

VN100 hardware interface library.

Usage

  1. Declare an instance of VN100 with constructor VN100() taking SPIClass as argument. E.g. use VN100 vn100(SPI_2); for MBLC
  2. Call VN100::init() with the chip select pin (PB12 on MBLC)
  3. Call VN100::get() with output arguments to get the filtered angles and angular rates.

Example (on MBLC 0.5)

#include <SPI.h>
#include <VN100.h>
VN100 vn100(SPI_2);
void setup() {
Serial1.begin(115200);
vn100.init(PB12);
delay(1000);
}
void loop() {
uint32_t tic = micros();
tic = micros();
float ypr[3], rates[3]];
vn100.get(ypr[0], ypr[1], ypr[2], rates[0], rates[1], rates[2]);
tic = micros() - tic;
Serial1 << tic << "\t" << ypr[0] << "\t" << ypr[1] << "\t" << ypr[2] << "\t";
Serial1 << rates[0] << "\t" << rates[1] << "\t" << rates[2] << "\n";
delay(10);
}

Public Member Functions

 VN100 (SPIClass &theSPI)
 Construct with reference to which SPI. More...
 
void init (uint8_t csPin)
 Send initialization commands to the VN100. More...
 
void get (float &yaw, float &pitch, float &roll, float &yawd, float &pitchd, float &rolld)
 Retrieves angles and angular rates. More...
 

Constructor & Destructor Documentation

VN100::VN100 ( SPIClass theSPI)
inline

Construct with reference to which SPI.

Parameters
theSPISPI, SPI_2, etc.

Member Function Documentation

void VN100::get ( float &  yaw,
float &  pitch,
float &  roll,
float &  yawd,
float &  pitchd,
float &  rolld 
)
inline

Retrieves angles and angular rates.

This function blocks for a few hundred microseconds.

Parameters
yawin radians
pitchin radians
rollin radians
yawdin rad/s
pitchdin rad/s
rolldin rad/s
void VN100::init ( uint8_t  csPin)
inline

Send initialization commands to the VN100.

Parameters
csPinchip select pin

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