#include <oencodedmotor.h>
Public Member Functions | |
| MILLIMETER | speed (void) const |
| return current speed of motor in current SPEED units (see oenum.h) | |
| void | WSwrite (void) |
| Write object to simulator. | |
| void | operate (bool b) |
| Be sure to turn on :). | |
| void | added_power (POWER p) |
| Additional power beyond set/calculated power to add (for PID etc.). | |
| bool | stable (void) const |
| Until scheduler starts, all speed is nonsense. | |
| void | mode (ENCODER_MODE_TYPE) |
| Switches to FAST_MODE which eliminates direction or NORMAL_MODE which will decrement the encoder count in reverse. Does nothing for single channel encoders--only valid for quadrature encoder! | |
| ENCODER_MODE_TYPE | mode (void) const |
| void | forward (void) |
| start motor in forward | |
| void | forward (POWER) |
| start motor forward at specified POWER. | |
| void | reverse (POWER) |
| starts motor in reverse at specified POWER. | |
| void | reverse (void) |
| starts motor in reverse. | |
| void | brake (void) |
| applies brake to motor (both high). | |
| void | power (POWER) |
| 0-100 (percantage of maximum) | |
| void | frequency (FREQUENCY f) |
| Sets PWM signal frequency. (cycles per second). | |
| void | power_resolution (POWER p) |
| Sets the number of increments for power from 0...user set maximum. | |
| void | priority (PRIORITY p) |
| Sets the TPU channel execution priority (Ref. TPU Channel Utilization) for the speed control line. Default MIDDLE_PRIORITY. Priority should be set before you begin operation. | |
| bool | stop (void) |
| true if motor stoppped. Needed for EncodedMotor to know whether to apply "cruise_control". | |
| MICROSECOND | get_hightime (void) |
| return current high time [DOS only] | |
| MICROSECOND | get_lowtime (void) |
| return current low time [DOS only] | |
| void | hightime (MICROSECOND high) |
| Hightime set the on time for the pulse measured in micro-seconds. | |
| void | nexthigh (MICROSECOND high) |
| Used when oPWM is not operating to set new hightime when activated. | |
| void | lowtime (MICROSECOND low) |
| Lowtime is the off time for the pulse measured in micro-seconds. | |
| void | nextlow (MICROSECOND low) |
| Used when oPWM is not operating to set new lowtime when activated. | |
| void | value (bool onoff) const |
| For oDO1_TPU. | |
Static Public Member Functions | |
| int | TCR1 (void) |
| void | TMCR (int iarb) |
| bool | HSQR (int chan, int val) |
| Configures the host sequence register. | |
| bool | HSRR (int chan, int val) |
| Configures the host sequence request register. | |
| bool | CPR (int chan, int val) |
| Configures the channel priority register (Ref. TPU Channel Utilization). | |
| bool | CIER (int chan, int cie) |
| Configures the channel interrupt enable register. | |
| int | CISR (int chan) |
| Returns the channel interrupt status register. | |
| void | CISR_clear (int chan) |
| Clears the channel interrupt status register for the channel. | |
| bool | TICR (int cirl, int cibv) |
| Configures the TPU interrupt configuration register. | |
| int | tpu_vector (IOLINE channel) |
| Given a channel, returns the vector number to use for an interrupt. | |
I am somewhat undecided whether to make the return value of odometer (MILLIMETER) an int rather than unsigned. There are consequences either way. As an int, with quadrature encoding forward and reverse the same distance will return 0. Is this what is wanted/needed? Likewise, SPEED has also become a vector; i.e., containing both direction (+/-) and magnitude.
#include <hardware/oencodedmotor.h> oEncodedMotor Lmotor(4,3,PORT_E,2,PORT_E,1,100); int main() { Lmotor.orientation(false); Lmotor.speed(50); Lmotor.operate(true); Lmotor.brake(); }
|
||||||||||||
|
Configures the channel interrupt enable register.
|
|
||||||||||||
|
Configures the channel priority register (Ref. TPU Channel Utilization).
|
|
||||||||||||
|
Configures the host sequence register.
|
|
||||||||||||
|
Configures the host sequence request register.
|
|
|
Returns current encoder mode. Sets whether motors will automatically adjust to desired speed (true) or not. |
|
|
Used when oPWM is not operating to set new hightime when activated. DCmotor (and maybe like objects) needs this, because the only way to stop the PWM (that I know of) is to set hightime to 0--thus loosing the previous value of hightime. thus if you set the hightime while the object is non-operational, you want it to be set to that value the next time the object goes operational (see dcmotor.cpp to know what I'm talking about). |
|
|
misnomer--should be TCR1 divisor--return number of clocks (PSCK,TCR1P modifications) Globally available object. Can be used in combination with TPU_REGISTER definition to say TPU_REGISTER->CFSR.BITS... |
|
|
was tpu_init Configures the channel function select register |
1.3