Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 20:eae8c84f318c, committed 2019-08-27
- Comitter:
- M_souta
- Date:
- Tue Aug 27 04:33:08 2019 +0000
- Parent:
- 19:96a462583af9
- Child:
- 21:e3b58d675c1c
- Commit message:
- ttsts
Changed in this revision
--- a/Communication/RS485/RS485.cpp Tue Jul 16 06:48:51 2019 +0000 +++ b/Communication/RS485/RS485.cpp Tue Aug 27 04:33:08 2019 +0000 @@ -5,20 +5,26 @@ #include "../../System/Using.h" namespace RS485 { - DigitalOut selectBit(SELECTBIT_PIN); + DigitalOut selectBitT(SELECTBIT_T_PIN); + DigitalOut selectBitR(SELECTBIT_R_PIN); Serial RS485Uart(RS485UART_TX, RS485UART_RX); + Serial RS485Line(RS485LINE_TX, RS485LINE_RX); void Transmit(); + void Recieve(); void RS485::Initialize() { - selectBit = 1; //送信固定 + selectBitT = 1; //送信固定 + selectBitR = 0; //受信固定 RS485Uart.baud(38400); - RS485Uart.attach(Transmit, Serial::TxIrq); + RS485Uart.attach(Transmit, Serial::TxIrq); //送信割り込み + RS485Line.baud(38400); + RS485Line.attach(Recieve, Serial::RxIrq); //受信割り込み } void Transmit() { + __disable_irq(); static uint8_t count = 0; - __disable_irq(); RS485Uart.putc(RS485SendBuffer.GetData()); if(count >= 200) { #ifdef USE_MOTOR @@ -29,4 +35,15 @@ } else count++; __enable_irq(); } + + void Recieve() { + static uint8_t count = 0; + __disable_irq(); + char data = RS485Line.getc(); + if(count >= 200) { + LED_DEBUG1 = !LED_DEBUG1; + count = 0; + } else count++; + __enable_irq(); + } }
--- a/Communication/RS485/RS485.h Tue Jul 16 06:48:51 2019 +0000 +++ b/Communication/RS485/RS485.h Tue Aug 27 04:33:08 2019 +0000 @@ -2,10 +2,13 @@ #define RS485_H_ namespace RS485 { - #define SELECTBIT_PIN PB_7 + #define SELECTBIT_T_PIN PB_3 + #define SELECTBIT_R_PIN PA_5 #define RS485UART_TX PA_9 #define RS485UART_RX PA_10 + #define RS485LINE_TX PC_10 + #define RS485LINE_RX PC_11 class RS485 { public:
--- a/System/Process/Process.cpp Tue Jul 16 06:48:51 2019 +0000 +++ b/System/Process/Process.cpp Tue Aug 27 04:33:08 2019 +0000 @@ -62,6 +62,23 @@ Ticker tapeLedTimer; //************TapaLed***************** +/*************LineHub**************** +Serial linehubUart(PC_10,PC_11); +char data[6]; + +void LineRead() +{ + //__disable_irq(); + if(linehubUart.readable()) { + for(int i=0; i<=5; i++) { + data[i] = linehubUart.getc(); + } + } + //__enable_irq(); +} + +//*************LineHub****************/ + float tireProRPM[4]; float tireTarRPM[4]; float tirePWM[4]; @@ -187,6 +204,9 @@ while(1) { + + pc.printf("aaa\n\r"); + if(LimitSw::IsPressed(10)) { LED_DEBUG0 = LED_ON; } else {