Serial - constness for tx

pull/1169/head
0xc0170 2015-06-09 10:02:11 +01:00
parent e7feba4e21
commit 3ae6d045ee
4 changed files with 9 additions and 9 deletions

View File

@ -135,7 +135,7 @@ public:
* @param callback The event callback function
* @param event The logical OR of TX events
*/
int write(uint8_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_TX_COMPLETE);
int write(const uint8_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_TX_COMPLETE);
/** Begin asynchronous write using 16bit buffer. The completition invokes registered TX event callback
*
@ -144,7 +144,7 @@ public:
* @param callback The event callback function
* @param event The logical OR of TX events
*/
int write(uint16_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_TX_COMPLETE);
int write(const uint16_t *buffer, int length, const event_callback_t& callback, int event = SERIAL_EVENT_TX_COMPLETE);
/** Abort the on-going write transfer
*/
@ -190,7 +190,7 @@ public:
protected:
void start_read(void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event, unsigned char char_match);
void start_write(void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event);
void start_write(const void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event);
void interrupt_handler_asynch(void);
#endif

View File

@ -110,7 +110,7 @@ void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2) {
#if DEVICE_SERIAL_ASYNCH
int SerialBase::write(uint8_t *buffer, int length, const event_callback_t& callback, int event)
int SerialBase::write(const uint8_t *buffer, int length, const event_callback_t& callback, int event)
{
if (serial_tx_active(&_serial)) {
return -1; // transaction ongoing
@ -119,7 +119,7 @@ int SerialBase::write(uint8_t *buffer, int length, const event_callback_t& callb
return 0;
}
int SerialBase::write(uint16_t *buffer, int length, const event_callback_t& callback, int event)
int SerialBase::write(const uint16_t *buffer, int length, const event_callback_t& callback, int event)
{
if (serial_tx_active(&_serial)) {
return -1; // transaction ongoing
@ -128,7 +128,7 @@ int SerialBase::write(uint16_t *buffer, int length, const event_callback_t& call
return 0;
}
void SerialBase::start_write(void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event)
void SerialBase::start_write(const void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event)
{
_tx_callback = callback;

View File

@ -237,7 +237,7 @@ void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, Pi
* @param hint A suggestion for how to use DMA with this transfer
* @return Returns number of data transfered, or 0 otherwise
*/
int serial_tx_asynch(serial_t *obj, void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint);
int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint);
/** Begin asynchronous RX transfer (enable interrupt for data collecting)
* The used buffer is specified in the serial object - rx_buff

View File

@ -1262,14 +1262,14 @@ void serial_set_char_match(serial_t *obj, uint8_t char_match)
* @param hint A suggestion for how to use DMA with this transfer
* @return Returns number of data transfered, or 0 otherwise
*/
int serial_tx_asynch(serial_t *obj, void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint)
int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint)
{
// Check that a buffer has indeed been set up
MBED_ASSERT(tx != (void*)0);
if(tx_length == 0) return 0;
// Set up buffer
serial_tx_buffer_set(obj, tx, tx_length, tx_width);
serial_tx_buffer_set(obj, (void *)tx, tx_length, tx_width);
// Set up events
serial_tx_enable_event(obj, SERIAL_EVENT_TX_ALL, false);