ArduinoRCLib uses five centralized buffers to store input and output in.
Each of these buffers has get and set functions and a number of pre-defined indices to positions in the buffer.
The switch buffer has indices for switches A to H, the input buffer has indices for Aileron, Elevator, Rudder, Throttle etc. The output buffer has indices for pretty much any function you may want a channel to have, like Aileron, Elevator but also Camera, Retracts, Airbrakes. Both channel buffers have indices for up to 18 channels
For each type of buffer there are a few base classes available:
Most classes derive from at least one of these. Some act on one buffer, others on multiple buffers. Let's have a look at all the classes.
Is a: InputSource
Reads from: analog hardware pins
Writes to: Input buffer
Any processing: Translates hardware pin value [0 - 1023] to normalized value [-256 - 256], applies calibration and reversing.
Is a: SwitchProcessor and InputSource
Reads from: Switch buffer
Writes to: Input buffer
Any processing: Reads switch state and writes analog input value. May do this smoothly if a duration has been set.
Is a: SwitchSource
Reads from: digital hardware pin
Writes to: Switch buffer
Any processing: Writes Up or Down state, applies reversing.
Is a: OutputProcessor and OutputChannelSource
Reads from: Output buffer
Writes to: OutputChannel buffer
Any processing: Applies servo send points, servo speed, channel reverse
Is a: InputProcessor and InputSource
Reads from: Input buffer
Writes to: Input buffer (output index my be different than input index)
Any processing: Applies a curve to the input value
Is a: InputModifier
Reads from: Input buffer
Writes to: Input buffer (same index as input)
Any processing: Applies a mix
Is a: InputProcessor, OutputSource and SwitchProcessor
Reads from: Input buffer (THR and RUD) and Switch buffer (user defined)
Writes to: Output buffer (User defined, but usually THR1-4)
Any processing: Applies rudder mix and throttle cut/idle level
Is a: InputModifier
Reads from: Input buffer
Writes to: Input buffer (same index as input)
Any processing: Applies exponential, this can make gimbals more or less sensitive around the center or edges
Is a: SwitchProcessor
Reads from: Switch buffer
Writes to: nothing
Any processing: Is active on a switch state, counts down or up, activates buzzer or speaker
Is a: OutputSource
Reads from: user supplied commands (start/stop/takePhoto)
Writes to: Output buffer
Any processing: Controls a camera based on user supplied commands
Is a: Custom class, has 2 AIPins
Reads from: Analog input pin
Writes to: Output buffer (twice, AIL, ELE, THR or RUD)
Any processing: Same as AIPin
Is a: SwitchProcessor and OutputSource
Reads from: Switch buffer (and throttle hold switch)
Writes to: Output buffer (GOV)
Any processing: Configurable output based on switch position and throttle hold
Is a: OutputSource
Reads from: user supplied parameters
Writes to: Output buffer
Any processing: Outputs gain and gyro type (head hold/rate mode)
Is a: InputChannelProcessor and InputSource
Reads from: InputChannel buffer
Writes to: Input buffer
Any processing: Converts from microseconds to normalized, simply copies values from input channel buffer to input buffer
Is a: InputProcessor and SwitchSource
Reads from: Input buffer
Writes to: Switch buffer
Any processing: Reads input, compares it to user defined thresholds and sets switch state
Is a: InputProcessor and InputModifier
Reads from: Input buffer (twice, master and slave index)
Writes to: Input buffer (once, slave index)
Any processing: Mixes master input into slave input
Is a: InputProcessor and OutputSource
Reads from: Input buffer
Writes to: Output buffer
Any processing: none, simply copies values from input buffer to output buffer
Is a: SwitchProcessor and InputModifier
Reads from: Input buffer and Switch buffer
Writes to: Input buffer (same index)
Any processing: Applies an offset to input buffer based on switch position (conditional trim)
Is a: OutputProcessor and OutputChannelSource
Reads from: Output buffer
Writes to: OutputChannel buffer
Any processing: Translates normalized to microseconds, direct copy
Is a: OutputProcessor and OutputModifier
Reads from: Output buffer (twice, master and slave index)
Writes to: Output buffer (once, slave index)
Any processing: Mixes master input into slave input
Is a: custom class, multiple InputProcessor and multiple OutputSource
Reads from: Input buffer (AIL, ELE, RUD, FLP, BRK)
Writes to: Output buffer (AIL1-4, ELE1-2, RUD1-2, FLP1-4, BRK1-2)
Any processing: Loads, based on user set mixes and parameters
Is a: custom class, multiple InputChannelSource
Reads from: incoming digital pin
Writes to: InputChannel buffer
Any processing: Detects pin changes and writes channel values as microseconds to InputChannel buffer
Is a: custom class, multiple OutputChannelProcessor
Reads from: OutputChannel buffer
Writes to: digital output pin
Any processing: translates OutputChannel buffer values (in microseconds) to a PPM signal
Is a: SwitchProcessor and custom OutputSource (dual output)
Reads from: Switch buffer
Writes to: Output buffer (GEAR and DOOR)
Any processing: Applies user defined delay and speed
Is a: custom class, multiple InputChannelSource
Reads from: digital input pins
Writes to: InputChannel buffer
Any processing: Detects pin changes and writes channel values as microseconds to InputChannel buffer
Is a: custom class, multiple OutputChannelProcessor
Reads from: OutputChannel buffer
Writes to: digital output pins
Any processing: translates OutputChannel buffer values (in microseconds) to a servo signal
Is a: custom class, multiple InputProcessor and multiple OutputSource
Reads from: Input buffer (AIL, ELE, PIT)
Writes to: Output buffer (AIL1, ELE1, ELE2, PIT1)
Any processing: User set mixes, applies CCPM mixing
Is a: custom class, double InputProcessor and InputModifier
Reads from: Input buffer (thrice, master (AIL and ELE) and slave (THR) index)
Writes to: Output buffer (once, slave index (THR))
Any processing: Mixes master input into slave input but also takes slave input into account
Is a: SwitchModifier
Reads from: Switch buffer
Writes to: Switch buffer (same index)
Any processing: Toggles the output when the input reaches a user defined state
Is a: SwitchProcessor and InputModifier
Reads from: Switch buffer and Input buffer
Writes to: Input buffer (same index)
Any processing: Based on switch state will overwrite input buffer with user defined value.
Is a: SwitchProcessor, InputChannelProcessor and custom InputModifier or OutputModifier
Reads from: Switch buffer, InputChannelBuffer and Input or Output buffer
Writes to: Input or Output buffer
Any processing: When switch state equals user defined state, will overwrite input or output buffer with student value from InputChannelBuffer, may mix with original value.
Is a: SwitchSource
Reads from: two digital input pins
Writes to: Switch buffer
Any processing: Sets Up, Center or Down state based on pins, may apply reverse.