++

Fork of mbed-stm32l0/l1-src by lzbp li

Revision:
563:536c9fb088a0
Parent:
552:a1b9575155a3
--- a/common/SPI.cpp	Tue Jun 09 15:30:08 2015 +0100
+++ b/common/SPI.cpp	Wed Jun 10 10:00:08 2015 +0100
@@ -68,7 +68,7 @@
 
 #if DEVICE_SPI_ASYNCH
 
-int SPI::transfer(void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
+int SPI::transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
 {
     if (spi_active(&_spi)) {
         return queue_transfer(tx_buffer, tx_length, rx_buffer, rx_length, bit_width, callback, event);
@@ -108,12 +108,12 @@
     return  0;
 }
 
-int SPI::queue_transfer(void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
+int SPI::queue_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
 {
 #if TRANSACTION_QUEUE_SIZE_SPI
     transaction_t t;
 
-    t.tx_buffer = tx_buffer;
+    t.tx_buffer = const_cast<void *>(tx_buffer);
     t.tx_length = tx_length;
     t.rx_buffer = rx_buffer;
     t.rx_length = rx_length;
@@ -132,7 +132,7 @@
 #endif
 }
 
-void SPI::start_transfer(void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
+void SPI::start_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t& callback, int event)
 {
     aquire();
     _callback = callback;