Skip to content

Commit 277ba89

Browse files
committed
CLI setup null default interface
1 parent ff1ce43 commit 277ba89

22 files changed

Lines changed: 128 additions & 104 deletions

File tree

examples/espidf/basic_usage/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void th_cli_interpreter(void* arg)
157157
bool command_received = false;
158158

159159
// Setup Command Line Interface
160-
Cli.setup(MINBASECLI_DEFAULT_IFACE, MINBASECLI_DEFAULT_BAUDS);
160+
Cli.setup();
161161
ESP_LOGI(TAG, "Command Line Interface is ready");
162162
printf("\n\n");
163163

examples/espidf/basic_usage_callbacks/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ bool launch_threads(void)
168168
void th_cli_interpreter(void* arg)
169169
{
170170
// Setup Command Line Interface
171-
Cli.setup(MINBASECLI_DEFAULT_IFACE, MINBASECLI_DEFAULT_BAUDS);
171+
Cli.setup();
172172

173173
// Add commands and bind callbacks to them
174174
Cli.add_cmd("heap", &cmd_heap, "Show available HEAP memory.");

examples/linux/basic_usage/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int main()
6262
bool exit = false;
6363

6464
// Setup Command Line Interface
65-
Cli.setup(MINBASECLI_DEFAULT_IFACE, MINBASECLI_DEFAULT_BAUDS);
65+
Cli.setup();
6666
Cli.printf("\nCommand Line Interface is ready\n\n");
6767

6868
while(1)

examples/linux/basic_usage_callbacks/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void cmd_exit(int argc, char* argv[]);
8282
int main()
8383
{
8484
// Initialize Command Line Interface
85-
Cli.setup(MINBASECLI_DEFAULT_IFACE, MINBASECLI_DEFAULT_BAUDS);
85+
Cli.setup();
8686

8787
// Add commands and bind callbacks to them
8888
Cli.add_cmd("test", &cmd_test, "test [on/off] - Turn test mode ON or OFF.");

examples/windows/basic_usage/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ int main()
6565
bool exit = false;
6666

6767
// Setup Command Line Interface
68-
Cli.setup(MINBASECLI_DEFAULT_IFACE, MINBASECLI_DEFAULT_BAUDS);
68+
Cli.setup();
6969
Cli.printf("\nCommand Line Interface is ready\n\n");
7070

7171
while(1)

examples/windows/basic_usage_callbacks/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void cmd_exit(int argc, char* argv[]);
8484
int main()
8585
{
8686
// Setup Command Line Interface
87-
Cli.setup(MINBASECLI_DEFAULT_IFACE, MINBASECLI_DEFAULT_BAUDS);
87+
Cli.setup();
8888

8989
// Add commands and bind callbacks to them
9090
Cli.add_cmd("test", &cmd_test, "test [on/off] - Turn test mode ON or OFF.");

src/hal/arduino/minbasecli_arduino.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
/**
6767
* @details
68-
* This constructor initializes all attributtes of the CLI class.
68+
* This constructor initializes all attributes of the CLI class.
6969
*/
7070
MINBASECLI_ARDUINO::MINBASECLI_ARDUINO()
7171
{
@@ -83,9 +83,13 @@ MINBASECLI_ARDUINO::MINBASECLI_ARDUINO()
8383
*/
8484
bool MINBASECLI_ARDUINO::hal_setup(void* iface, const uint32_t baud_rate)
8585
{
86+
if (iface == NULL)
87+
{ return false; }
88+
8689
this->iface = iface;
8790
_IFACE* _Serial = (_IFACE*) this->iface;
8891
_Serial->begin(baud_rate);
92+
8993
return true;
9094
}
9195

src/hal/arduino/minbasecli_arduino.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class MINBASECLI_ARDUINO
8888
bool hal_setup(void* iface, const uint32_t baud_rate);
8989

9090
/**
91-
* @brief Get the number of bytes that the interface has recevived and
91+
* @brief Get the number of bytes that the interface has received and
9292
* are available in the current interface buffer to be read.
9393
* @return size_t The number of bytes available to be read.
9494
*/
@@ -113,7 +113,7 @@ class MINBASECLI_ARDUINO
113113
private:
114114

115115
/**
116-
* @brief Pointer to interfce used.
116+
* @brief Pointer to interface used.
117117
*/
118118
void* iface;
119119
};

src/hal/avr/minbasecli_avr.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262
/**
6363
* @details
64-
* This constructor initializes all attributtes of the CLI class.
64+
* This constructor initializes all attributes of the CLI class.
6565
*/
6666
MINBASECLI_AVR::MINBASECLI_AVR()
6767
{
@@ -79,9 +79,13 @@ MINBASECLI_AVR::MINBASECLI_AVR()
7979
*/
8080
bool MINBASECLI_AVR::hal_setup(void* iface, const uint32_t baud_rate)
8181
{
82+
if (iface == NULL)
83+
{ return false; }
84+
8285
this->iface = iface;
8386
_IFACE* _Serial = (_IFACE*) this->iface;
8487
_Serial->setup(baud_rate);
88+
8589
return true;
8690
}
8791

src/hal/avr/minbasecli_avr.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*
88
* @section DESCRIPTION
99
*
10-
* A simple Command Line Interface C++ library implementation with HAL emphasis
11-
* to be used in different kind of devices and frameworks.
10+
* A simple Command Line Interface C++ library implementation with HAL
11+
* emphasis to be used in different kind of devices and frameworks.
1212
*
1313
* @section LICENSE
1414
*
@@ -93,7 +93,7 @@ class MINBASECLI_AVR
9393
bool hal_setup(void* iface, const uint32_t baud_rate);
9494

9595
/**
96-
* @brief Get the number of bytes that the interface has recevived and
96+
* @brief Get the number of bytes that the interface has received and
9797
* are available in the current interface buffer to be read.
9898
* @return size_t The number of bytes available to be read.
9999
*/
@@ -118,7 +118,7 @@ class MINBASECLI_AVR
118118
private:
119119

120120
/**
121-
* @brief Pointer to interfce used.
121+
* @brief Pointer to interface used.
122122
*/
123123
void* iface;
124124
};

0 commit comments

Comments
 (0)