TCB Libraries

Here are some notes on the various libraries used by the TCB firmware. This may help you know where to start looking if you want to make a modification/addition.

EEPROMEx

“Extended” version of the Arduino EEPROM library, offers some very useful functions for reading and writing to EEPROM. Here is the GitHub page for the project, and this page shows some useful examples. This is not the only EEPROM library used by the TCB, see also OP_EEPROM below.

OP_BNO055

This library is included but not presently implemented. The library is for interfacing with the Adafruit BNO055 9-DOF IMU. The idea is to use this IMU for barrel stabilization features. Adafruit provides their own library but it relies on the standard Arduino Wire library, which is a “blocking” I2C library that causes serious code interruptions. We have attempted to create our own “non-blocking” I2C library (OP_I2C) but there are still unresolved issues with it. For now this library is not crucial.

OP_Button

An unmodified copy of Jack Christensen's Button library, renamed with an OP_ prefix to avoid conflicts. This library provides some useful functions for reading a button, such as the INPUT button on the TCB.

OP_Driver

Controls all acceleration/deceleration (inertia/momentum) constraints and their presets; calculates drive mode and the brake flag; mixes throttle and steering commands to produce individual track speeds; and provides functions for starting/stopping the engine and engaging/disengaging the “transmission.”

OP_EEPROM

TCB specific EEPROM functions (for generic EEPROM reading/writing functions see EEPROMx above). The TCB stores approximately 300 variables in EEPROM, these are defined in OP_EEPROM_Struct.h. Information about each variable (unique variable ID, its offset in the struct, and its data type) are stored in an array in OP_EEPROM_VarInfo.h. This array (and a similar one used by OP_Config) are auto-generated using an Excel workbook called OP_EEPROM_Vars.xls. The cpp file includes functions for reading/writing EEPROM variables, not generically, but as members of the struct in which they reside. These functions are primarily implemented when the TCB is sending data to or having its data updated by the OP Config program running on a PC. There is also a function to initialize all EEPROM variables to default values, for example the first time the board is booted after creation, or when doing a system reset.

OP_FT

FT stands for “Functions and Triggers.” A single h file defines all the available special functions and their names, whether they are “digital” (discrete) or “analog” (variable); it also defines the turret stick as a 9-position function trigger.

OP_I2C

The only library presently not complete, this is our attempt at a non-blocking I2C library, which however is not yet working correctly. If it were, barrel stabilization implementation would be complete when used with the OP_BNO055 library. It would also pave the way for integration of future I2C peripherals.

OP_IBusDecode

Decodes FlySky iBus radio data on Serial port 3.

OP_IO

A single h file defines some structs that represent the general purpose input/outputs called A & B on the TCB board. See the IO tab in the Arduino sketch for the implementation. Because there are only two ports we haven't bothered creating a whole C++ class to deal with them.

OP_IRLib

All functions related to decoding and sending IR signals.

OP_Motors

Motor control class - provides standard functions for interfacing with multiple different “motor” types, such as serial controllers, onboard motor drivers, servos, etc… Specific motor objects (such as “left tread” or “smoker”) are instantiations of these objects made in the sketch (primarily in the ObjectSetup tab).

OP_PCComm

PCCommm stands for “PC communication.” All functions for communicating with the OP_Config program.

OP_PololuQik

A class for interfacing with Pololu Qik serial motor controllers.

OP_PPMDecode

Decodes PPM radio data.

OP_Radio

All functions for detecting and reading the RC radio signal, managing failsafe, etc… Relies on OP_IBusDecode, OP_SBusDecode or OP_PPMDecode to do the decoding, depending on which type of signal it detects.

OP_Sabertooth

A class for interfacing with Dimension Engineering Sabertooth serial motor controllers.

OP_SBusDecode

Decodes FrSky SBus radio data on Serial port 3.

OP_Scout

A class for interfacing with the Open Panzer Scout serial motor controller. For more information about the Scout project see the Scout ESC GitHub page or other pages here in the Wiki.

OP_Servo

Low-level handling of the 8 servo outputs and the generation of their signals.

OP_Settings

A single h file with various important low level definitions such as those for pin mapping and timers. Also in this folder resides a “Version_History.txt” file with notes about each release.

OP_SimpleTimer

A modified and corrected version of the SimpleTimer library originally written by Marcello Romani. Provides invaluable timing functions which are used extensively throughout the project and by many of the other libraries.

OP_Sound

Wrapper class for interfacing with external sound cards. This is where you will also find the experimental OP_SoundCard class to be used with a future Open Panzer sound card that is still under development. For specific functions related to the Benedini sound card see OP_TBS below.

OP_Tank

Here are many functions specific to the operation of a tank, mostly related to battling. Weight class, firing the cannon including control of the airsoft or mechanical recoil unit, sending IR, handling incoming hits, blinking the IR indicator lights in the apple, applying battle “damage” (speed reductions), the machine gun, repairs and more are all handled in the Tank class.

OP_TBS

Class for interfacing with the Benedini TBS Mini sound card using three servo signals.

wiki/devl/libref.txt · Last modified: 2017/01/10 02:27 by opadmin