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.
Diff: Communication/RS485/LineHub/LineHub.cpp
- Revision:
- 21:e3b58d675c1c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Communication/RS485/LineHub/LineHub.cpp Mon Sep 09 00:19:28 2019 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" +#include "LineHub.h" +#include "../../../CommonLibraries/RingBuffer/RingBuffer.h" +#include "../../../System/Process/Process.h" +#include "../../../System/Using.h" + +static char RS485Line[RS485_BUFFER_LINE]; +RINGBUFFER::RingBuffer RS485LineBuffer = RINGBUFFER::RingBuffer(RS485Line, RS485_BUFFER_LINE); + +int lineData[8]; + +namespace LINEHUB { + + + void LineHub::Initialize() { + for(int i = 0; i < 8; i++) { + lineData[i] = 0; + } + + } + + void LineHub::Update() { + if(RS485LineBuffer.IsFullup()) { + for(int i = 0; i < 8; i++) { + lineData[i] = (int)RS485LineBuffer.GetData(); + } + } + } + + int LineHub::GetPara(int num) { + return lineData[num]; + } +} \ No newline at end of file