summaryrefslogtreecommitdiff
path: root/digital/avr/modules/motor/output/output.txt
blob: 7ab24aa5a9a6cba2a4dfe67d043928885d9aa139 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
=====================
 motor/output module
=====================
:Author: Nicolas Schodet

Introduction
============

The output module provides an interface with hardware outputs.  They are
usually PWM hardware connected to a H-bridge to power the motors.

Usage
=====

The `output_t` structure contains information about the current state and
configuration of the output.  The `max` and `min` fields must be initialised
by user code (you can use a data initializer) and left untouched afterward,
then `output_init` should be called to associate each output with hardware.

Each output hardware is associated with an index fixed in the compile time
configuration.

To change the current output value, use the `output_set` function.  It will
filter value (saturation with `max`, dead zone with `min`, optional negation
if `reverse` is set) and store it for next update.  Each output hardware will
reflect this value once `output_update` is called.

You can engage of disengage brake using `output_brake` if the output hardware
supports it.  Brake is always engaged once a non zero output value is
requested.  It will also be updated once `output_update` is called.

An output can be reversed by setting the `reverse` field before `output_init`
is called or using `output_set_reverse` function.

API
===

.. include:: output.exd