User Manual

Reference
C++ and Arduino methods are shown in red.
C functions are shown in green.
static void OrangutanSVP::setMode(unsigned char mode)
void svp_set_mode(unsigned char mode)
This command sets the mode of the Orangutan SVP’s auxiliary processor. The mode parameter determines the
functions of the auxiliary lines A, B, C, and D.
If mode is SVP_MODE_RX, then lines A, B, and C will be analog inputs (Section 2) and D/RX will
be used as the serial receive line. TTL-level serial bytes received on D/RX will be sent to the computer
on the Pololu Orangutan SVP TTL Serial Port. The D/RX line, along with the TX line (which is always
the serial transmit line), let you use the Orangutan as a two-way USB-to-serial adapter. This is the default
mode; the auxiliary processor will be in this mode whenever it starts running, and will revert to this mode
whenever the AVR is reset for any reason.
If mode is SVP_MODE_ANALOG, then lines A, B, C, and D will be analog inputs.
If mode is SVP_MODE_ENCODERS, then lines A and B together are inputs for a quadrature encoder
(called encoder AB), and lines C and D together are inputs for a quadrature encoder (called encoder CD).
The functions below whose names end in AB or CD provide access to the output from these encoders.
Additionally, the mode parameter can be inclusively ored with the keyword SVP_SLAVE_SELECT_ON to
enable the SPI slave select feature.
If SPI slave select is not enabled (default), then the ADC/SS line will be an analog input. This line is
hardwired to a user trimpot, so the name of the analog channel is TRIMPOT. However, if you want to
use this analog input for something else, you can cut the labeled trace between POT and ADC/SS on the
bottom of the board. This is the default mode; the auxiliary processor will be in this mode whenever it
starts running, and will revert to this mode whenever the AVR is reset for any reason.
If SPI slave select is enabled, then the line will be used as the SPI slave select line, SS. When SS is
high, the auxiliary processor will ignore all bytes received on SPI and will not drive the MISO line. This
allows the AVR to communicate with other SPI devices using the hardware SPI module. See Section 12.
When SS is driven low, then the AVR can communicate with the auxiliary processor over SPI as usual.
The SS line is pulled high through a 100 kilo-ohm pull-up resistor.
static unsigned char OrangutanSVP::usbPowerPresent()
unsigned char usb_power_present()
Returns 1 if the voltage on the power line of the USB connector is high. This indicates that the device
is plugged in to a computer or USB power supply. Returns 0 otherwise. This function is useful if you
want your Orangutan to behave differently when it is plugged in to USB (for example, by not running its
motors).
static unsigned char OrangutanSVP::usbConfigured()
unsigned char usb_configured()
Returns 1 if the device has reached the USB Configured State as defined in the USB 2.0 Specification.
This indicates that the device is plugged in to a computer and the right drivers might be installed. Returns
0 otherwise.
static unsigned char OrangutanSVP::usbSuspend()
unsigned char usb_suspend()
Pololu AVR Library Command Reference © 2001–2015 Pololu Corporation
13. Orangutan SVP Functions Page 49 of 65