mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2025-08-07 14:02:13 -04:00
Implement Serial
This commit is contained in:
parent
d01a4b293f
commit
04c8523619
3 changed files with 55 additions and 18 deletions
8
LoRa.cpp
8
LoRa.cpp
|
@ -125,8 +125,10 @@ int LoRaClass::begin(long frequency)
|
|||
// start SPI
|
||||
SPI.begin();
|
||||
#elif LIBRARY_TYPE == LIBRARY_C
|
||||
_fd = open("/dev/spidev0.0", O_RDWR);
|
||||
if (_fd < 0) {
|
||||
const char* spi_filename = "/dev/spidev0.0";
|
||||
std::cerr << "Opening SPI device " << spi_filename << std::endl;
|
||||
_fd = open(spi_filename, O_RDWR);
|
||||
if (_fd <= 0) {
|
||||
perror("could not open SPI device");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -703,6 +705,8 @@ uint8_t ISR_VECT LoRaClass::singleTransfer(uint8_t address, uint8_t value)
|
|||
|
||||
int status;
|
||||
|
||||
std::cerr << "Access SPI at " << _fd << std::endl;
|
||||
|
||||
// Configure SPI speed and mode to match settings
|
||||
status = ioctl(_fd, SPI_IOC_WR_MODE, &_spiSettings.mode);
|
||||
if (status < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue