upm
0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
|
API for the Grove Serial Camera. More...
The driver was tested with the Grove Serial Camera. There is no protocol documentation currently available, so this module was developed based completely on the Seeed Studio* Arduino* sketch.
It is connected via a UART at 115,200 baud.
Classes | |
class | PIC_FORMATS_T |
Public Member Functions | |
synchronized void | delete () |
GROVESCAM (int uart, short camAddr) | |
GROVESCAM (int uart) | |
boolean | dataAvailable (long millis) |
int | readData (byte[] buffer) |
int | writeData (byte[] buffer) |
boolean | setupTty (int baud) |
boolean | setupTty () |
void | drainInput () |
boolean | init () |
boolean | preCapture (GROVESCAM.PIC_FORMATS_T fmt) |
boolean | preCapture () |
boolean | doCapture () |
boolean | storeImage (String fname) |
int | getImageSize () |
Static Public Attributes | |
static final long | MAX_PKT_LEN = javaupm_grovescamJNI.GROVESCAM_MAX_PKT_LEN_get() |
GROVESCAM | ( | int | uart, |
short | camAddr | ||
) |
Grove Serial Camera constructor
uart | Default UART to use (0 or 1) |
camAddr | 3-bit address identifier of the camera; default is 0 |
boolean dataAvailable | ( | long | millis | ) |
Checks to see if there is data available for reading
millis | Number of milliseconds to wait; 0 means no waiting. |
boolean doCapture | ( | ) |
Starts the capture
void drainInput | ( | ) |
Reads serial input and discards until no more characters are available
int getImageSize | ( | ) |
Returns the picture length. Note: this is only valid after doCapture() has run successfully.
boolean init | ( | ) |
Initializes the camera
boolean preCapture | ( | GROVESCAM.PIC_FORMATS_T | fmt | ) |
Tells the camera to prepare for a capture
fmt | One of the PIC_FORMATS_T values |
boolean setupTty | ( | int | baud | ) |
Sets up proper tty I/O modes and the baud rate. For this device, the default baud rate is 9,600 (B9600).
baud | Desired baud rate |
boolean storeImage | ( | String | fname | ) |
Stores the captured image in a file
fname | Name of the file to write |