#author("2021-12-05T14:24:56+09:00","default:Real2Virtual202111","Real2Virtual202111")
#author("2021-12-05T16:27:37+09:00","default:Real2Virtual202111","Real2Virtual202111")
[[Real2Virtual202111]]

#code(c){{
//#ifndef INBUFFER_H
//#define INBUFFER_H
#pragma once

#include "common.h"
/* 
class CommandBuffer{
    public:
        ackReturned(unsigned char faceID);
        putQueue(unsigned char faceID, char *x, int len);
        putChar(unsigned char faceID, char x);
}
 */
#include "CommandBuffer.h"
class CommandBuffer;

class InBuffer{
private:
   unsigned char faceID;         /* input channel ID */
   unsigned char (*getPort)(void); /* get port value (photo tr input) */
   void (*setPortMode)(unsigned char s); /* set portmode 0...output, 1...input */
   unsigned char now;               /* current input */
   unsigned char last;              /* last input */
   unsigned char p;                 /* current input bits position*/
//   volatile unsigned char bits[MaxBits/8+1];          /* sampled binary input sequence */
   unsigned char bits[MaxBits];          /* sampled binary input sequence */
   unsigned char status;            /* 0:waiting for the input  1: reading  2:stop 3: input with over writing */
   unsigned char sampleInterval;           /* sampling interval for the timer interrupt*/
   unsigned char sampleIntervalCounter; /* counter for the sampling interval of the timer interrupt */
   unsigned char sampleIntForDecode;    /* sampling interval for the bits*/
   unsigned char cin;
   int inlen;
   char inputBuffer[MaxInterFaceStrLen]; /* serial input command buffer */
   unsigned char nextDoorDirection;
   unsigned char correspondingLEDNo;
   unsigned char nextDoorFaceID;
   unsigned char connected;
   CommandBuffer *command;
   unsigned char cbp; /* command buffer pointer */
public:
   InBuffer(unsigned char id, CommandBuffer *com);
   void setPortConf( unsigned char (*getfun)(void), void (* modefun)(unsigned char x)); /* set the input port*/
   void intrProcess(void);  /* interrupt process */
   void setStatus( unsigned char x); /* */
   unsigned char getStatus(void);
   unsigned char decode(void);       /* decode the bits into char */
   unsigned char getChar(void);      /* get the char , if it is 0 then, no input*/
   unsigned char getConnected(void);
   int getNextDoorDirection(void);
   void parse(unsigned char c); /* serial input parser (L2)*/
   unsigned char startWith(char *c);
   void shiftLeft( unsigned char i);
   void returnAck(void);
   void setCommand(CommandBuffer *x);
   void setConnected(unsigned char x);
}; 
//#endif

}}
----
#counter



トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS