Skip to content

Commit

Permalink
tests: drivers: counter: add rtc_ds3231_api
Browse files Browse the repository at this point in the history
Cloned from counter_basic_api with modifications based on DS3231
limitations:
* Only one device tested per board;
* Counter cannot be stopped or started;
* Alarms are serviced by worker thread, so are not invoked from ISR
  and require that test thread yield to allow processing (no
  k_busy_wait());
* Multiple Alarms test is disabled as documented in test.

Additional tests were added for DS3231-specific API.

Signed-off-by: Peter A. Bigot <[email protected]>
  • Loading branch information
pabigot authored and carlescufi committed May 7, 2020
1 parent e444274 commit e697656
Show file tree
Hide file tree
Showing 11 changed files with 1,089 additions and 0 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@
/tests/crypto/mbedtls/ @nashif @ceolin
/tests/drivers/can/ @alexanderwachter
/tests/drivers/counter/ @nordic-krch
/tests/drivers/counter/maxim_ds3231_api/ @pabigot
/tests/drivers/flash_simulator/ @nvlsianpu
/tests/drivers/gpio/ @mnkp @pabigot
/tests/drivers/hwinfo/ @alexanderwachter
Expand Down
9 changes: 9 additions & 0 deletions tests/drivers/counter/maxim_ds3231_api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)

find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
project(NONE)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2019 Peter Bigot Consulting, LLC
*
* SPDX-License-Identifier: Apache-2.0
*/

&i2c0 { /* SDA H16=PC10, SCL H15=PC11, ISW H13=PF6 */
status = "okay";
ds3231: ds3231@68 {
compatible = "maxim,ds3231";
reg = <0x68>;
label = "DS3231";
isw-gpios = <&gpiof 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
};
15 changes: 15 additions & 0 deletions tests/drivers/counter/maxim_ds3231_api/boards/frdm_k64f.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2019 Peter Bigot Consulting, LLC
*
* SPDX-License-Identifier: Apache-2.0
*/

&i2c0 { /* SDA PTE25, SCL PTE24, ISW PTE26 */
status = "okay";
ds3231: ds3231@68 {
compatible = "maxim,ds3231";
reg = <0x68>;
label = "DS3231";
isw-gpios = <&gpioe 26 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2019 Peter Bigot Consulting, LLC
*
* SPDX-License-Identifier: Apache-2.0
*/

&i2c0 { /* SDA 30, SCL 7 */
status = "okay";
ds3231: ds3231@68 {
compatible = "maxim,ds3231";
reg = <0x68>;
label = "DS3231";
isw-gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2019 Peter Bigot Consulting, LLC
*
* SPDX-License-Identifier: Apache-2.0
*/

&i2c0 { /* SDA P0.26, SCL P0.27 */
status = "okay";
ds3231: ds3231@68 {
compatible = "maxim,ds3231";
reg = <0x68>;
label = "DS3231";
isw-gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2019 Peter Bigot Consulting, LLC
*
* SPDX-License-Identifier: Apache-2.0
*/

&i2c1 { /* SDA CN5.9=PB9, SCL CN5.10=PB8, ISW CN5.1=D8=PA9 */
status = "okay";
ds3231: ds3231@68 {
compatible = "maxim,ds3231";
reg = <0x68>;
label = "DS3231";
isw-gpios = <&gpioa 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2019 Peter Bigot Consulting, LLC
*
* SPDX-License-Identifier: Apache-2.0
*/

&i2c0 { /* SDA P0.26, SCL P0.27, ISW P1.1, 32K P1.2 */
status = "okay";
ds3231: ds3231@68 {
compatible = "maxim,ds3231";
reg = <0x68>;
label = "DS3231";
isw-gpios = <&gpio1 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
32k-gpios = <&gpio1 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
};
7 changes: 7 additions & 0 deletions tests/drivers/counter/maxim_ds3231_api/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CONFIG_I2C=y
CONFIG_COUNTER=y
CONFIG_COUNTER_MAXIM_DS3231=y
CONFIG_BT=n
CONFIG_ZTEST=y
CONFIG_TEST_USERSPACE=y
CONFIG_LOG=y
Loading

0 comments on commit e697656

Please sign in to comment.