LPC824専用プログラム
Dependencies: Ping SDFileSystem mbed-src
main.h@16:f0d3e58b3ca5, 2016-02-25 (annotated)
- Committer:
- lilac0112_1
- Date:
- Thu Feb 25 06:17:49 2016 +0000
- Revision:
- 16:f0d3e58b3ca5
- Parent:
- 12:c90a124169e6
Hokushinetsu(SubCPU)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lilac0112_1 | 0:2f48b11b154f | 1 | #ifndef _MAIN_H_ |
lilac0112_1 | 0:2f48b11b154f | 2 | #define _MAIN_H_ |
lilac0112_1 | 0:2f48b11b154f | 3 | |
lilac0112_1 | 0:2f48b11b154f | 4 | #include "def.h" |
lilac0112_1 | 0:2f48b11b154f | 5 | |
lilac0112_1 | 3:410a2812b0dc | 6 | //PinConfig |
lilac0112_1 | 3:410a2812b0dc | 7 | |
lilac0112_1 | 3:410a2812b0dc | 8 | //SDカード管理用(20pin) |
lilac0112_1 | 0:2f48b11b154f | 9 | #ifdef SD_CARD |
lilac0112_1 | 3:410a2812b0dc | 10 | |
lilac0112_1 | 3:410a2812b0dc | 11 | static PinName const monitor_tx = P0_4; |
lilac0112_1 | 3:410a2812b0dc | 12 | static PinName const monitor_rx = P0_0; |
lilac0112_1 | 3:410a2812b0dc | 13 | |
lilac0112_1 | 3:410a2812b0dc | 14 | static PinName const write_RXD = P0_0; |
lilac0112_1 | 3:410a2812b0dc | 15 | static PinName const write_TXD = P0_4; |
lilac0112_1 | 3:410a2812b0dc | 16 | static PinName const write_RESET = P0_5; |
lilac0112_1 | 3:410a2812b0dc | 17 | static PinName const write_ISP = P0_12; |
lilac0112_1 | 0:2f48b11b154f | 18 | |
lilac0112_1 | 3:410a2812b0dc | 19 | static PinName const SPI_MOSI = P0_23; |
lilac0112_1 | 3:410a2812b0dc | 20 | static PinName const SPI_MISO = P0_17; |
lilac0112_1 | 3:410a2812b0dc | 21 | static PinName const SPI_SCLK = P0_13; |
lilac0112_1 | 3:410a2812b0dc | 22 | static PinName const SPI_CS = P0_0; |
lilac0112_1 | 0:2f48b11b154f | 23 | |
lilac0112_1 | 3:410a2812b0dc | 24 | static PinName const SD_MISO = P0_1; |
lilac0112_1 | 3:410a2812b0dc | 25 | static PinName const SD_MOSI = P0_10; |
lilac0112_1 | 3:410a2812b0dc | 26 | static PinName const SD_SCK = P0_15; |
lilac0112_1 | 3:410a2812b0dc | 27 | static PinName const SD_CS = P0_11; |
lilac0112_1 | 3:410a2812b0dc | 28 | static PinName const SD_SW = P0_14; |
lilac0112_1 | 3:410a2812b0dc | 29 | |
lilac0112_1 | 3:410a2812b0dc | 30 | Serial pc(monitor_tx, monitor_rx); |
lilac0112_1 | 3:410a2812b0dc | 31 | SPISlave nucleo(SPI_MOSI, SPI_MISO, SPI_SCLK, SPI_CS); |
lilac0112_1 | 3:410a2812b0dc | 32 | SDFileSystem sd(SD_MOSI, SD_MISO, SD_SCK, SD_CS, "sd"); |
lilac0112_1 | 3:410a2812b0dc | 33 | DigitalIn SdSwitch(SD_SW); |
lilac0112_1 | 0:2f48b11b154f | 34 | #endif /*SD_CARD*/ |
lilac0112_1 | 0:2f48b11b154f | 35 | |
lilac0112_1 | 3:410a2812b0dc | 36 | //超音波用(20pin) |
lilac0112_1 | 0:2f48b11b154f | 37 | #ifdef ULTRA_SONIC |
lilac0112_1 | 3:410a2812b0dc | 38 | |
lilac0112_1 | 3:410a2812b0dc | 39 | static PinName const monitor_tx = P0_4; |
lilac0112_1 | 3:410a2812b0dc | 40 | static PinName const monitor_rx = P0_0; |
lilac0112_1 | 3:410a2812b0dc | 41 | |
lilac0112_1 | 3:410a2812b0dc | 42 | static PinName const write_rx = P0_0; |
lilac0112_1 | 3:410a2812b0dc | 43 | static PinName const write_tx = P0_4; |
lilac0112_1 | 3:410a2812b0dc | 44 | static PinName const write_reset = P0_5; |
lilac0112_1 | 3:410a2812b0dc | 45 | static PinName const write_isp = P0_12; |
lilac0112_1 | 0:2f48b11b154f | 46 | |
lilac0112_1 | 3:410a2812b0dc | 47 | static PinName const SPI_mosi = P0_10; |
lilac0112_1 | 8:a2eadba03040 | 48 | static PinName const SPI_miso = P0_11; |
lilac0112_1 | 3:410a2812b0dc | 49 | static PinName const SPI_slck = P0_1; |
lilac0112_1 | 8:a2eadba03040 | 50 | static PinName const SPI_ss_sonic = P0_15; |
lilac0112_1 | 3:410a2812b0dc | 51 | |
lilac0112_1 | 3:410a2812b0dc | 52 | static PinName const Sonic1_echo = P0_23; |
lilac0112_1 | 3:410a2812b0dc | 53 | static PinName const Sonic2_echo = P0_17; |
lilac0112_1 | 0:2f48b11b154f | 54 | |
lilac0112_1 | 3:410a2812b0dc | 55 | static PinName const led_umr1 = P0_14; |
lilac0112_1 | 3:410a2812b0dc | 56 | static PinName const led_umr2 = P0_13; |
lilac0112_1 | 3:410a2812b0dc | 57 | |
lilac0112_1 | 3:410a2812b0dc | 58 | Serial pc(monitor_tx, monitor_rx); |
lilac0112_1 | 3:410a2812b0dc | 59 | SPISlave nucleo(SPI_mosi, SPI_miso, SPI_slck, SPI_ss_sonic); |
lilac0112_1 | 9:7f98d4415425 | 60 | InterruptIn call(SPI_ss_sonic); |
lilac0112_1 | 3:410a2812b0dc | 61 | Ping rear(Sonic1_echo); |
lilac0112_1 | 3:410a2812b0dc | 62 | Ping front(Sonic2_echo); |
lilac0112_1 | 3:410a2812b0dc | 63 | DigitalOut led[2]={led_umr1, led_umr2}; |
lilac0112_1 | 3:410a2812b0dc | 64 | |
lilac0112_1 | 0:2f48b11b154f | 65 | #endif /*ULTRA_SONIC*/ |
lilac0112_1 | 0:2f48b11b154f | 66 | |
lilac0112_1 | 3:410a2812b0dc | 67 | //カラーセンサ用(33pin?) |
lilac0112_1 | 0:2f48b11b154f | 68 | #ifdef COLOR_SENSOR |
lilac0112_1 | 0:2f48b11b154f | 69 | static PinName const TX_PIN = dp10; |
lilac0112_1 | 0:2f48b11b154f | 70 | static PinName const RX_PIN = dp11; |
lilac0112_1 | 0:2f48b11b154f | 71 | Serial pc(TX_PIN, RX_PIN); |
lilac0112_1 | 0:2f48b11b154f | 72 | |
lilac0112_1 | 0:2f48b11b154f | 73 | |
lilac0112_1 | 0:2f48b11b154f | 74 | static PinName const COLOR00 = dp23; |
lilac0112_1 | 0:2f48b11b154f | 75 | static PinName const COLOR01 = dp22; |
lilac0112_1 | 0:2f48b11b154f | 76 | static PinName const COLOR02 = dp21; |
lilac0112_1 | 0:2f48b11b154f | 77 | |
lilac0112_1 | 0:2f48b11b154f | 78 | static PinName const COLOR10 = dp23; |
lilac0112_1 | 0:2f48b11b154f | 79 | static PinName const COLOR11 = dp22; |
lilac0112_1 | 0:2f48b11b154f | 80 | static PinName const COLOR12 = dp21; |
lilac0112_1 | 0:2f48b11b154f | 81 | |
lilac0112_1 | 0:2f48b11b154f | 82 | static PinName const COLOR20 = dp23; |
lilac0112_1 | 0:2f48b11b154f | 83 | static PinName const COLOR21 = dp22; |
lilac0112_1 | 0:2f48b11b154f | 84 | static PinName const COLOR22 = dp21; |
lilac0112_1 | 2:9a51bb2694aa | 85 | AnalogIn ColorSensor[SENSOR_X_COLOR] = {COLOR00, COLOR01, COLOR02, COLOR10, COLOR11, COLOR12, COLOR20, COLOR21, COLOR22}; |
lilac0112_1 | 0:2f48b11b154f | 86 | |
lilac0112_1 | 0:2f48b11b154f | 87 | static PinName const MOSI = dp15; |
lilac0112_1 | 0:2f48b11b154f | 88 | static PinName const MISO = dp16; |
lilac0112_1 | 0:2f48b11b154f | 89 | static PinName const SCLK = dp17; |
lilac0112_1 | 0:2f48b11b154f | 90 | static PinName const SSEL = dp18; |
lilac0112_1 | 0:2f48b11b154f | 91 | SPISlave nucleo(MOSI, MISO, SCLK, SSEL); |
lilac0112_1 | 0:2f48b11b154f | 92 | #endif /*COLOR_SENSOR*/ |
lilac0112_1 | 0:2f48b11b154f | 93 | |
lilac0112_1 | 3:410a2812b0dc | 94 | //IRセンサー用(33pin) |
lilac0112_1 | 0:2f48b11b154f | 95 | #ifdef IR_SENSOR |
lilac0112_1 | 8:a2eadba03040 | 96 | static PinName const monitor_tx = P0_4; |
lilac0112_1 | 8:a2eadba03040 | 97 | static PinName const monitor_rx = P0_0; |
lilac0112_1 | 8:a2eadba03040 | 98 | //static PinName const monitor_tx = USBTX; |
lilac0112_1 | 8:a2eadba03040 | 99 | //static PinName const monitor_rx = USBRX; |
lilac0112_1 | 3:410a2812b0dc | 100 | |
lilac0112_1 | 3:410a2812b0dc | 101 | static PinName const write_rx = P0_0; |
lilac0112_1 | 3:410a2812b0dc | 102 | static PinName const write_tx = P0_4; |
lilac0112_1 | 3:410a2812b0dc | 103 | static PinName const write_reset = P0_5; |
lilac0112_1 | 3:410a2812b0dc | 104 | static PinName const write_isp = P0_12; |
lilac0112_1 | 0:2f48b11b154f | 105 | |
lilac0112_1 | 12:c90a124169e6 | 106 | static PinName const SPI_mosi = P0_27; |
lilac0112_1 | 12:c90a124169e6 | 107 | static PinName const SPI_miso = P0_16; |
lilac0112_1 | 12:c90a124169e6 | 108 | static PinName const SPI_sclk = P0_11; |
lilac0112_1 | 12:c90a124169e6 | 109 | static PinName const SPI_ss_ir = P0_10; |
lilac0112_1 | 0:2f48b11b154f | 110 | |
lilac0112_1 | 12:c90a124169e6 | 111 | static PinName const din = P0_24; |
lilac0112_1 | 12:c90a124169e6 | 112 | static PinName const dout = P0_25; |
lilac0112_1 | 12:c90a124169e6 | 113 | static PinName const clk = P0_15; |
lilac0112_1 | 12:c90a124169e6 | 114 | static PinName const cs3 = P0_6; |
lilac0112_1 | 12:c90a124169e6 | 115 | static PinName const cs2 = P0_7; |
lilac0112_1 | 12:c90a124169e6 | 116 | static PinName const cs1 = P0_1; |
lilac0112_1 | 12:c90a124169e6 | 117 | static PinName const ir_vcc = P0_26; |
lilac0112_1 | 0:2f48b11b154f | 118 | |
lilac0112_1 | 3:410a2812b0dc | 119 | Serial pc(monitor_tx, monitor_rx); |
lilac0112_1 | 3:410a2812b0dc | 120 | SPISlave nucleo(SPI_mosi, SPI_miso, SPI_sclk, SPI_ss_ir); |
lilac0112_1 | 9:7f98d4415425 | 121 | InterruptIn call(SPI_ss_ir); |
lilac0112_1 | 3:410a2812b0dc | 122 | SPI ir(din, dout, clk); |
lilac0112_1 | 3:410a2812b0dc | 123 | DigitalOut cs[IC_NUM] = {cs1, cs2, cs3}; |
lilac0112_1 | 9:7f98d4415425 | 124 | PwmOut supply(ir_vcc); |
lilac0112_1 | 0:2f48b11b154f | 125 | #endif /*IR_SENSOR*/ |
lilac0112_1 | 0:2f48b11b154f | 126 | |
lilac0112_1 | 0:2f48b11b154f | 127 | #endif /*_MAIN_H_*/ |