uart.h
38 lines
| 582 B
| text/x-c
|
CLexer
|
r132 | /* | ||
* uart.h | ||||
* code based on: | ||||
* http://www.raspberry-projects.com/pi/programming-in-c/uart-serial-port/using-the-uart | ||||
* Created on: Oct 16, 2014 | ||||
* Author: Alan Aguilar Sologuren | ||||
*/ | ||||
#ifndef UTILS_UART_H_ | ||||
#define UTILS_UART_H_ | ||||
#include <unistd.h> | ||||
#include <stdint.h> | ||||
namespace rbp { | ||||
class uart { | ||||
public: | ||||
uart(uint32_t, int); | ||||
virtual ~uart(); | ||||
ssize_t receive(uint8_t*); | ||||
ssize_t transmit(uint8_t*, size_t); | ||||
private: | ||||
int fs; | ||||
uint8_t *rx_buffer; | ||||
uint8_t *tx_buffer; | ||||
size_t buffsize; | ||||
bool setup(uint32_t); | ||||
}; | ||||
} /* namespace rbp */ | ||||
#endif /* UTILS_UART_H_ */ | ||||