aa

Dependencies:   mbed TrapezoidControl QEI

Committer:
yabahiro
Date:
Wed Oct 02 01:53:59 2019 +0000
Revision:
43:677f7446612e
Parent:
21:1f1e9c585da8
yey

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yabahiro 21:1f1e9c585da8 1 #include "mbed.h"
yabahiro 21:1f1e9c585da8 2 #include "LineHub.h"
yabahiro 21:1f1e9c585da8 3 #include "../../../CommonLibraries/RingBuffer/RingBuffer.h"
yabahiro 21:1f1e9c585da8 4 #include "../../../System/Process/Process.h"
yabahiro 21:1f1e9c585da8 5 #include "../../../System/Using.h"
yabahiro 21:1f1e9c585da8 6
yabahiro 21:1f1e9c585da8 7 static char RS485Line[RS485_BUFFER_LINE];
yabahiro 21:1f1e9c585da8 8 RINGBUFFER::RingBuffer RS485LineBuffer = RINGBUFFER::RingBuffer(RS485Line, RS485_BUFFER_LINE);
yabahiro 21:1f1e9c585da8 9
yabahiro 21:1f1e9c585da8 10 int lineData[8];
yabahiro 21:1f1e9c585da8 11
yabahiro 21:1f1e9c585da8 12 namespace LINEHUB {
yabahiro 21:1f1e9c585da8 13
yabahiro 21:1f1e9c585da8 14
yabahiro 21:1f1e9c585da8 15 void LineHub::Initialize() {
yabahiro 21:1f1e9c585da8 16 for(int i = 0; i < 8; i++) {
yabahiro 21:1f1e9c585da8 17 lineData[i] = 0;
yabahiro 21:1f1e9c585da8 18 }
yabahiro 21:1f1e9c585da8 19
yabahiro 21:1f1e9c585da8 20 }
yabahiro 21:1f1e9c585da8 21
yabahiro 21:1f1e9c585da8 22 void LineHub::Update() {
yabahiro 21:1f1e9c585da8 23 if(RS485LineBuffer.IsFullup()) {
yabahiro 21:1f1e9c585da8 24 for(int i = 0; i < 8; i++) {
yabahiro 21:1f1e9c585da8 25 lineData[i] = (int)RS485LineBuffer.GetData();
yabahiro 21:1f1e9c585da8 26 }
yabahiro 21:1f1e9c585da8 27 }
yabahiro 21:1f1e9c585da8 28 }
yabahiro 21:1f1e9c585da8 29
yabahiro 21:1f1e9c585da8 30 int LineHub::GetPara(int num) {
yabahiro 21:1f1e9c585da8 31 return lineData[num];
yabahiro 21:1f1e9c585da8 32 }
yabahiro 21:1f1e9c585da8 33 }