Digole Display Driver
Display driver for Digole Serial OLED/LCD displays
Functions
io

Functions

int writen (int fd, unsigned char *ptr, int nbytes)
 write n bytes of data to a file descriptor
int readn (int fd, unsigned char *ptr, int nbytes)
 read n bytes of data from a file descriptor

Function Documentation

int readn ( int  fd,
unsigned char *  ptr,
int  nbytes 
)

read n bytes of data from a file descriptor

On Linux, since read is not guaranteed to read all of the bytes available in one call, we continously read the specified number of bytes from the descriptor into the data buffer provided.

Parameters:
[in]fdthe file descriptor to read from
[in,out]ptrthe address of the data buffer to read into
[in]nbytesthe number of bytes to read
Returns:
number of bytes successfully read
int writen ( int  fd,
unsigned char *  ptr,
int  nbytes 
)

write n bytes of data to a file descriptor

On Linux, since write is not guaranteed to write all of the bytes provided, we keep track of the number of bytes written and retry sending the data as needed.

Parameters:
[in]fdthe file descriptor to write to
[in]ptrthe address of the data buffer to write
[in]nbytesthe number of bytes to write
Returns:
number of bytes successfully written
 All Files Functions