pyupm_grovescam module

class pyupm_grovescam.GROVESCAM(uart, camAddr=0)[source]

Bases: object

API for the Grove Serial Camera.

Deprecated This class is being replaced by SCAM

ID: grovescam

Name: Serial Camera Module

Category: other

Manufacturer: seeed

Connection: uart

Link:http://www.seeedstudio.com/wiki/Grove_-_Serial_Camera_Kit 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.

C++ includes: grovescam.hpp

FORMAT_CIF = 5
FORMAT_OCIF = 3
FORMAT_VGA = 7
MAX_PKT_LEN = 128
dataAvailable(millis)[source]

bool dataAvailable(unsigned int millis)

Checks to see if there is data available for reading

millis: Number of milliseconds to wait; 0 means no waiting.

True if there is data available for reading

doCapture()[source]

bool doCapture()

Starts the capture

True if successful

drainInput()[source]

void drainInput()

Reads serial input and discards until no more characters are available

getImageSize()[source]

int getImageSize()

Returns the picture length. Note: this is only valid after doCapture() has run successfully.

Image length

init()[source]

bool init()

Initializes the camera

preCapture(*args)[source]

bool preCapture(PIC_FORMATS_T fmt=FORMAT_VGA)

Tells the camera to prepare for a capture

fmt: One of the PIC_FORMATS_T values

readData(buffer, len)[source]

int readData(uint8_t *buffer, int len)

Reads any available data into a user-supplied buffer. Note: the call blocks until data is available to be read. Use dataAvailable() to determine whether there is data available beforehand, to avoid blocking.

buffer: Buffer to hold the data read

len: Length of the buffer

Number of bytes read

setupTty(*args)[source]

bool setupTty(speed_t baud=B115200)

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

True if successful

storeImage(fname)[source]

bool storeImage(const char *fname)

Stores the captured image in a file

fname: Name of the file to write

True if successful

let the games begin…

writeData(buffer, len)[source]

int writeData(uint8_t *buffer, int len)

Writes the data in the buffer to the device

buffer: Buffer to hold the data read

len: Length of the buffer

Number of bytes written