File tree 6 files changed +114
-1
lines changed
hal/tests/UNITTESTS/doubles 6 files changed +114
-1
lines changed Original file line number Diff line number Diff line change 35
35
^UNITTESTS
36
36
^storage/blockdevice/tests/UNITTESTS
37
37
^storage/kvstore/tests/UNITTESTS
38
- ^drivers/tests/UNITTESTS
Original file line number Diff line number Diff line change
1
+ # Copyright (c) 2021 ARM Limited. All rights reserved.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ include (GoogleTest)
5
+
6
+ set (TEST_NAME analogin-unittest)
7
+
8
+ add_executable (${TEST_NAME} )
9
+
10
+ target_compile_definitions (${TEST_NAME}
11
+ PRIVATE
12
+ DEVICE_ANALOGIN
13
+ MBED_CONF_TARGET_DEFAULT_ADC_VREF=3.3f
14
+ )
15
+
16
+ target_sources (${TEST_NAME}
17
+ PRIVATE
18
+ ${mbed-os_SOURCE_DIR}/drivers/source /AnalogIn.cpp
19
+ test_analogin.cpp
20
+ )
21
+
22
+ target_link_libraries (${TEST_NAME}
23
+ PRIVATE
24
+ mbed-headers-platform
25
+ mbed-headers-hal
26
+ mbed-headers-drivers
27
+ mbed-stubs-hal
28
+ mbed-stubs-platform
29
+ )
30
+
31
+ gtest_discover_tests(${TEST_NAME} PROPERTIES LABELS "drivers" )
Original file line number Diff line number Diff line change
1
+ /* Copyright (c) 2021 ARM Limited
2
+ * SPDX-License-Identifier: Apache-2.0
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
+
17
+ /* This empty test file is present in order to generate coverage data for the
18
+ * corresponding source file. This file allows an executable CMake target to be
19
+ * created, which builds the corresponding source file and produces a .gcno
20
+ * file to be used by a coverage tool.
21
+ *
22
+ * Replace this main function with Google Test tests, as described in the
23
+ * Mbed OS documentation:
24
+ *
25
+ * https://os.mbed.com/docs/mbed-os/latest/debug-test/unit-testing.html
26
+ *
27
+ */
28
+ int main ()
29
+ {
30
+ return 0 ;
31
+ }
Original file line number Diff line number Diff line change 1
1
# Copyright (c) 2021 ARM Limited. All rights reserved.
2
2
# SPDX-License-Identifier: Apache-2.0
3
3
add_subdirectory (doubles)
4
+ add_subdirectory (AnalogIn)
4
5
add_subdirectory (PwmOut)
5
6
add_subdirectory (Watchdog)
Original file line number Diff line number Diff line change @@ -17,13 +17,15 @@ target_compile_definitions(mbed-stubs-hal
17
17
DEVICE_PWMOUT
18
18
DEVICE_WATCHDOG
19
19
MBED_WDOG_ASSERT=1
20
+ DEVICE_ANALOGIN
20
21
)
21
22
22
23
target_sources (mbed-stubs-hal
23
24
PRIVATE
24
25
pwmout_api_stub.c
25
26
us_ticker_stub.cpp
26
27
watchdog_api_stub.c
28
+ analogin_api_stub.c
27
29
)
28
30
29
31
target_link_libraries (mbed-stubs-hal
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2021 Arm Limited and affiliates.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ #include "hal/analogin_api.h"
18
+ #include <stddef.h>
19
+
20
+ #if DEVICE_ANALOGIN
21
+
22
+ void analogin_init_direct (analogin_t * obj , const PinMap * pinmap )
23
+ {
24
+ }
25
+
26
+ void analogin_init (analogin_t * obj , PinName pin )
27
+ {
28
+ }
29
+
30
+ void analogin_free (analogin_t * obj )
31
+ {
32
+ }
33
+
34
+ float analogin_read (analogin_t * obj )
35
+ {
36
+ return 0 ;
37
+ }
38
+
39
+ uint16_t analogin_read_u16 (analogin_t * obj )
40
+ {
41
+ return 0 ;
42
+ }
43
+
44
+ const PinMap * analogin_pinmap (void )
45
+ {
46
+ return NULL ;
47
+ }
48
+
49
+ #endif // DEVICE_ANALOGIN
You can’t perform that action at this time.
0 commit comments