Skip to content

Commit 0074b34

Browse files
committed
Silabs - Fix unblock/block declaration, implement gpio_is_connected
1 parent 299385b commit 0074b34

File tree

10 files changed

+46
-2
lines changed

10 files changed

+46
-2
lines changed

libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/gpio_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "pinmap.h"
1818
#include "em_cmu.h"
1919
#include "mbed_assert.h"
20+
#include "sleepmodes.h"
2021

2122
uint8_t gpio_get_index(gpio_t *obj)
2223
{

libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/gpio_irq_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "em_int.h"
2626
#include "em_cmu.h"
2727
#include "sleep_api.h"
28+
#include "sleepmodes.h"
2829

2930
#define NUM_GPIO_CHANNELS (16)
3031
#define GPIO_LEAST_ACTIVE_SLEEPMODE EM3

libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/gpio_object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ static inline int gpio_read(gpio_t *obj)
4848
}
4949
}
5050

51+
static inline int gpio_is_connected(const gpio_t *obj) {
52+
return obj->pin != (PinName)NC;
53+
}
54+
5155
#ifdef __cplusplus
5256
}
5357
#endif

libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/i2c_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "i2c_api.h"
2525
#include "PeripheralPins.h"
2626
#include "pinmap_function.h"
27+
#include "sleepmodes.h"
2728

2829
#include "em_i2c.h"
2930
#include "em_cmu.h"

libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/rtc_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "em_cmu.h"
2323
#include "em_rtc.h"
2424
#include "sleep_api.h"
25+
#include "sleepmodes.h"
2526

2627
static bool rtc_inited = false;
2728
static time_t time_base = 0;

libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/serial_api.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "dma_api.h"
3737
#include "sleep_api.h"
3838
#include "buffer.h"
39+
#include "sleepmodes.h"
3940

4041
#define SERIAL_LEAST_ACTIVE_SLEEPMODE EM1
4142
#define SERIAL_LEAST_ACTIVE_SLEEPMODE_LEUART EM2
@@ -227,7 +228,7 @@ inline IRQn_Type serial_get_rx_irq_index(serial_t *obj)
227228
default:
228229
MBED_ASSERT(0);
229230
}
230-
return 0;
231+
return (IRQn_Type)0;
231232
}
232233

233234
/**
@@ -270,7 +271,7 @@ inline IRQn_Type serial_get_tx_irq_index(serial_t *obj)
270271
default:
271272
MBED_ASSERT(0);
272273
}
273-
return 0;
274+
return (IRQn_Type)0;
274275
}
275276

276277
/**

libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/sleep.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#if DEVICE_SLEEP
1919

2020
#include "sleep_api.h"
21+
#include "sleepmodes.h"
2122
#include "cmsis.h"
2223
#include "em_emu.h"
2324
#include "em_int.h"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2015 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#ifndef MBED_SLEEPMODES_H
17+
#define MBED_SLEEPMODES_H
18+
19+
#include "em_gpio.h"
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
void blockSleepMode(sleepstate_enum minimumMode);
26+
void unblockSleepMode(sleepstate_enum minimumMode);
27+
28+
#ifdef __cplusplus
29+
}
30+
#endif
31+
32+
#endif

libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/spi_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "em_cmu.h"
3131
#include "em_dma.h"
3232
#include "sleep_api.h"
33+
#include "sleepmodes.h"
3334

3435
static uint16_t fill_word = SPI_FILL_WORD;
3536
#define SPI_LEAST_ACTIVE_SLEEPMODE EM1

libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/us_ticker.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "device.h"
2424
#include "clocking.h"
2525
#include "sleep_api.h"
26+
#include "sleepmodes.h"
2627

2728
#define TIMER_LEAST_ACTIVE_SLEEPMODE EM1
2829
/**

0 commit comments

Comments
 (0)