-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bloodlight_based.c: Create test for led.c
* Bloodlight_based.c: Test leds with led.c APIs. * Build bloodlight_based.c by default. Keep both tests zephyr_based (previous main) and bloodlight_based.c so the user can select in CMakeFie which test wants to run. zephyr_based to test leds using zephyrs APIs or bloodlight_based to test them using bloodlight's APIs. Signed-off-by: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk>
- Loading branch information
Iker Perez del Palomar Sustatxa
committed
Jun 1, 2021
1 parent
7d8e799
commit 8afe0b7
Showing
4 changed files
with
48 additions
and
2 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
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
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 @@ | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
#include <sys/printk.h> | ||
#include <sys/util.h> | ||
#include <string.h> | ||
#include <usb/usb_device.h> | ||
#include <drivers/uart.h> | ||
|
||
#include "../../src/led.h" | ||
#include "../../src/led.c" | ||
|
||
void main (void) { | ||
const struct device *dev = device_get_binding( | ||
CONFIG_UART_CONSOLE_ON_DEV_NAME); | ||
uint32_t dtr = 0; | ||
|
||
if (usb_enable(NULL)) { | ||
return; | ||
} | ||
|
||
/* Poll if the DTR flag was set, optional */ | ||
while (!dtr) { | ||
uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr); | ||
} | ||
|
||
if (strlen(CONFIG_UART_CONSOLE_ON_DEV_NAME) != | ||
strlen("CDC_ACM_0") || | ||
strncmp(CONFIG_UART_CONSOLE_ON_DEV_NAME, "CDC_ACM_0", | ||
strlen(CONFIG_UART_CONSOLE_ON_DEV_NAME))) { | ||
printk("Error: Console device name is not USB ACM\n"); | ||
|
||
return; | ||
} | ||
|
||
printk("Before led init\n"); | ||
bl_led_init(); | ||
printk("After led init\n"); | ||
bl_led_status_set(true); | ||
bl_led_set(0xffff); | ||
|
||
}; |
File renamed without changes.