mirror of
https://github.com/eddyem/stm32samples.git
synced 2026-02-28 03:44:30 +03:00
USB tested and worked; TODO: add CANbus support
This commit is contained in:
@@ -28,18 +28,37 @@
|
||||
// connection timeout (100ms): do nothing until this timeout
|
||||
#define CONN_TIMEOUT (100)
|
||||
|
||||
// polling timeout - 2.5s
|
||||
#define POLLING_TIMEOUT (2500)
|
||||
|
||||
// pause after error before next reinit
|
||||
#define REINIT_PAUSE (5000)
|
||||
|
||||
// waiting for starting moving - 0.25s
|
||||
#define MOVING_PAUSE (250)
|
||||
|
||||
// interval of canon_proc calls (10ms)
|
||||
#define CANONPROC_INTERVAL (9)
|
||||
|
||||
// `flooding` interval (250ms)
|
||||
#define FLOODING_INTERVAL (249)
|
||||
|
||||
// answer for cmd "POLL"
|
||||
#define CANON_POLLANS (0xaa)
|
||||
|
||||
// bad focus value - 32767
|
||||
#define BADFOCVAL (0x7fff)
|
||||
|
||||
// flags of 0x90 (144) command:
|
||||
// Manual focus active
|
||||
#define CANON_MF_FLAG (0x0080)
|
||||
// focus dial is active
|
||||
#define CANON_DA_FLAG (0x2000)
|
||||
// manual focus is on some edge of range
|
||||
#define CANON_DE_FLAG (0x0010)
|
||||
// focus dial moving
|
||||
#define CANON_DM_FLAG (0x0004)
|
||||
|
||||
// maximal
|
||||
|
||||
typedef enum{
|
||||
@@ -55,11 +74,15 @@ typedef enum{
|
||||
CANON_DIAPHRAGM = 0x13, // open/close diaphragm by given (int8_t) value of steps
|
||||
CANON_FOCMOVE = 0x44, // move focus dial by given amount of steps (int16)
|
||||
CANON_FOCBYHANDS= 0x5e, // turn on focus move by hands (to turn off send 4,5 or 6)
|
||||
CANON_GETINFO = 0x80, // get information
|
||||
CANON_DIALPOS0 = 0x6b, // DIALPOSx - something like current transfocator dial (limb) position (not stepper!)
|
||||
CANON_DIALPOS1 = 0x6c,
|
||||
CANON_DIALPOS2 = 0x6d,
|
||||
CANON_DIALPOS3 = 0x6e,
|
||||
CANON_GETINFO = 0x80, // get information (bytes 0-1 - model, bytes 2-3 - minF, bytes 4-5 - maxF)
|
||||
CANON_GETREG = 0x90, // get regulators' state
|
||||
CANON_GETMODEL = 0xa0, // get lens (e.g. 200 == LX200)
|
||||
CANON_GETDIAL = 0xc0, // get focus dial position in steps
|
||||
CANON_GETFOCM = 0xc2, // get focus position in meters (not for all lenses)
|
||||
CANON_GETMODEL = 0xa0, // get current lens focus (e.g. 200 == LX200)
|
||||
CANON_GETSTPPOS = 0xc0, // get focus dial position in steps
|
||||
CANON_GETFOCM = 0xc2, // get focus position in meters (not for all lenses): Fm = 2.5*b[1] + b[2]/100; Fm previous = next 2 bytes
|
||||
} canon_commands;
|
||||
|
||||
typedef enum{
|
||||
@@ -90,5 +113,6 @@ int canon_diaphragm(char command);
|
||||
int canon_focus(int16_t val);
|
||||
int canon_sendcmd(uint8_t cmd);
|
||||
int canon_asku16(uint8_t cmd);
|
||||
int canon_writeu16(uint8_t cmd, uint16_t u);
|
||||
int canon_getinfo();
|
||||
uint16_t canon_getstate();
|
||||
|
||||
Reference in New Issue
Block a user