I2C shell implementation.
This commit is contained in:
Totoo 2024-11-08 11:46:27 +01:00 committed by GitHub
parent c31fef0535
commit 5020e5bd28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 298 additions and 19 deletions

View file

@ -38,6 +38,7 @@
#include "performance_counter.hpp"
#include "usb_serial_device_to_host.h"
#include "i2c_device_to_host.h"
#include "chprintf.h"
#include "chqueues.h"
#include "ui_external_items_menu_loader.hpp"
@ -59,6 +60,7 @@
#define palOutputPad(port, pad) (LPC_GPIO->DIR[(port)] |= 1 << (pad))
static EventDispatcher* _eventDispatcherInstance = NULL;
static bool shell_i2c_created = false;
static EventDispatcher* getEventDispatcherInstance() {
return _eventDispatcherInstance;
}
@ -1222,7 +1224,19 @@ static const ShellConfig shell_cfg1 = {
(BaseSequentialStream*)&SUSBD1,
commands};
static const ShellConfig shell_cfg2 = {
(BaseSequentialStream*)&I2CD1,
commands};
void create_shell(EventDispatcher* evtd) {
_eventDispatcherInstance = evtd;
shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO + 10);
}
extern "C" void create_shell_i2c(EventDispatcher* evtd) {
if (shell_i2c_created) return;
shell_i2c_created = true;
init_i2c_shell_driver(&I2CD1);
_eventDispatcherInstance = evtd;
shellCreate(&shell_cfg2, SHELL_WA_SIZE, NORMALPRIO + 10);
}