ピン変化割り込み拡張のテスト
Dependencies: interruptin_mod mbed
main.cpp@0:13afa59109be, 2014-11-13 (annotated)
- Committer:
- bousiya03
- Date:
- Thu Nov 13 11:49:26 2014 +0000
- Revision:
- 0:13afa59109be
typo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bousiya03 | 0:13afa59109be | 1 | #include "mbed.h" |
bousiya03 | 0:13afa59109be | 2 | //#include "IRM2121.h" |
bousiya03 | 0:13afa59109be | 3 | #include"interruptin_mod.h" |
bousiya03 | 0:13afa59109be | 4 | |
bousiya03 | 0:13afa59109be | 5 | interruptin_mod test(p5); |
bousiya03 | 0:13afa59109be | 6 | |
bousiya03 | 0:13afa59109be | 7 | //InterruptIn test1(p5); |
bousiya03 | 0:13afa59109be | 8 | |
bousiya03 | 0:13afa59109be | 9 | //IRM2121 test(p5); |
bousiya03 | 0:13afa59109be | 10 | /* |
bousiya03 | 0:13afa59109be | 11 | class intruptin_mod:public InterruptIn{ |
bousiya03 | 0:13afa59109be | 12 | |
bousiya03 | 0:13afa59109be | 13 | public: |
bousiya03 | 0:13afa59109be | 14 | |
bousiya03 | 0:13afa59109be | 15 | intruptin_mod(PinName pin): InterruptIn(pin){} |
bousiya03 | 0:13afa59109be | 16 | |
bousiya03 | 0:13afa59109be | 17 | void rise_disable(void (*fptr)(void)) { |
bousiya03 | 0:13afa59109be | 18 | |
bousiya03 | 0:13afa59109be | 19 | _rise.attach(fptr); |
bousiya03 | 0:13afa59109be | 20 | gpio_irq_set(&gpio_irq, IRQ_RISE, 0); |
bousiya03 | 0:13afa59109be | 21 | |
bousiya03 | 0:13afa59109be | 22 | } |
bousiya03 | 0:13afa59109be | 23 | |
bousiya03 | 0:13afa59109be | 24 | void fall_disable(void (*fptr)(void)) { |
bousiya03 | 0:13afa59109be | 25 | |
bousiya03 | 0:13afa59109be | 26 | _fall.attach(fptr); |
bousiya03 | 0:13afa59109be | 27 | gpio_irq_set(&gpio_irq, IRQ_FALL, 0); |
bousiya03 | 0:13afa59109be | 28 | |
bousiya03 | 0:13afa59109be | 29 | } |
bousiya03 | 0:13afa59109be | 30 | |
bousiya03 | 0:13afa59109be | 31 | }; |
bousiya03 | 0:13afa59109be | 32 | |
bousiya03 | 0:13afa59109be | 33 | */ |
bousiya03 | 0:13afa59109be | 34 | |
bousiya03 | 0:13afa59109be | 35 | void test_f(){ |
bousiya03 | 0:13afa59109be | 36 | |
bousiya03 | 0:13afa59109be | 37 | |
bousiya03 | 0:13afa59109be | 38 | |
bousiya03 | 0:13afa59109be | 39 | } |
bousiya03 | 0:13afa59109be | 40 | |
bousiya03 | 0:13afa59109be | 41 | int main(){ |
bousiya03 | 0:13afa59109be | 42 | |
bousiya03 | 0:13afa59109be | 43 | //int value = 0; |
bousiya03 | 0:13afa59109be | 44 | |
bousiya03 | 0:13afa59109be | 45 | test.fall(&test_f); |
bousiya03 | 0:13afa59109be | 46 | test.fall_disable(NULL); |
bousiya03 | 0:13afa59109be | 47 | |
bousiya03 | 0:13afa59109be | 48 | // test.Set(); |
bousiya03 | 0:13afa59109be | 49 | |
bousiya03 | 0:13afa59109be | 50 | //value = test.Read(); |
bousiya03 | 0:13afa59109be | 51 | |
bousiya03 | 0:13afa59109be | 52 | //printf("value = %d\n" ,value); |
bousiya03 | 0:13afa59109be | 53 | |
bousiya03 | 0:13afa59109be | 54 | for(;;); |
bousiya03 | 0:13afa59109be | 55 | |
bousiya03 | 0:13afa59109be | 56 | } |