Asynchronous event names
The article: https://developer.mbed.org/blog/entry/Using-the-new-mbed-power-management-API/ refers to event numbers which are listed in headers in the MBED sources, however they don't appear to have exported into the documentation in the handbook despite the doxygen directives in the comments.
From spi_api.h
#define SPI_EVENT_ERROR (1 << 1) #define SPI_EVENT_COMPLETE (1 << 2) #define SPI_EVENT_RX_OVERFLOW (1 << 3) #define SPI_EVENT_ALL (SPI_EVENT_ERROR | SPI_EVENT_COMPLETE | SPI_EVENT_RX_OVERFLOW)
Incidentally it might be useful to have an event that goes off immediately before an asynchronous SPI transfer starts, with the new API it is possible for a transfer to fail to start and if the program was setting a device select pin rather than letting the port manage it then the pin might be left in the wrong state. Alternatively it might be useful to have the option to set a device select pin as part of a "transfer" call.
From i2c_api.h
#define I2C_EVENT_ERROR (1 << 1) #define I2C_EVENT_ERROR_NO_SLAVE (1 << 2) #define I2C_EVENT_TRANSFER_COMPLETE (1 << 3) #define I2C_EVENT_TRANSFER_EARLY_NACK (1 << 4) #define I2C_EVENT_ALL (I2C_EVENT_ERROR | I2C_EVENT_TRANSFER_COMPLETE | I2C_EVENT_ERROR_NO_SLAVE | I2C_EVENT_TRANSFER_EARLY_NACK)
From serial_api.h
/** * @defgroup SerialTXEvents Serial TX Events Macros * * @{ */ #define SERIAL_EVENT_TX_COMPLETE (1 << (SERIAL_EVENT_TX_SHIFT + 0)) #define SERIAL_EVENT_TX_ALL (SERIAL_EVENT_TX_COMPLETE) /**@}*/ /** * @defgroup SerialRXEvents Serial RX Events Macros * * @{ */ #define SERIAL_EVENT_RX_COMPLETE (1 << (SERIAL_EVENT_RX_SHIFT + 0)) #define SERIAL_EVENT_RX_OVERRUN_ERROR (1 << (SERIAL_EVENT_RX_SHIFT + 1)) #define SERIAL_EVENT_RX_FRAMING_ERROR (1 << (SERIAL_EVENT_RX_SHIFT + 2)) #define SERIAL_EVENT_RX_PARITY_ERROR (1 << (SERIAL_EVENT_RX_SHIFT + 3)) #define SERIAL_EVENT_RX_OVERFLOW (1 << (SERIAL_EVENT_RX_SHIFT + 4)) #define SERIAL_EVENT_RX_CHARACTER_MATCH (1 << (SERIAL_EVENT_RX_SHIFT + 5)) #define SERIAL_EVENT_RX_ALL (SERIAL_EVENT_RX_OVERFLOW | SERIAL_EVENT_RX_PARITY_ERROR | \ SERIAL_EVENT_RX_FRAMING_ERROR | SERIAL_EVENT_RX_OVERRUN_ERROR | \ SERIAL_EVENT_RX_COMPLETE | SERIAL_EVENT_RX_CHARACTER_MATCH) /**@}*/
Please log in to post comments.