0

我正在为 Arduino 使用PTPISO 15740)库(通过 USB 主机操作相机设置)。它使用这个常量,它似乎是某种哈希表数组。问题是我不知道它叫什么,所以我不知道如何在网上搜索它,而且由于我不是一个经验丰富的 C++ 程序员,我不知道如何使用它。这是如何运作的?

const ValueTitle<VT_SHSPEED, VT_SHSPEED_TEXT_LEN> ShutterSpeedTitles[] PROGMEM =
{
{0x0c,  {'B','u','l','b',0} },
{0x10,  {' ','3','0','"',0} },
{0x13,  {' ','2','5','"',0} },
{0x14,  {' ','2','0','"',0} },
{0x15,  {' ','2','0','"',0} },
{0x18,  {' ','1','5','"',0} },
{0x1B,  {' ','1','3','"',0} },
{0x1C,  {' ','1','0','"',0} },
{0x1D,  {' ','1','0','"',0} },
{0x20,  {' ',' ','8','"',0} },
{0x23,  {' ',' ','6','"',0} },
{0x24,  {' ',' ','6','"',0} },
{0x25,  {' ',' ','5','"',0} },
{0x28,  {' ',' ','4','"',0} },
{0x2B,  {' ','3','"','2',0} },
{0x2C,  {' ',' ','3','"',0} },
{0x2D,  {' ','2','"','5',0} },
{0x30,  {' ',' ','2','"',0} },
{0x33,  {' ','1','"','6',0} },
{0x34,  {' ','1','"','5',0} },
{0x35,  {' ','1','"','3',0} },
{0x38,  {' ',' ','1','"',0} },
{0x3B,  {' ','0','"','8',0} },
{0x3C,  {' ','0','"','7',0} },
{0x3D,  {' ','0','"','6',0} },
{0x40,  {' ','0','"','5',0} },
{0x43,  {' ','0','"','4',0} },
{0x44,  {' ','0','"','3',0} },
{0x45,  {' ','0','"','3',0} },
{0x48,  {' ',' ',' ','4',0} },
{0x4B,  {' ',' ',' ','5',0} },
{0x4C,  {' ',' ',' ','6',0} },
{0x4D,  {' ',' ',' ','6',0} },
{0x50,  {' ',' ',' ','8',0} },
{0x53,  {' ',' ','1','0',0} },
{0x54,  {' ',' ','1','0',0} },
{0x55,  {' ',' ','1','3',0} },
{0x58,  {' ',' ','1','5',0} },
{0x5B,  {' ',' ','2','0',0} },
{0x5C,  {' ',' ','2','0',0} },
{0x5D,  {' ',' ','2','5',0} },
{0x60,  {' ',' ','3','0',0} },
{0x63,  {' ',' ','4','0',0} },
{0x64,  {' ',' ','4','5',0} },
{0x65,  {' ',' ','5','0',0} },
{0x68,  {' ',' ','6','0',0} },
{0x6B,  {' ',' ','8','0',0} },
{0x6C,  {' ',' ','9','0',0} },
{0x6D,  {' ','1','0','0',0} },
{0x70,  {' ','1','2','5',0} },
{0x73,  {' ','1','6','0',0} },
{0x74,  {' ','1','8','0',0} },
{0x75,  {' ','2','0','0',0} },
{0x78,  {' ','2','5','0',0} },
{0x7B,  {' ','3','2','0',0} },
{0x7C,  {' ','3','5','0',0} },
{0x7D,  {' ','4','0','0',0} },
{0x80,  {' ','5','0','0',0} },
{0x83,  {' ','6','4','0',0} },
{0x84,  {' ','7','5','0',0} },
{0x85,  {' ','8','0','0',0} },
{0x88,  {'1','0','0','0',0} },
{0x8B,  {'1','2','5','0',0} },
{0x8C,  {'1','5','0','0',0} },
{0x8D,  {'1','6','0','0',0} },
{0x90,  {'2','0','0','0',0} },
{0x93,  {'2','5','0','0',0} },
{0x94,  {'3','0','0','0',0} },
{0x95,  {'3','2','0','0',0} },
{0x98,  {'4','0','0','0',0} },
{0x9B,  {'5','0','0','0',0} },
{0x9C,  {'6','0','0','0',0} },
{0x9D,  {'6','4','0','0',0} },
{0xA0,  {'8','0','0','0',0} }
};

基本上我最终要寻找的是这个。十六进制值表示相机上的快门速度。十六进制数字右侧的数据是快门速度的值,如果它在相机显示屏上以单个字符表示。(我想这可以称为矩阵?)。我想插入我的设备,并在相机上设置曝光。我们会说一秒曝光,用十六进制值“0x38”表示。这是一个起点参考。

我想拍五张照片。其中一个是“0x38”,而另外四个中的两个是这一次之前的两次曝光,另外两个是这一次之后的两次曝光。所以我想把所有五个十六进制值按顺序放在一个数组中,这样它就会找到“0x38”,然后在下面搜索两个,然后在下面找到一个,然后是引用,然后是上面的一个,然后是上面的两个。

4

1 回答 1

2

它是一个数组初始化器:

例子:

int  val[] = {1, 2, 3, 4}; // initializes an array of ints.

如果你有 struct 相同的语法工作。

struct X
{
    int x;
    int y;
};

X   valX[] = { {1,2}, {3,4}, {5,6}}; // initializes an array of X
                                     // first X is {1,2}
                                     // second X is {3,4}
                                     // etc

在您的情况下,结构是:

ValueTitle<VT_SHSPEED, VT_SHSPEED_TEXT_LEN>

但是概念是一样的;

于 2012-11-03T18:52:25.907 回答