Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zephyr Firmware
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kestrel Collaboration
Kestrel Firmware
Zephyr Firmware
Commits
3d8d9147
Commit
3d8d9147
authored
Apr 26, 2021
by
Raptor Engineering Development Team
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add shell command for direct PWM control
Minor cleanup
parent
4b2f1290
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
kestrel/src/kestrel.c
kestrel/src/kestrel.c
+2
-2
kestrel/src/shell.c
kestrel/src/shell.c
+33
-0
No files found.
kestrel/src/kestrel.c
View file @
3d8d9147
...
...
@@ -3457,7 +3457,7 @@ int kestrel_init(void)
initialize_i2c_master
((
uint8_t
*
)
I2CMASTER4_BASE
,
100000
);
#ifdef SIMPLEPWM_BASE
initialize_pwm_controller
(
SIMPLEPWM_BASE
);
initialize_pwm_controller
(
(
uint8_t
*
)
SIMPLEPWM_BASE
);
#endif
// Check for Aquila core presence
...
...
@@ -3542,7 +3542,7 @@ int kestrel_init(void)
configure_flash_device
(
BMCSPIFLASHCFG_BASE
,
BMCSPIFLASH_BASE
);
// Initialize host Flash controller
tercel_spi_flash_init
(
HOSTSPIFLASHCFG_BASE
,
HOSTSPIFLASH_BASE
,
5
,
1
,
1
);
tercel_spi_flash_init
(
HOSTSPIFLASHCFG_BASE
,
HOSTSPIFLASH_BASE
,
5
,
1
,
1
);
// Detect and print attached host SPI Flash ID
KESTREL_LOG
(
"Host SPI flash ID: 0x%08x"
,
read_host_spi_flash_id
(
HOSTSPIFLASHCFG_BASE
,
HOSTSPIFLASH_BASE
));
...
...
kestrel/src/shell.c
View file @
3d8d9147
...
...
@@ -12,8 +12,11 @@
#define WITH_ZEPHYR 1
#include "kestrel.h"
#include "simple_pwm.h"
#include "flash_filesystem.h"
#include <generated/mem.h>
#define KESTREL_CONSOLE_THREAD_PRIORITY K_PRIO_PREEMPT(CONFIG_NUM_PREEMPT_PRIORITIES - 1)
static
K_THREAD_STACK_DEFINE
(
kestrel_console_thread_stack
,
16384
);
static
struct
k_thread
kestrel_console_thread_data
;
...
...
@@ -102,6 +105,10 @@ static void print_kestrel_memdump_command_usage(const struct shell *shell, char*
shell_print
(
shell
,
"Usage: %s <address> [length]"
,
command_name
);
}
static
void
print_kestrel_pwmcontrol_command_usage
(
const
struct
shell
*
shell
,
char
*
command_name
)
{
shell_print
(
shell
,
"Usage: %s <channel> <value>"
,
command_name
);
}
static
int
kestrel_shell_cmd_utility
(
const
struct
shell
*
shell
,
size_t
argc
,
char
**
argv
)
{
if
(
argc
<
2
)
{
...
...
@@ -183,6 +190,30 @@ static int kestrel_shell_cmd_memdump(const struct shell *shell, size_t argc, cha
return
0
;
}
static
int
kestrel_shell_cmd_pwmcontrol
(
const
struct
shell
*
shell
,
size_t
argc
,
char
**
argv
)
{
int
channel
;
int
value
;
if
(
argc
<
3
)
{
print_kestrel_pwmcontrol_command_usage
(
shell
,
argv
[
0
]);
return
-
1
;
}
channel
=
strtoul
(
argv
[
1
],
NULL
,
16
);
value
=
strtoul
(
argv
[
2
],
NULL
,
16
);
#ifdef SIMPLEPWM_BASE
set_pwm_value
((
uint8_t
*
)
SIMPLEPWM_BASE
,
channel
,
value
);
shell_print
(
shell
,
""
);
#else
shell_print
(
shell
,
"[ERROR] No PWM controller available!"
);
#endif
return
0
;
}
static
int
kestrel_shell_cmd_console
(
const
struct
shell
*
shell
,
size_t
argc
,
char
**
argv
)
{
const
void
*
active_log_backend
=
NULL
;
...
...
@@ -222,6 +253,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(sub_kestrel,
SHELL_CMD
(
reflash
,
NULL
,
"Simple Flash utility"
,
kestrel_shell_cmd_reflash
),
// Arbitrary memory dump command
SHELL_CMD
(
memdump
,
NULL
,
"Memory dump tool"
,
kestrel_shell_cmd_memdump
),
// PWM commands
SHELL_CMD
(
pwmcontrol
,
NULL
,
"PWM controller"
,
kestrel_shell_cmd_pwmcontrol
),
// Command list array terminator
SHELL_SUBCMD_SET_END
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment