generated from zephyrproject-rtos/example-application
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: cc2500 implementation and test app
- Loading branch information
Showing
9 changed files
with
584 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#------------------------------------------------------------------------------- | ||
# Zephyr Example Application | ||
# | ||
# Copyright (c) 2021 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
set(SYSCALL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../include") | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
|
||
project(app LANGUAGES C) | ||
|
||
target_sources(app PRIVATE src/main.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2021 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# This file is the application Kconfig entry point. All application Kconfig | ||
# options can be defined here or included via other application Kconfig files. | ||
# You can browse these options using the west targets menuconfig (terminal) or | ||
# guiconfig (GUI). | ||
|
||
menu "Zephyr" | ||
source "Kconfig.zephyr" | ||
endmenu | ||
|
||
module = APP | ||
module-str = APP | ||
source "subsys/logging/Kconfig.template.log_config" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
VERSION_MAJOR = 1 | ||
VERSION_MINOR = 0 | ||
PATCHLEVEL = 0 | ||
VERSION_TWEAK = 0 | ||
EXTRAVERSION = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) 2024 Eve Redero | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
&spi1 { | ||
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>; | ||
pinctrl-names = "default"; | ||
cs-gpios = <&gpioa 4 GPIO_ACTIVE_LOW>; | ||
clock-frequency = <8000000>; // Max 8 Mbps for SPI | ||
status = "okay"; | ||
|
||
radio0: propy_radio@0 { | ||
reg = <0>; | ||
compatible = "ti,cc2500"; | ||
status = "okay"; | ||
spi-max-frequency = <500000>; // This really sets frequency | ||
/* From 0x07 to 0x2E */ | ||
conf-array = [0A 04 01 00 0A 00 5D 13 B1 | ||
2D 3B 73 22 F8 00 07 30 18 1D 1C C7 00 B0 87 6B | ||
F8 B6 10 EA 0A 00 11 41 00 59 7F 3F 88 31 0B]; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) 2021 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# This file contains selected Kconfig options for the application. | ||
|
||
CONFIG_SPI=y | ||
CONFIG_CC2500=y | ||
CONFIG_CC2500_TRIGGER=y | ||
|
||
# logging | ||
CONFIG_LOG=y | ||
CONFIG_APP_LOG_LEVEL_DBG=y | ||
CONFIG_CC2500_LOG_LEVEL_DBG=y | ||
CONFIG_LOG_MODE_IMMEDIATE=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This file is provided so that the application can be compiled using Twister, | ||
# the Zephyr testing tool. In this file, multiple combinations can be specified, | ||
# so that you can easily test all of them locally or in CI. | ||
sample: | ||
description: Example application | ||
name: example-application | ||
common: | ||
build_only: true | ||
integration_platforms: | ||
- nucleo_f756zg | ||
tests: | ||
app.default: {} | ||
app.debug: | ||
extra_overlay_confs: | ||
- debug.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (C) 2024 Eve Redero | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/kernel.h> | ||
#include <zephyr/devicetree.h> | ||
|
||
#include <app/drivers/propy_radio.h> | ||
#include <zephyr/logging/log.h> | ||
LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL); | ||
#if !DT_NODE_EXISTS(DT_NODELABEL(radio0)) | ||
#error "whoops, node label radio0 not found" | ||
#endif | ||
|
||
|
||
int main(void) | ||
{ | ||
static const struct device *cc2500 = DEVICE_DT_GET(DT_NODELABEL(radio0)); | ||
uint8_t data_len = 7; | ||
uint8_t buffer[] = {0x01, 0x00, 0xa5, 0x28, 0x28, 0x00, 0x00}; | ||
int i = 0; | ||
|
||
if (!device_is_ready(cc2500)) { | ||
LOG_ERR("Sensor not ready"); | ||
return 0; | ||
} | ||
LOG_INF("Device ready"); | ||
for (i=0; i<20; i++) { | ||
propy_radio_write(cc2500, buffer, data_len); | ||
k_sleep(K_MSEC(20)); | ||
} | ||
/* | ||
while (!propy_radio_write(cc2500, buffer, data_len)) | ||
{ | ||
k_sleep(K_MSEC(10)); | ||
}*/ | ||
|
||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters