LPC824専用プログラム

Dependencies:   Ping SDFileSystem mbed-src

main.h

Committer:
lilac0112_1
Date:
2015-12-31
Revision:
1:7070fb876a2c
Parent:
0:2f48b11b154f
Child:
2:9a51bb2694aa

File content as of revision 1:7070fb876a2c:

#ifndef _MAIN_H_
#define _MAIN_H_

#include "def.h"

//SDカード管理用
#ifdef SD_CARD
static PinName const TX_PIN = dp10;
static PinName const RX_PIN = dp11;
Serial pc(TX_PIN, RX_PIN);

static PinName const SD_MOSI = dp15;
static PinName const SD_MISO = dp16;
static PinName const SD_SCLK = dp17;
static PinName const SD_CS = dp18;
SDFileSystem sd(SD_MOSI, SD_MISO, SD_SCLK, SD_CS, "sd");

static PinName const MOSI = dp15;
static PinName const MISO = dp16;
static PinName const SCLK = dp17;
static PinName const SSEL = dp18;
SPISlave nucleo(MOSI, MISO, SCLK, SSEL);
#endif /*SD_CARD*/

//超音波用
#ifdef ULTRA_SONIC
static PinName const TX_PIN = dp10;
static PinName const RX_PIN = dp11;
Serial pc(TX_PIN, RX_PIN);

static PinName const FRONT = D11;
static PinName const REAR = D12;
Ping rear(REAR);
Ping front(FRONT);

static PinName const MOSI = dp15;
static PinName const MISO = dp16;
static PinName const SCLK = dp17;
static PinName const SSEL = dp18;
SPISlave nucleo(MOSI, MISO, SCLK, SSEL);
#endif /*ULTRA_SONIC*/

//カラーセンサ用
#ifdef COLOR_SENSOR
static PinName const TX_PIN = dp10;
static PinName const RX_PIN = dp11;
Serial pc(TX_PIN, RX_PIN);


static PinName const COLOR00 = dp23;
static PinName const COLOR01 = dp22;
static PinName const COLOR02 = dp21;

static PinName const COLOR10 = dp23;
static PinName const COLOR11 = dp22;
static PinName const COLOR12 = dp21;

static PinName const COLOR20 = dp23;
static PinName const COLOR21 = dp22;
static PinName const COLOR22 = dp21;
AnalogIn ColorSensor[SENSOR_NUM][3] = {{COLOR00, COLOR01, COLOR02}, {COLOR10, COLOR11, COLOR12}, {COLOR20, COLOR21, COLOR22}};

static PinName const MOSI = dp15;
static PinName const MISO = dp16;
static PinName const SCLK = dp17;
static PinName const SSEL = dp18;
SPISlave nucleo(MOSI, MISO, SCLK, SSEL);
#endif /*COLOR_SENSOR*/

//IRセンサー用
#ifdef IR_SENSOR
static PinName const TX_PIN = dp10;
static PinName const RX_PIN = dp11;
Serial pc(TX_PIN, RX_PIN);

static PinName const IR_MOSI = dp15;
static PinName const IR_MISO = dp16;
static PinName const IR_SCLK = dp17;
static PinName const IR0_CS = dp18;
static PinName const IR1_CS = dp19;
static PinName const IR2_CS = dp20;

SPI ir(IR_MOSI, IR_MISO, IR_SCLK);
DigitalOut cs[IC_NUM] = {IR0_CS, IR1_CS, IR2_CS};

static PinName const MOSI = dp15;
static PinName const MISO = dp16;
static PinName const SCLK = dp17;
static PinName const SSEL = dp18;
SPISlave nucleo(MOSI, MISO, SCLK, SSEL);
#endif /*IR_SENSOR*/

#endif /*_MAIN_H_*/