Saya Matsuura
/
drum
明石高専ロボ研 drum
Diff: scrp_slave.cpp
- Revision:
- 3:28c77df7c0b6
- Parent:
- 2:141358d84ff4
- Child:
- 4:39ef4d91dc34
--- a/scrp_slave.cpp Fri Jan 03 02:37:48 2020 +0000 +++ b/scrp_slave.cpp Mon Jan 06 11:06:26 2020 +0000 @@ -16,8 +16,7 @@ ScrpSlave::ScrpSlave(PinName TX1,PinName RX1,PinName TX2,PinName RX2,uint32_t addr):address_(addr){ mode_ = 2; - serial_[1] = new Serial(TX2,RX2); - serial_[1]->baud(115200); + serial_[1] = new Serial(TX2,RX2,115200); serial_[1]->attach(callback(this,&ScrpSlave::port2),Serial::RxIrq); init(TX1,RX1); } @@ -25,8 +24,7 @@ ScrpSlave::ScrpSlave(PinName TX1,PinName RX1,PinName REDE1,PinName TX2,PinName RX2,uint32_t addr):address_(addr){ mode_ = 3; rede_ = new DigitalOut(REDE1,0); - serial_[1] = new Serial(TX2,RX2); - serial_[1]->baud(115200); + serial_[1] = new Serial(TX2,RX2,115200); serial_[1]->attach(callback(this,&ScrpSlave::port2),Serial::RxIrq); init(TX1,RX1); } @@ -38,8 +36,7 @@ stx_flag_[i] = false; id_ok_[i] = false; } - serial_[0] = new Serial(TX,RX); - serial_[0]->baud(115200); + serial_[0] = new Serial(TX,RX,115200); serial_[0]->attach(callback(this,&ScrpSlave::port1),Serial::RxIrq); flash_ = new FlashIAP; if(flash_->init()==0){ @@ -104,7 +101,7 @@ for(int i = 0;i < 8;i++){ serial_[port]->putc(data[i]); while(!serial_[port]->writeable()); - } + } if(mode_%2 == 1 && port == 0){ rede_->write(0); }