Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SX1276GenericLib by
Diff: sx1276/sx1276-mbed-hal.cpp
- Revision:
- 51:aef3234bcb71
- Parent:
- 46:e78a1d0391ac
- Child:
- 53:6d3adad59633
diff -r 43f7160e869c -r aef3234bcb71 sx1276/sx1276-mbed-hal.cpp
--- a/sx1276/sx1276-mbed-hal.cpp Tue May 16 17:51:21 2017 +0200
+++ b/sx1276/sx1276-mbed-hal.cpp Wed May 17 15:40:13 2017 +0200
@@ -392,38 +392,40 @@
return data;
}
-void SX1276Generic::Write( uint8_t addr, uint8_t *buffer, uint8_t size )
+void SX1276Generic::Write( uint8_t addr, void *buffer, uint8_t size )
{
uint8_t i;
+ uint8_t *p = (uint8_t *)buffer;
*_nss = 0; // what about SPI hold/release timing on fast MCUs? Helmut
_spi->write( addr | 0x80 );
for( i = 0; i < size; i++ )
{
- _spi->write( buffer[i] );
+ _spi->write(*p++);
}
*_nss = 1;
}
-void SX1276Generic::Read( uint8_t addr, uint8_t *buffer, uint8_t size )
+void SX1276Generic::Read( uint8_t addr, void *buffer, uint8_t size )
{
uint8_t i;
-
+ uint8_t *p = (uint8_t *)buffer;
+
*_nss = 0; // what about SPI hold/release timing on fast MCUs? Helmut
_spi->write( addr & 0x7F );
for( i = 0; i < size; i++ )
{
- buffer[i] = _spi->write( 0 );
+ *p++ = _spi->write( 0 );
}
*_nss = 1;
}
-void SX1276Generic::WriteFifo( uint8_t *buffer, uint8_t size )
+void SX1276Generic::WriteFifo( void *buffer, uint8_t size )
{
Write( 0, buffer, size );
}
-void SX1276Generic::ReadFifo( uint8_t *buffer, uint8_t size )
+void SX1276Generic::ReadFifo( void *buffer, uint8_t size )
{
Read( 0, buffer, size );
}
