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.
Dependencies: mbed TrapezoidControl QEI
RS485.cpp
00001 #include "RS485.h" 00002 #include "mbed.h" 00003 #include "ActuatorHub/ActuatorHub.h" 00004 #include "../../LED/LED.h" 00005 #include "../../System/Using.h" 00006 00007 namespace RS485 { 00008 DigitalOut selectBit(SELECTBIT_PIN); 00009 Serial RS485Uart(RS485UART_TX, RS485UART_RX); 00010 00011 void Transmit(); 00012 00013 void RS485::Initialize() { 00014 selectBit = 1; //送信固定 00015 RS485Uart.baud(38400); 00016 RS485Uart.attach(Transmit, Serial::TxIrq); 00017 } 00018 00019 void Transmit() { 00020 static uint8_t count = 0; 00021 __disable_irq(); 00022 RS485Uart.putc(RS485SendBuffer.GetData()); 00023 if(count >= 200) { 00024 #ifdef USE_MOTOR 00025 LED_DEBUG2 = !LED_DEBUG2; 00026 #endif 00027 00028 count = 0; 00029 } else count++; 00030 __enable_irq(); 00031 } 00032 }
Generated on Tue Jul 12 2022 18:33:28 by
1.7.2