📄 cam_control_fw.h
字号:
/*----------------------------------------------------------------------------*\| || Copyright (C) 2003, James A. Cureington || tonycu * users_sourceforge_net || || This program is free software; you can redistribute it and/or || modify it under the terms of the GNU General Public License || as published by the Free Software Foundation; either version 2 || of the License, or any later version. || || This program is distributed in the hope that it will be useful, || but WITHOUT ANY WARRANTY; without even the implied warranty of || MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the || GNU General Public License for more details. || || You should have received a copy of the GNU General Public License || along with this program; if not, write to the Free Software || Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. || || || Tony Cureington || October 31, 2000 || || || This file is associated with the ezusb2131 Linux downloader project. The || project can be found at http://ezusb2131.sourceforge.net. || || this file derived from pp.c header files || || pp.c header files Copyright (C) 2002, Michael Hetherington || chinook * pacific_net_sg || || pp.c header files based on sunkbd_hid.c header files || sunkbd_hid.c header files Copyright (C) 2001, Arnim Laeuger || arnim * users_sourceforge_net || || |\*----------------------------------------------------------------------------*//******************************************************************************* * * $Id: cam_control_fw.h,v 1.1 2003/02/21 06:50:35 tonycu Exp $ * ******************************************************************************/#ifndef CAM_CONTROL_FW_H#define CAM_CONTROL_FW_H/* servo defines, times are in micro-seconds */#define PULSE_FREQUENCY 25000 /* milli-seconds (in usec) */#define CENTER_USECS 2560 /* pulse for center position (in usec) */#define NUM_DEGREES 90 /* number of degrees servo can move */ /* from center to left or right */#define NUM_STOPS 270 /* number of steps, must be multiple * of NUM_DEGREES */ #define HORIZONTAL_TIME_REMAINING 1#define VERTICAL_TIME_REMAINING 2#define STOP_BOTH_PULSES 3#define SERVO_PULSE_TIME(usec) ((usec*2)+1)#define SERVO_INTERRUPT_TIME(usec) (0xFFFF-usec)#define HORIZONTAL_SERVO_ON() (OUTB |= 0x04)#define HORIZONTAL_SERVO_OFF() (OUTB &= ~0x04)#define VERTICAL_SERVO_ON() (OUTB |= 0x08)#define VERTICAL_SERVO_OFF() (OUTB &= ~0x08)/* * below table generated from make_usec_table.c */static code unsigned short usec_table[NUM_STOPS] = { 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210, 217, 224, 231, 238, 245, 252, 259, 266, 273, 280, 287, 294, 301, 308, 315, 322, 329, 336, 343, 350, 357, 364, 371, 378, 385, 392, 399, 406, 413, 420, 427, 434, 441, 448, 455, 462, 469, 476, 483, 490, 497, 504, 511, 518, 525, 532, 539, 546, 553, 560, 567, 574, 581, 588, 595, 602, 609, 616, 623, 630, 637, 644, 651, 658, 665, 672, 679, 686, 693, 700, 707, 714, 721, 728, 735, 742, 749, 756, 763, 770, 777, 784, 791, 798, 805, 812, 819, 826, 833, 840, 847, 854, 861, 868, 875, 882, 889, 896, 903, 910, 917, 924, 931, 938, 945, 952, 959, 966, 973, 980, 987, 994, 1001, 1008, 1015, 1022, 1029, 1036, 1043, 1050, 1057, 1064, 1071, 1078, 1085, 1092, 1099, 1106, 1113, 1120, 1127, 1134, 1141, 1148, 1155, 1162, 1169, 1176, 1183, 1190, 1197, 1204, 1211, 1218, 1225, 1232, 1239, 1246, 1253, 1260, 1267, 1274, 1281, 1288, 1295, 1302, 1309, 1316, 1323, 1330, 1337, 1344, 1351, 1358, 1365, 1372, 1379, 1386, 1393, 1400, 1407, 1414, 1421, 1428, 1435, 1442, 1449, 1456, 1463, 1470, 1477, 1484, 1491, 1498, 1505, 1512, 1519, 1526, 1533, 1540, 1547, 1554, 1561, 1568, 1575, 1582, 1589, 1596, 1603, 1610, 1617, 1624, 1631, 1638, 1645, 1652, 1659, 1666, 1673, 1680, 1687, 1694, 1701, 1708, 1715, 1722, 1729, 1736, 1743, 1750, 1757, 1764, 1771, 1778, 1785, 1792, 1799, 1806, 1813, 1820, 1827, 1834, 1841, 1848, 1855, 1862, 1869, 1876, 1883, 1890 };#define POSITION_TO_USEC(pos, usec) \ { \ if (pos == 0) { \ usec = CENTER_USECS; \ } else if (pos > 0) { \ usec = CENTER_USECS + usec_table[(pos)-1]; \ } else { \ usec = CENTER_USECS - usec_table[(-1*pos)-1]; \ } \ }typedef struct{ char new_command; /* new command from host */ short horizontal_pos; short vertical_pos;} pwm; /* pulse width modulation struct *//* USB setup packet defines */#define REQUEST_DIRECTION_MASK 0x80#define HOST_TO_DEVICE 0x00#define DEVICE_TO_HOST 0x80#define REQUEST_TYPE_MASK 0x60#define STANDARD_REQUEST_TYPE 0x00#define CLASS_REQUEST_TYPE 0x20#define VENDOR_REQUEST_TYPE 0x40#define RESERVED_REQUEST_TYPE 0x60#define RECIPIENT_MASK 0x1F#define DEVICE_RECIPIENT 0x00#define INTERFACE_RECIPIENT 0x01#define ENDPOINT_RECIPIENT 0x02#define OTHER_RECIPIENT 0x03#define GET_STATUS_REQUEST 0x00#define CLEAR_FEATURE_REQUEST 0x01#define RESERVED_REQUEST_1 0x02#define SET_FEATURE_REQUEST 0x03#define RESERVED_REQUEST_2 0x04#define SET_ADDRESS_REQUEST 0x05#define GET_DESCRIPTOR_REQUEST 0x06#define SET_DESCRIPTOR_REQUEST 0x07#define GET_CONFIG_REQUEST 0x08#define SET_CONFIG_REQUEST 0x09#define GET_INTERFACE_REQUEST 0x0A#define SET_INTERFACE_REQUEST 0x0B#define SYNCH_FRAME_REQUEST 0x0C#define GET_DEVICE_DESCRIPTOR 0x01#define GET_CONFIG_DESCRIPTOR 0x02#define GET_STRING_DESCRIPTOR 0x03/* macros */#define CLEAR_INT2() (EXIF &= 0xEF)#define EP0_STALL() (EP0CS = 0x03) /* set EPOSTALL & HSNAK */#define CLEAR_HSNAK() (EP0CS = 0x02) /* clr handshake nak */#define HI_BYTE(b) ((byte)((unsigned int)b >> 8))#define LOW_BYTE(b) ((byte)((unsigned int)b & 0xFF))#define SET_BIT(the_bit) {_asm setb the_bit; _endasm;}#define CLEAR_BIT(the_bit) {_asm clr the_bit; _endasm;}xdata at 0x7FA1 unsigned char ISOCTL;/*************************************** * ezhid_reg.h * http://sourceforge.net/projects/ezhid * maintainer: * Arnim Laeuger * arnim@users.sourceforge.net ***************************************/sbit at 0xe8 EUSB;sbit at 0xac ES0;sbit at 0xae ES1;sbit at 0x98 RI_0;sbit at 0x99 TI_0;sbit at 0xc0 RI_1;sbit at 0xc1 TI_1;sbit at 0xca TR2;sbit at 0xcf TF2;sbit at 0xad ET2;sfr at 0x91 EXIF;sfr at 0xe8 EIE;sfr at 0x98 SCON0;sfr at 0xc0 SCON1;sfr at 0x99 SBUF0;sfr at 0xc1 SBUF1;sfr at 0x8e CKCON;sfr at 0xc8 T2CON;sfr at 0xca RCAP2L;sfr at 0xcb RCAP2H;sfr at 0xcc TL2;sfr at 0xcd TH2;xdata at 0x7fb4 unsigned char EP0CS;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -