Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid log level reference and not needed USB code removed #1

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion samples/openthread/ThreadBleSecure/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,11 @@ CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_OPENTHREAD_NETWORKKEY="00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff"
CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread-7cf7"
CONFIG_OPENTHREAD_XPANID="3b:78:ce:62:9c:bc:8e:23"
CONFIG_OPENTHREAD_PANID=31991
CONFIG_OPENTHREAD_PANID=31991

# Logging settings
# ----------------
CONFIG_LOG=y
CONFIG_OPENTHREAD_DEBUG=y
# CONFIG_OPENTHREAD_LOG_LEVEL_DEBG=y
# CONFIG_MBEDTLS_DEBUG_C=y
41 changes: 4 additions & 37 deletions samples/openthread/ThreadBleSecure/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@

#include "x509_cert_key.h"

LOG_MODULE_REGISTER(cli_sample, CONFIG_OT_COMMAND_LINE_INTERFACE_LOG_LEVEL);
#define LOG_LEVEL LOG_LEVEL_INF
LOG_MODULE_REGISTER(bbtc_cli_sample);

struct openthread_context *myOpenThreadContext;
otInstance *myOpenThreadInstance = NULL;
Expand Down Expand Up @@ -104,41 +105,6 @@ void HandleBleSecureReceive(otMessage *aMessage, void *aContext)

int main(void)
{
#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_shell_uart), zephyr_cdc_acm_uart)
int ret;
const struct device *dev;
uint32_t dtr = 0U;

ret = usb_enable(NULL);
if (ret != 0) {
LOG_ERR("Failed to enable USB");
return;
}

dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_shell_uart));
if (dev == NULL) {
LOG_ERR("Failed to find specific UART device");
return;
}

LOG_INF("Waiting for host to be ready to communicate");

/* Data Terminal Ready - check if host is ready to communicate */
while (!dtr) {
ret = uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr);
if (ret) {
LOG_ERR("Failed to get Data Terminal Ready line state: %d", ret);
continue;
}
k_msleep(100);
}

/* Data Carrier Detect Modem - mark connection as established */
(void)uart_line_ctrl_set(dev, UART_LINE_CTRL_DCD, 1);
/* Data Set Ready - the NCP SoC is ready to communicate */
(void)uart_line_ctrl_set(dev, UART_LINE_CTRL_DSR, 1);
#endif

myOpenThreadContext = openthread_get_default_context();
myOpenThreadInstance = myOpenThreadContext->instance;

Expand All @@ -157,5 +123,6 @@ int main(void)
otBleSecureStart(myOpenThreadInstance, HandleBleSecureClientConnect, HandleBleSecureReceive,
true, NULL);
otBleSecureTcatStart(myOpenThreadInstance, "SECRET", NULL, NULL);


return 1;
}