Skip to content

Commit d863000

Browse files
committed
Remove builtin interface setup initialization
1 parent 799dbae commit d863000

File tree

20 files changed

+27
-114
lines changed

20 files changed

+27
-114
lines changed

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ hal/newdev
7272

7373
/* ... */
7474

75-
bool MINBASECLI_NEWDEV::hal_setup(const uint32_t baud_rate)
76-
{
77-
// Specific device/framework interface initialization
78-
// should be written here
79-
}
80-
8175
bool MINBASECLI_NEWDEV::hal_setup(void* iface, const uint32_t baud_rate)
8276
{
8377
// Specific device/framework interface initialization

examples/espidf/basic_usage/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();
160+
Cli.setup(SIMPLECLI_DEFAULT_IFACE, SIMPLECLI_DEFAULT_BAUDS);
161161
ESP_LOGI(TAG, "Command Line Interface is ready");
162162
printf("\n\n");
163163

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();
65+
Cli.setup(SIMPLECLI_DEFAULT_IFACE, SIMPLECLI_DEFAULT_BAUDS);
6666
printf("\nCommand Line Interface is ready\n\n");
6767

6868
while(1)

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();
68+
Cli.setup(SIMPLECLI_DEFAULT_IFACE, SIMPLECLI_DEFAULT_BAUDS);
6969
printf("\nCommand Line Interface is ready\n\n");
7070

7171
while(1)

src/hal/arduino/minbasecli_arduino.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,15 @@ MINBASECLI_ARDUINO::MINBASECLI_ARDUINO()
7575

7676
/* Specific Device/Framework HAL functions */
7777

78-
/**
79-
* @brief Setup and initialize UART for CLI interface.
80-
* @return If UART has been successfully initialized.
81-
*/
82-
bool MINBASECLI_ARDUINO::hal_setup(const uint32_t baud_rate)
83-
{
84-
this->iface = iface;
85-
_IFACE* _Serial = (_IFACE*)(&Serial);
86-
_Serial->begin(baud_rate);
87-
return true;
88-
}
89-
9078
/**
9179
* @brief Hardware Abstraction Layer setup CLI interface.
9280
* @return If CLI has been successfully initialized.
9381
*/
9482
bool MINBASECLI_ARDUINO::hal_setup(void* iface, const uint32_t baud_rate)
9583
{
9684
this->iface = iface;
85+
_IFACE* _Serial = (_IFACE*) this->iface;
86+
_Serial->begin(baud_rate);
9787
return true;
9888
}
9989

src/hal/arduino/minbasecli_arduino.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,14 @@ class MINBASECLI_ARDUINO
6060
public:
6161
MINBASECLI_ARDUINO();
6262

63-
private:
64-
void* iface;
65-
6663
protected:
67-
bool hal_setup(const uint32_t baud_rate);
6864
bool hal_setup(void* iface, const uint32_t baud_rate);
6965
size_t hal_iface_available();
7066
uint8_t hal_iface_read();
7167
void hal_iface_print(const uint8_t data_byte);
68+
69+
private:
70+
void* iface;
7271
};
7372

7473
/*****************************************************************************/

src/hal/avr/minbasecli_avr.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,25 +71,16 @@ MINBASECLI_AVR::MINBASECLI_AVR()
7171

7272
/* Specific Device/Framework HAL Methods */
7373

74-
/**
75-
* @brief Setup and initialize UART for CLI interface.
76-
* @return If UART has been successfully initialized.
77-
*/
78-
bool MINBASECLI_AVR::hal_setup(const uint32_t baud_rate)
79-
{
80-
_IFACE* _Serial = (_IFACE*) this->iface;
81-
_Serial->setup(baud_rate);
82-
return true;
83-
}
84-
8574
/**
8675
* @brief Hardware Abstraction Layer setup CLI interface.
8776
* @return If CLI has been successfully initialized.
8877
*/
8978
bool MINBASECLI_AVR::hal_setup(void* iface, const uint32_t baud_rate)
9079
{
9180
this->iface = iface;
92-
return hal_setup(baud_rate);
81+
_IFACE* _Serial = (_IFACE*) this->iface;
82+
_Serial->setup(baud_rate);
83+
return true;
9384
}
9485

9586
/**

src/hal/avr/minbasecli_avr.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ class MINBASECLI_AVR
6565
MINBASECLI_AVR();
6666

6767
protected:
68-
bool hal_setup(const uint32_t baud_rate);
6968
bool hal_setup(void* iface, const uint32_t baud_rate);
7069
size_t hal_iface_available();
7170
uint8_t hal_iface_read();

src/hal/espidf/minbasecli_espidf.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,26 +91,18 @@ MINBASECLI_ESPIDF::MINBASECLI_ESPIDF()
9191

9292
/**
9393
* @brief Initialize the Command Line Interface providing an interface.
94+
* @param iface CLI interface to use.
9495
*/
95-
bool MINBASECLI_ESPIDF::hal_setup(const uint32_t baud_rate)
96+
bool MINBASECLI_ESPIDF::hal_setup(void* iface, const uint32_t baud_rate)
9697
{
98+
this->iface = iface;
9799
if (uart_setup(baud_rate) == false)
98100
return false;
99101
if (launch_stdin_read_thread() == false)
100102
return false;
101103
return true;
102104
}
103105

104-
/**
105-
* @brief Initialize the Command Line Interface providing an interface.
106-
* @param iface CLI interface to use.
107-
*/
108-
bool MINBASECLI_ESPIDF::hal_setup(void* iface, const uint32_t baud_rate)
109-
{
110-
this->iface = iface;
111-
return hal_setup(baud_rate);
112-
}
113-
114106
size_t MINBASECLI_ESPIDF::hal_iface_available()
115107
{
116108
return (this->th_rx_read_head - this->th_rx_read_tail);

src/hal/espidf/minbasecli_espidf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class MINBASECLI_ESPIDF
6666
MINBASECLI_ESPIDF();
6767

6868
protected:
69-
bool hal_setup(const uint32_t baud_rate);
7069
bool hal_setup(void* iface, const uint32_t baud_rate);
7170
size_t hal_iface_available();
7271
uint8_t hal_iface_read();

0 commit comments

Comments
 (0)