Mike R / Mbed 2 deprecated Pinscape_Controller_V2

Dependencies:   mbed FastIO FastPWM USBDevice

Fork of Pinscape_Controller by Mike R

Committer:
mjr
Date:
Mon Feb 15 20:30:32 2016 +0000
Revision:
45:c42166b2878c
Parent:
44:b5ac89b9cd5d
Child:
47:df7a88cd249c
More work in progress on CCD speedups;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mjr 35:e959ffba78fd 1 // Plunger Sensor Interface
mjr 35:e959ffba78fd 2 //
mjr 35:e959ffba78fd 3 // This module defines the abstract interface to the plunger sensors.
mjr 35:e959ffba78fd 4 // We support several different physical sensor types, so we need a
mjr 35:e959ffba78fd 5 // common interface for use in the main code.
mjr 35:e959ffba78fd 6 //
mjr 35:e959ffba78fd 7
mjr 35:e959ffba78fd 8 #ifndef PLUNGER_H
mjr 35:e959ffba78fd 9 #define PLUNGER_H
mjr 35:e959ffba78fd 10
mjr 35:e959ffba78fd 11 class PlungerSensor
mjr 35:e959ffba78fd 12 {
mjr 35:e959ffba78fd 13 public:
mjr 35:e959ffba78fd 14
mjr 35:e959ffba78fd 15 PlungerSensor() { }
mjr 35:e959ffba78fd 16 virtual ~PlungerSensor() { }
mjr 35:e959ffba78fd 17
mjr 35:e959ffba78fd 18 // Initialize the physical sensor device. This is called at startup
mjr 35:e959ffba78fd 19 // to set up the device for first use.
mjr 35:e959ffba78fd 20 virtual void init() = 0;
mjr 35:e959ffba78fd 21
mjr 35:e959ffba78fd 22 // Take a high-resolution reading. Sets pos to the current position,
mjr 44:b5ac89b9cd5d 23 // on a scale from 0.0 to 1.0: 0.0 is the maximum forward plunger position,
mjr 44:b5ac89b9cd5d 24 // and 1.0 is the maximum retracted position, in terms of the sensor's
mjr 35:e959ffba78fd 25 // extremes. This is a raw reading in terms of the sensor range; the
mjr 35:e959ffba78fd 26 // caller is responsible for applying calibration data and scaling the
mjr 35:e959ffba78fd 27 // result to the the joystick report range.
mjr 35:e959ffba78fd 28 //
mjr 35:e959ffba78fd 29 // Returns true on success, false on failure. Return false if it wasn't
mjr 35:e959ffba78fd 30 // possible to take a good reading for any reason.
mjr 44:b5ac89b9cd5d 31 virtual bool highResScan(float &pos) = 0;
mjr 35:e959ffba78fd 32
mjr 35:e959ffba78fd 33 // Take a low-resolution reading. This reports the result on the same
mjr 44:b5ac89b9cd5d 34 // 0.0 to 1.0 scale as highResScan(). Returns true on success, false on
mjr 35:e959ffba78fd 35 // failure.
mjr 35:e959ffba78fd 36 //
mjr 35:e959ffba78fd 37 // The difference between the high-res and low-res scans is the amount
mjr 35:e959ffba78fd 38 // of time it takes to complete the reading. The high-res scan is allowed
mjr 35:e959ffba78fd 39 // to take about 10ms; a low-res scan take less than 1ms. For many
mjr 35:e959ffba78fd 40 // sensors, either of these time scales would yield identical resolution;
mjr 35:e959ffba78fd 41 // if that's the case, simply take a reading the same way in both functions.
mjr 35:e959ffba78fd 42 // The distinction is for the benefit of sensors that need significantly
mjr 35:e959ffba78fd 43 // longer to read at higher resolutions, such as image sensors that have
mjr 35:e959ffba78fd 44 // to sample pixels serially.
mjr 44:b5ac89b9cd5d 45 virtual bool lowResScan(float &pos) = 0;
mjr 35:e959ffba78fd 46
mjr 35:e959ffba78fd 47 // Send an exposure report to the joystick interface. This is specifically
mjr 35:e959ffba78fd 48 // for image sensors, and should be omitted by other sensor types. For
mjr 35:e959ffba78fd 49 // image sensors, this takes one exposure and sends all pixels to the host
mjr 35:e959ffba78fd 50 // through special joystick reports. This is used for PC-side testing tools
mjr 35:e959ffba78fd 51 // to let the user check the sensor installation by directly viewing its
mjr 35:e959ffba78fd 52 // pixel output.
mjr 45:c42166b2878c 53 //
mjr 45:c42166b2878c 54 // Mode bits:
mjr 45:c42166b2878c 55 // 0x01 -> send processed pixels (default is raw pixels)
mjr 45:c42166b2878c 56 // 0x02 -> low res scan (default is high res scan)
mjr 45:c42166b2878c 57 //
mjr 45:c42166b2878c 58 // If processed mode is selected, the sensor should apply any pixel
mjr 45:c42166b2878c 59 // processing it normally does when taking a plunger position reading,
mjr 45:c42166b2878c 60 // such as exposure correction, noise reduction, etc. In raw mode, we
mjr 45:c42166b2878c 61 // simply send the pixels as read from the sensor. Both modes are useful
mjr 45:c42166b2878c 62 // in setting up the physical sensor.
mjr 45:c42166b2878c 63 virtual void sendExposureReport(class USBJoystick &js, uint8_t mode) { }
mjr 35:e959ffba78fd 64 };
mjr 35:e959ffba78fd 65
mjr 35:e959ffba78fd 66 #endif /* PLUNGER_H */