mirror of https://github.com/ARMmbed/mbed-os.git
Explicit pinmap - fix style
parent
17c1b9a860
commit
d75cc97d80
|
@ -61,8 +61,7 @@
|
|||
#define alignas(N) __attribute__((aligned(N)))
|
||||
#endif
|
||||
|
||||
namespace std
|
||||
{
|
||||
namespace std {
|
||||
// [cstddef.syn]
|
||||
using nullptr_t = decltype(nullptr);
|
||||
|
||||
|
@ -70,8 +69,7 @@ using nullptr_t = decltype(nullptr);
|
|||
|
||||
#endif // __CC_ARM
|
||||
|
||||
namespace mstd
|
||||
{
|
||||
namespace mstd {
|
||||
using std::size_t;
|
||||
using std::ptrdiff_t;
|
||||
using std::nullptr_t;
|
||||
|
|
|
@ -113,8 +113,9 @@ float pwmout_read(pwmout_t* obj)
|
|||
uint16_t count = (base->CONTROLS[obj->pwm_name & 0xF].CnV) & FTM_CnV_VAL_MASK;
|
||||
uint16_t mod = base->MOD & FTM_MOD_MOD_MASK;
|
||||
|
||||
if (mod == 0)
|
||||
if (mod == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
float v = (float)(count) / (float)(mod);
|
||||
return (v > 1.0f) ? (1.0f) : (v);
|
||||
}
|
||||
|
|
|
@ -119,8 +119,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
|||
uint8_t temp;
|
||||
/* Set bit count and parity mode. */
|
||||
temp = base->C1 & ~(UART_C1_PE_MASK | UART_C1_PT_MASK | UART_C1_M_MASK);
|
||||
if (parity != ParityNone)
|
||||
{
|
||||
if (parity != ParityNone) {
|
||||
/* Enable Parity */
|
||||
temp |= (UART_C1_PE_MASK | UART_C1_M_MASK);
|
||||
if (parity == ParityOdd) {
|
||||
|
@ -147,20 +146,21 @@ static inline void uart_irq(uint32_t transmit_empty, uint32_t receive_full, uint
|
|||
UART_Type *base = uart_addrs[index];
|
||||
|
||||
/* If RX overrun. */
|
||||
if (UART_S1_OR_MASK & base->S1)
|
||||
{
|
||||
if (UART_S1_OR_MASK & base->S1) {
|
||||
/* Read base->D, otherwise the RX does not work. */
|
||||
(void)base->D;
|
||||
}
|
||||
|
||||
if (serial_irq_ids[index] != 0) {
|
||||
if (transmit_empty && (UART_GetEnabledInterrupts(uart_addrs[index]) & kUART_TxDataRegEmptyInterruptEnable))
|
||||
if (transmit_empty && (UART_GetEnabledInterrupts(uart_addrs[index]) & kUART_TxDataRegEmptyInterruptEnable)) {
|
||||
irq_handler(serial_irq_ids[index], TxIrq);
|
||||
}
|
||||
|
||||
if (receive_full && (UART_GetEnabledInterrupts(uart_addrs[index]) & kUART_RxDataRegFullInterruptEnable))
|
||||
if (receive_full && (UART_GetEnabledInterrupts(uart_addrs[index]) & kUART_RxDataRegFullInterruptEnable)) {
|
||||
irq_handler(serial_irq_ids[index], RxIrq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void uart0_irq()
|
||||
{
|
||||
|
@ -269,10 +269,11 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
if (all_disabled)
|
||||
if (all_disabled) {
|
||||
NVIC_DisableIRQ(uart_irqs[obj->serial.index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int serial_getc(serial_t *obj)
|
||||
{
|
||||
|
@ -292,16 +293,18 @@ void serial_putc(serial_t *obj, int c)
|
|||
int serial_readable(serial_t *obj)
|
||||
{
|
||||
uint32_t status_flags = UART_GetStatusFlags(uart_addrs[obj->serial.index]);
|
||||
if (status_flags & kUART_RxOverrunFlag)
|
||||
if (status_flags & kUART_RxOverrunFlag) {
|
||||
UART_ClearStatusFlags(uart_addrs[obj->serial.index], kUART_RxOverrunFlag);
|
||||
}
|
||||
return (status_flags & kUART_RxDataRegFullFlag);
|
||||
}
|
||||
|
||||
int serial_writable(serial_t *obj)
|
||||
{
|
||||
uint32_t status_flags = UART_GetStatusFlags(uart_addrs[obj->serial.index]);
|
||||
if (status_flags & kUART_RxOverrunFlag)
|
||||
if (status_flags & kUART_RxOverrunFlag) {
|
||||
UART_ClearStatusFlags(uart_addrs[obj->serial.index], kUART_RxOverrunFlag);
|
||||
}
|
||||
return (status_flags & kUART_TxDataRegEmptyFlag);
|
||||
}
|
||||
|
||||
|
@ -512,7 +515,8 @@ void serial_enable_event(serial_t *obj, int event, uint8_t enable)
|
|||
}
|
||||
}
|
||||
|
||||
static void serial_tx_buffer_set(serial_t *obj, void *tx, int tx_length, uint8_t width) {
|
||||
static void serial_tx_buffer_set(serial_t *obj, void *tx, int tx_length, uint8_t width)
|
||||
{
|
||||
(void)width;
|
||||
|
||||
// Exit if a transmit is already on-going
|
||||
|
@ -530,7 +534,9 @@ int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx
|
|||
// Check that a buffer has indeed been set up
|
||||
MBED_ASSERT(tx != (void *)0);
|
||||
|
||||
if (tx_length == 0) return 0;
|
||||
if (tx_length == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (serial_tx_active(obj)) {
|
||||
return 0;
|
||||
|
@ -582,7 +588,9 @@ void serial_rx_buffer_set(serial_t *obj, void *rx, int rx_length, uint8_t width)
|
|||
// We only support byte buffers for now
|
||||
MBED_ASSERT(width == 8);
|
||||
|
||||
if (serial_rx_active(obj)) return;
|
||||
if (serial_rx_active(obj)) {
|
||||
return;
|
||||
}
|
||||
|
||||
obj->rx_buff.buffer = rx;
|
||||
obj->rx_buff.length = rx_length;
|
||||
|
@ -596,7 +604,9 @@ void serial_rx_asynch(serial_t *obj, void *rx, size_t rx_length, uint8_t rx_widt
|
|||
{
|
||||
// Check that a buffer has indeed been set up
|
||||
MBED_ASSERT(rx != (void *)0);
|
||||
if (rx_length == 0) return;
|
||||
if (rx_length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (serial_rx_active(obj)) {
|
||||
return;
|
||||
|
|
|
@ -47,9 +47,10 @@ static void _analogin_init_direct(analogin_t* obj, const PinMap *pinmap)
|
|||
bus_clock = CLOCK_GetFreq(kCLOCK_BusClk);
|
||||
uint32_t clkdiv;
|
||||
for (clkdiv = 0; clkdiv < 4; clkdiv++) {
|
||||
if ((bus_clock >> clkdiv) <= MAX_FADC)
|
||||
if ((bus_clock >> clkdiv) <= MAX_FADC) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (clkdiv == 4) {
|
||||
clkdiv = 0x3; //Set max div
|
||||
}
|
||||
|
@ -96,8 +97,7 @@ uint16_t analogin_read_u16(analogin_t *obj)
|
|||
*/
|
||||
ADC16_SetChannelConfig(adc_addrs[instance], 0, &adc16_channel_config);
|
||||
while (0U == (kADC16_ChannelConversionDoneFlag &
|
||||
ADC16_GetChannelStatusFlags(adc_addrs[instance], 0)))
|
||||
{
|
||||
ADC16_GetChannelStatusFlags(adc_addrs[instance], 0))) {
|
||||
}
|
||||
return ADC16_GetChannelConversionValue(adc_addrs[instance], 0);
|
||||
}
|
||||
|
|
|
@ -98,8 +98,7 @@ int i2c_start(i2c_t *obj)
|
|||
}
|
||||
|
||||
#if defined(FSL_FEATURE_I2C_HAS_DOUBLE_BUFFERING) && FSL_FEATURE_I2C_HAS_DOUBLE_BUFFERING
|
||||
while (!(base->S2 & I2C_S2_EMPTY_MASK))
|
||||
{
|
||||
while (!(base->S2 & I2C_S2_EMPTY_MASK)) {
|
||||
}
|
||||
#endif /* FSL_FEATURE_I2C_HAS_DOUBLE_BUFFERING */
|
||||
|
||||
|
@ -217,8 +216,7 @@ int i2c_byte_read(i2c_t *obj, int last)
|
|||
data = base->D;
|
||||
|
||||
/* Wait until data transfer complete. */
|
||||
while (!(base->S & kI2C_IntPendingFlag))
|
||||
{
|
||||
while (!(base->S & kI2C_IntPendingFlag)) {
|
||||
}
|
||||
|
||||
/* Clear the IICIF flag. */
|
||||
|
|
Loading…
Reference in New Issue