{"id":1973,"date":"2016-01-02T02:56:05","date_gmt":"2016-01-01T17:56:05","guid":{"rendered":"https:\/\/hack.gpl.jp\/?p=1973"},"modified":"2016-01-02T02:56:05","modified_gmt":"2016-01-01T17:56:05","slug":"post-1973","status":"publish","type":"post","link":"https:\/\/hack.gpl.jp\/2016\/01\/02\/post-1973.html","title":{"rendered":"1us L\u30c1\u30ab"},"content":{"rendered":"

2016\u5e74 \u8b39\u8cc0\u65b0\u5e74\u3001\u3042\u3051\u307e\u3057\u3066\u304a\u3081\u3067\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002\u304a\u305b\u3061\u6599\u7406\u308231\u65e5\u30681\u65e5\u3067\u98df\u3079\u3064\u304f\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n

\u3055\u3066\u3001\u4eca\u5e74\u6700\u521d\u306e\u30d6\u30ed\u30b0\u3067\u3059\u306d\u30020.000001\u79d2\u306eL\u30c1\u30ab\u3092\u30ed\u30b8\u30c3\u30af\u30a2\u30ca\u30e9\u30a4\u30b6\u30fc\u3067\u30e2\u30cb\u30bf\u30ea\u30f3\u30b0\u3057\u3066\u5149\u3089\u305b\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n

\u3042\u3068\u3001\u30aa\u30ec\u30f3\u30b8\u30d1\u30a4\u3067\u30018\u672c\u306eGPIO \u3092\u4f7f\u3063\u3066\u5b89\u4fa1\u306a\u30ed\u30b8\u30c3\u30af\u30a2\u30ca\u30e9\u30a4\u30b6\u30fc\u3067\u63a1\u53d6\u3067\u304d\u308b\u304b\u3082\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n

 <\/p>\n

\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u63a1\u53d6\u3057\u305f\u30c7\u30fc\u30bf\u304c\u4ee5\u4e0b\u3067\u3059\u30028\u672c\u5206\u306f\u53d6\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u901f\u3059\u304e\u308b\u3068\u3053\u308d\u306f\u53d6\u308a\u3053\u307c\u3057\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n

\"1\" <\/p>\n

\u77e2\u5370\u306f500ns \u3067\u5149\u3063\u3066\u3044\u308b\u90e8\u5206\u3067\u63a1\u53d6\u306b\u5931\u6557\u3057\u3001\u53d6\u308a\u3053\u307c\u3059\u4e8b\u304c\u3042\u308a\u307e\u3057\u305f\u3002\u3053\u306e\u3042\u305f\u308a\u304c2Mhz \u306e\u9650\u754c\u306a\u3093\u3067\u3059\u306d\u3002\u4eca\u306e\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2\u3068\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3060\u3068\u3053\u308c\u304c\u9650\u754c\u306e\u3088\u3046\u3067\u3059\u3002<\/p>\n

\"2\" <\/p>\n

\u8907\u6570\u306eLED \u306f\u3001blink \u30d5\u30a1\u30f3\u30af\u30b7\u30e7\u30f3\u306b\u3066\u5149\u3089\u305b\u3066\u3044\u307e\u3059\u304c\u3001\u547c\u3073\u51fa\u3057\u3068\u521d\u671f\u5316\u306e\u51e6\u7406\u3067250us \u7a0b\u5ea6\u4f7f\u3063\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n

\"3\" <\/p>\n

usleep \u95a2\u6570\u3092\u4f7f\u3063\u3066\u3082\u601d\u3063\u305f\u3088\u308a\u3001\u51e6\u7406\u306b\u6642\u9593\u304c\u304b\u304b\u308b\u3088\u3046\u3067\u3059\u30021us \u3092\u6307\u5b9a\u3057\u3066\u5149\u3089\u305b\u3066\u3044\u308b\u3093\u3067\u3059\u304c\u3001\u5b9f\u969b\u306f69us \u5149\u3063\u3066\u3044\u307e\u3059\u3002nanosleep \u3092\u4f7f\u3063\u3066\u308266us \u306f\u4f7f\u308f\u308c\u3066\u3057\u307e\u3046\u3088\u3046\u3067\u30011us \u3092\u5149\u3089\u305b\u308b\u70ba\u306bwhile \u3067\u8abf\u6574\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n

\"4\" <\/p>\n

\u30b5\u30f3\u30d7\u30eb\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n

\/*\n *  +-----+-----+----------+------+---+--OrangePiPC--+---+------+---------+-----+--+\n *  | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |\n *  +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+\n *  |     |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |     |\n *  |   2 |  -1 |    SDA.0 |      |   |  3 || 4  |   |      | 5V       |     |     |\n *  |   3 |  -1 |    SCL.0 |      |   |  5 || 6  |   |      | 0v       |     |     |\n *  |   4 |   6 | IO6 PA06 |  OUT | 0 |  7 || 8  |   |      | TxD3     |     |     |\n *  |     |     |       0v |      |   |  9 || 10 |   |      | RxD3     |     |     |\n *  |  17 |  -1 |     RxD2 |      |   | 11 || 12 | 0 | OUT  | IO1 PD14 | 1   | 18  |\n *  |  27 |  -1 |     TxD2 |      |   | 13 || 14 |   |      | 0v       |     |     |\n *  |  22 |  -1 |     CTS2 |      |   | 15 || 16 | 0 | OUT  | IO4 PC04 | 4   | 23  |\n *  |     |     |     3.3v |      |   | 17 || 18 | 0 | OUT  | IO5 PC07 | 5   | 24  |\n *  |  10 |  -1 |     MOSI |      |   | 19 || 20 |   |      | 0v       |     |     |\n *  |   9 |  -1 |     MISO |      |   | 21 || 22 |   |      | RTS2     |     |     |\n *  |  11 |  -1 |     SCLK |      |   | 23 || 24 |   |      | SPI-CE0  |     |     |\n *  |     |     |       0v |      |   | 25 || 26 |   |      | CE1      |     |     |\n *  |   0 |  -1 |    SDA.1 |      |   | 27 || 28 |   |      | SCL.1    |     |     |\n *  |   5 |   7 |  IO7 PA7 |  OUT | 0 | 29 || 30 |   |      | 0v       |     |     |\n *  |   6 |   8 |  IO8 PA8 |  OUT | 0 | 31 || 32 | 0 | OUT  | IO9 PG08 | 9   | 12  |\n *  |  13 |  10 | IO10 PA9 |  OUT | 0 | 33 || 34 |   |      | 0v       |     |     |\n *  |  19 |  12 | IO12PA10 |  OUT | 0 | 35 || 36 | 0 | OUT  | IO13PG09 | 13  | 16  |\n *  |  26 |  14 | IO14PA20 | ALT3 | 0 | 37 || 38 | 0 | OUT  | IO15PG06 | 15  | 20  |\n *  |     |     |       0v |      |   | 39 || 40 | 0 | OUT  | IO16PG07 | 16  | 21  |\n *  +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+\n *  | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |\n *  +-----+-----+----------+------+---+--OrangePIPC--+------+----------+-----+-----+\n *         ^^^^ Pin NO                                                   ^^^^ Pin NO\n * 1us LED blink.\n * building ex) gcc -lwiringPi -lpthread -I\/usr\/local\/include -L\/usr\/local\/lib -levent -o 2016blinkall 2016blinkall.c\n * \n *\n*\/\n#include <sys\/time.h>\n#include <time.h>\n#include <unistd.h>\n#include <stdio.h>\n#include <wiringPi.h>\n\n#define MSEC 1\n#define USEC 33\n#define NANOSEC 1000\n\nint blink2(int led, int delay);\n\nint main (void)\n{\n  int led;\n  int i = 0;\n\n  while (i < 3)\n  {\n    blink2(16, 1000);\n      blink2(15, 1000); \/\/Next blink 250 us\n      blink2(13, 1000);\n      blink2(9, 1000);\n      blink2(5, 1000);\n      blink2(4, 1000);\n      blink2(1, 1000);\n      blink2(6, 1000);\n\n    i++;\n  }\n\n  delay (MSEC);\n  return 0;\n}\n\nint blink2(int led, int delay){\n    \/\/ unsigned int usecs;\n    \/\/ usecs = delay;\n    \/\/ sec = delay;\n    led = led;\n    int i = 0;\n\n    \/\/ nano sec\n    struct timespec nano;\n    nano.tv_sec = 0;\n    nano.tv_nsec = delay;\n\n    wiringPiSetup () ;\n    pinMode (led, OUTPUT) ;\n\n    digitalWrite (led, HIGH) ;\n    nanosleep(&nano, NULL); \/\/ 66us\n    \/\/ usleep (usecs) ; \/\/ 66us\n    \/\/ delay (delay);\n    digitalWrite (led,  LOW) ;\n    usleep (1);\n\n    digitalWrite (led, HIGH) ;\n\n    \/\/ 1us\n    while (i < 100)\n    {\n        i++;\n    }\n    digitalWrite (led,  LOW) ;\n    usleep (1); \/\/ 66us\n\n    digitalWrite (led, HIGH) ;\n    \/\/ 500 ns\n    digitalWrite (led,  LOW) ;\n}<\/pre>\n

GPIO \u306e8\u672c\u3092\u540c\u6642\u306b\u51e6\u7406\u3055\u305b\u308b\u306b\u306f\u3069\u3046\u3057\u305f\u3089\u3044\u3044\u3093\u3067\u3057\u3087\u3046\u304b\u306d\u3002\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9\u51e6\u7406\u3067\u3059\u304b\u306d\uff1f\u30b7\u30d5\u30c8\u30ec\u30b8\u30b9\u30bf\u306b\u6295\u3052\u3066\u3001\u4e00\u62ec\u51e6\u7406\u3068\u304b\u3067\u3059\u304b\u306d\uff1f<\/p>\n

 <\/p>\n

\u524d\u3061\u3087\u3063\u3068\u89e6\u3063\u305f\u30a4\u30d9\u30f3\u30c8\u51e6\u7406\u306elibevent \u3068\u304b\u3092\u4f7f\u3046\u3068\u3069\u306e\u304f\u3089\u3044\u306e\u7cbe\u5ea6\u306b\u306a\u308b\u3093\u3067\u3057\u3087\u3046\u304b\u306d\u3002\u3044\u308d\u3044\u308d\u7591\u554f\u304c\u308f\u3044\u3066\u304d\u307e\u3059\u3002<\/p>\n

E-ink \u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306b\u306f\u307e\u3060\u307e\u3060\u8d85\u3048\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u5c71\u304c\u305f\u304f\u3055\u3093\u3042\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n

\u306a\u3093\u3068\u304b\u3001\u6625\u307e\u3067\u306b\u306f\u8868\u793a\u3057\u305f\u3044\u3093\u3067\u3059\u304c\u3002\u3053\u3064\u3053\u3064\u3068\u3084\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

2016\u5e74 \u8b39\u8cc0\u65b0\u5e74\u3001\u3042\u3051\u307e\u3057\u3066\u304a\u3081\u3067\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002\u304a\u305b\u3061\u6599\u7406\u308231\u65e5\u30681\u65e5\u3067\u98df\u3079\u3064\u304f\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002 \u3055\u3066\u3001\u4eca\u5e74\u6700\u521d\u306e\u30d6\u30ed\u30b0\u3067\u3059\u306d\u30020.000001\u79d2\u306eL\u30c1\u30ab\u3092\u30ed\u30b8\u30c3\u30af\u30a2\u30ca\u30e9\u30a4\u30b6\u30fc\u3067\u30e2\u30cb\u30bf\u30ea\u30f3\u30b0\u3057\u3066\u5149\u3089\u305b\u3066\u307f\u307e\u3057\u305f […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","footnotes":""},"categories":[6,17,31,57,60],"tags":[],"acf":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"JunkHack","author_link":"https:\/\/hack.gpl.jp\/author\/junkhack\/"},"uagb_comment_info":0,"uagb_excerpt":"2016\u5e74 \u8b39\u8cc0\u65b0\u5e74\u3001\u3042\u3051\u307e\u3057\u3066\u304a\u3081\u3067\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002\u304a\u305b\u3061\u6599\u7406\u308231\u65e5\u30681\u65e5\u3067\u98df\u3079\u3064\u304f\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002 \u3055…","_links":{"self":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts\/1973"}],"collection":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/comments?post=1973"}],"version-history":[{"count":0,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts\/1973\/revisions"}],"wp:attachment":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/media?parent=1973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/categories?post=1973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/tags?post=1973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}