我正在與Arduino的PTP(ISO 15740)庫(通過USB主機操縱相機設置)。它使用這個常量,它似乎是某種散列表數組。問題是我不知道它叫什麼,所以我不知道如何在網上搜索,因爲我不是一個經驗豐富的C++程序員,所以我不知道如何使用它。這個怎麼用?我不明白這個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」表示。這是一個起點參考。
我想拍5張照片。其中一個是「0x38」,而另外四個是在這個之前的兩個曝光,另外兩個是這個之後的兩個曝光。所以我想把所有五個十六進制值按順序放在一個數組中,所以它會找到「0x38」,然後在下面搜索兩個,然後在下面找到一個,然後是參考,然後是上面的一個,然後是上面的兩個。
這是從C繼承的基本語言特性。它是由聚合初始值設定項初始化的普通數組結構。有點奇怪,他們決定把字符串拼寫成字符數組,但除此之外沒有什麼不尋常的。閱讀一些關於C++(甚至C)初始化程序的書。 (數組元素從模板實例化的事實在這裏是無關緊要的)。 – AnT
謝謝,現在我知道它叫什麼了,我在網上找到了幾個參考文獻。我會做一些閱讀。非常感激。 – thenetimp
如果第二列寫成字符串而不是單個字符,比如「Bulb」,「30」,「25」,「20」,「20」 \「」'等等。 –