Silicon Laboratories Stepper Machine Instrukcja Użytkownika Strona 32

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 36
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 31
AN155
32 Rev. 1.1
}
return i; // return uchar value
}
//-----------------------------------------------------------------------------
void newline(void) // normally cr and lf are used together
{
putc('\r'); // output carriage return
putc('\n'); // output linefeed
}
//-----------------------------------------------------------------------------
// getc
// Gets a character from the read buffer using readc().
// The getc() function also echos the incoming keystrokes to the display;
//
char getc(void)
{
char theChar;
theChar=readc(); // get character using readc
writec(theChar); // echo characters to display
return theChar;
}
//-----------------------------------------------------------------------------
// putc
// This is a totally unnecessary layer of abstraction. It is only used to be
// consistent with the getc function which requires an additional layer of
// abstraction to handle character echo.
//
void putc(char theChar)
{
writec(theChar);
}
//-----------------------------------------------------------------------------
void readClear(void) // clears read buffer
{
unsigned char i;
readCount=0;
readIndex=0;
i = READ_BUFFER_SIZE;
do
{
i--; // predecrement
readBuffer[i]=0; // zero all data
} while (i != 0);
}
//-----------------------------------------------------------------------------
void writeClear(void) // clears write buffer
{
unsigned char i;
writeCount=0;
writeIndex=0;
i = WRITE_BUFFER_SIZE;
do
{
i--; // predecrement
writeBuffer[i]=0; // zero all data
} while (i != 0);
}
//-----------------------------------------------------------------------------
Przeglądanie stron 31
1 2 ... 27 28 29 30 31 32 33 34 35 36

Komentarze do niniejszej Instrukcji

Brak uwag