Skip to content

Commit 88dacbb

Browse files
committed
Interface print out of HAL
1 parent 703fb42 commit 88dacbb

16 files changed

+143
-204
lines changed

src/hal/arduino/minbasecli_arduino.cpp

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/**
33
* @file minbasecli_arduino.cpp
44
* @author Jose Miguel Rios Rubio <[email protected]>
5-
* @date 08-02-2022
6-
* @version 1.0.1
5+
* @date 10-02-2022
6+
* @version 1.0.2
77
*
88
* @section DESCRIPTION
99
*
@@ -97,26 +97,6 @@ bool MINBASECLI_ARDUINO::hal_setup(void* iface, const uint32_t baud_rate)
9797
return true;
9898
}
9999

100-
/**
101-
* @brief Print a given string through the CLI HAL interface.
102-
* @param str String to print.
103-
*/
104-
void MINBASECLI_ARDUINO::hal_iface_print(const char* str)
105-
{
106-
_IFACE* _Serial = (_IFACE*) this->iface;
107-
_Serial->print(str);
108-
}
109-
110-
/**
111-
* @brief Print line a given string through the CLI HAL interface.
112-
* @param str String to print.
113-
*/
114-
void MINBASECLI_ARDUINO::hal_iface_println(const char* str)
115-
{
116-
_IFACE* _Serial = (_IFACE*) this->iface;
117-
_Serial->println(str);
118-
}
119-
120100
/**
121101
* @brief Check if the internal CLI HAL interface has received any data.
122102
* @return The number of bytes received by the interface.
@@ -137,6 +117,17 @@ uint8_t MINBASECLI_ARDUINO::hal_iface_read()
137117
return _Serial->read();
138118
}
139119

120+
/**
121+
* @brief Print a byte with ASCII encode to CLI HAL interface.
122+
* @param data_byte Byte of data to write.
123+
*/
124+
void MINBASECLI_ARDUINO::hal_iface_print(const uint8_t data_byte)
125+
{
126+
_IFACE* _Serial = (_IFACE*) this->iface;
127+
128+
_Serial->write(data_byte);
129+
}
130+
140131
/**
141132
* @brief Timer1 setup and initialization to count System Tick.
142133
*/

src/hal/arduino/minbasecli_arduino.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/**
33
* @file minbasecli_arduino.h
44
* @author Jose Miguel Rios Rubio <[email protected]>
5-
* @date 08-02-2022
6-
* @version 1.0.1
5+
* @date 10-02-2022
6+
* @version 1.0.2
77
*
88
* @section DESCRIPTION
99
*
@@ -66,10 +66,9 @@ class MINBASECLI_ARDUINO
6666
protected:
6767
bool hal_setup(const uint32_t baud_rate);
6868
bool hal_setup(void* iface, const uint32_t baud_rate);
69-
void hal_iface_print(const char* str);
70-
void hal_iface_println(const char* str);
7169
size_t hal_iface_available();
7270
uint8_t hal_iface_read();
71+
void hal_iface_print(const uint8_t data_byte);
7372
void hal_millis_init();
7473
uint32_t hal_millis();
7574
};

src/hal/avr/minbasecli_avr.cpp

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/**
33
* @file minbasecli_avr.cpp
44
* @author Jose Miguel Rios Rubio <[email protected]>
5-
* @date 08-02-2022
6-
* @version 1.0.1
5+
* @date 10-02-2022
6+
* @version 1.0.2
77
*
88
* @section DESCRIPTION
99
*
@@ -106,39 +106,6 @@ bool MINBASECLI_AVR::hal_setup(void* iface, const uint32_t baud_rate)
106106
return hal_setup(baud_rate);
107107
}
108108

109-
/**
110-
* @brief Print a given string through the CLI HAL interface.
111-
* @param str String to print.
112-
*/
113-
void MINBASECLI_AVR::hal_iface_print(const char* str)
114-
{
115-
_IFACE* _Serial = (_IFACE*) this->iface;
116-
117-
// Write each byte until end of string
118-
while (*str != '\0')
119-
{
120-
_Serial->write(*str);
121-
str = str + 1;
122-
}
123-
}
124-
125-
/**
126-
* @brief Print line a given string through the CLI HAL interface.
127-
* @param str String to print.
128-
*/
129-
void MINBASECLI_AVR::hal_iface_println(const char* str)
130-
{
131-
_IFACE* _Serial = (_IFACE*) this->iface;
132-
133-
// Write each byte until end of string
134-
while (*str != '\0')
135-
{
136-
_Serial->write(*str);
137-
str = str + 1;
138-
}
139-
_Serial->write((uint8_t)('\n'));
140-
}
141-
142109
/**
143110
* @brief Check if the internal CLI HAL interface has received any data.
144111
* @return The number of bytes received by the interface.
@@ -166,6 +133,17 @@ uint8_t MINBASECLI_AVR::hal_iface_read()
166133
return read_byte;
167134
}
168135

136+
/**
137+
* @brief Print a byte with ASCII encode to CLI HAL interface.
138+
* @param data_byte Byte of data to write.
139+
*/
140+
void MINBASECLI_AVR::hal_iface_print(const uint8_t data_byte)
141+
{
142+
_IFACE* _Serial = (_IFACE*) this->iface;
143+
144+
_Serial->write(data_byte);
145+
}
146+
169147
/**
170148
* @brief Timer1 setup and initialization to count System Tick.
171149
*/

src/hal/avr/minbasecli_avr.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/**
33
* @file minbasecli_avr.h
44
* @author Jose Miguel Rios Rubio <[email protected]>
5-
* @date 08-02-2022
6-
* @version 1.0.1
5+
* @date 10-02-2022
6+
* @version 1.0.2
77
*
88
* @section DESCRIPTION
99
*
@@ -67,10 +67,9 @@ class MINBASECLI_AVR
6767
protected:
6868
bool hal_setup(const uint32_t baud_rate);
6969
bool hal_setup(void* iface, const uint32_t baud_rate);
70-
void hal_iface_print(const char* str);
71-
void hal_iface_println(const char* str);
7270
size_t hal_iface_available();
7371
uint8_t hal_iface_read();
72+
void hal_iface_print(const uint8_t data_byte);
7473
void hal_millis_init();
7574
uint32_t hal_millis();
7675

src/hal/espidf/minbasecli_espidf.cpp

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/**
33
* @file minbasecli_espidf.cpp
44
* @author Jose Miguel Rios Rubio <[email protected]>
5-
* @date 08-02-2022
6-
* @version 1.0.1
5+
* @date 10-02-2022
6+
* @version 1.0.2
77
*
88
* @section DESCRIPTION
99
*
@@ -111,24 +111,6 @@ bool MINBASECLI_ESPIDF::hal_setup(void* iface, const uint32_t baud_rate)
111111
return hal_setup(baud_rate);
112112
}
113113

114-
/**
115-
* @brief Print a given string through the CLI HAL interface.
116-
* @param str String to print.
117-
*/
118-
void MINBASECLI_ESPIDF::hal_iface_print(const char* str)
119-
{
120-
printf("%s", str);
121-
}
122-
123-
/**
124-
* @brief Print line a given string through the CLI HAL interface.
125-
* @param str String to print.
126-
*/
127-
void MINBASECLI_ESPIDF::hal_iface_println(const char* str)
128-
{
129-
printf("%s\n", str);
130-
}
131-
132114
size_t MINBASECLI_ESPIDF::hal_iface_available()
133115
{
134116
return (this->th_rx_read_head - this->th_rx_read_tail);
@@ -150,6 +132,15 @@ uint8_t MINBASECLI_ESPIDF::hal_iface_read()
150132
return th_rx_read[this->th_rx_read_tail];
151133
}
152134

135+
/**
136+
* @brief Print a byte with ASCII encode to CLI HAL interface.
137+
* @param data_byte Byte of data to write.
138+
*/
139+
void MINBASECLI_ESPIDF::hal_iface_print(const uint8_t data_byte)
140+
{
141+
printf("%c", (char)(data_byte));
142+
}
143+
153144
/**
154145
* @brief Timer setup and initialization to count System Tick.
155146
*/

src/hal/espidf/minbasecli_espidf.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/**
33
* @file minbasecli_espidf.h
44
* @author Jose Miguel Rios Rubio <[email protected]>
5-
* @date 08-02-2022
6-
* @version 1.0.1
5+
* @date 10-02-2022
6+
* @version 1.0.2
77
*
88
* @section DESCRIPTION
99
*
@@ -68,10 +68,9 @@ class MINBASECLI_ESPIDF
6868
protected:
6969
bool hal_setup(const uint32_t baud_rate);
7070
bool hal_setup(void* iface, const uint32_t baud_rate);
71-
void hal_iface_print(const char* str);
72-
void hal_iface_println(const char* str);
7371
size_t hal_iface_available();
7472
uint8_t hal_iface_read();
73+
void hal_iface_print(const uint8_t data_byte);
7574
void hal_millis_init();
7675
uint32_t hal_millis();
7776

src/hal/linux/minbasecli_linux.cpp

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/**
33
* @file minbasecli_linux.cpp
44
* @author Jose Miguel Rios Rubio <[email protected]>
5-
* @date 08-02-2022
6-
* @version 1.0.1
5+
* @date 10-02-2022
6+
* @version 1.0.2
77
*
88
* @section DESCRIPTION
99
*
@@ -99,24 +99,6 @@ bool MINBASECLI_LINUX::hal_setup(void* iface, const uint32_t baud_rate)
9999
return hal_setup(baud_rate);
100100
}
101101

102-
/**
103-
* @brief Print a given string through the CLI HAL interface.
104-
* @param str String to print.
105-
*/
106-
void MINBASECLI_LINUX::hal_iface_print(const char* str)
107-
{
108-
printf("%s", str);
109-
}
110-
111-
/**
112-
* @brief Print line a given string through the CLI HAL interface.
113-
* @param str String to print.
114-
*/
115-
void MINBASECLI_LINUX::hal_iface_println(const char* str)
116-
{
117-
printf("%s\n", str);
118-
}
119-
120102
size_t MINBASECLI_LINUX::hal_iface_available()
121103
{
122104
return (this->th_rx_read_head - this->th_rx_read_tail);
@@ -138,6 +120,15 @@ uint8_t MINBASECLI_LINUX::hal_iface_read()
138120
return th_rx_read[this->th_rx_read_tail];
139121
}
140122

123+
/**
124+
* @brief Print a byte with ASCII encode to CLI HAL interface.
125+
* @param data_byte Byte of data to write.
126+
*/
127+
void MINBASECLI_LINUX::hal_iface_print(const uint8_t data_byte)
128+
{
129+
printf("%c", (char)(data_byte));
130+
}
131+
141132
/**
142133
* @brief Initialize System-Tick count.
143134
*/

src/hal/linux/minbasecli_linux.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/**
33
* @file minbasecli_linux.h
44
* @author Jose Miguel Rios Rubio <[email protected]>
5-
* @date 08-02-2022
6-
* @version 1.0.1
5+
* @date 10-02-2022
6+
* @version 1.0.2
77
*
88
* @section DESCRIPTION
99
*
@@ -68,10 +68,9 @@ class MINBASECLI_LINUX
6868
protected:
6969
bool hal_setup(const uint32_t baud_rate);
7070
bool hal_setup(void* iface, const uint32_t baud_rate);
71-
void hal_iface_print(const char* str);
72-
void hal_iface_println(const char* str);
7371
size_t hal_iface_available();
7472
uint8_t hal_iface_read();
73+
void hal_iface_print(const uint8_t data_byte);
7574
void hal_millis_init();
7675
uint32_t hal_millis();
7776

src/hal/none/minbasecli_none.cpp

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/**
33
* @file minbasecli_none.cpp
44
* @author Jose Miguel Rios Rubio <[email protected]>
5-
* @date 08-02-2022
6-
* @version 1.0.1
5+
* @date 10-02-2022
6+
* @version 1.0.2
77
*
88
* @section DESCRIPTION
99
*
@@ -95,24 +95,6 @@ bool MINBASECLI_LINUX::hal_setup(void* iface)
9595
return launch_stdin_read_thread();
9696
}
9797

98-
/**
99-
* @brief Print a given string through the CLI HAL interface.
100-
* @param str String to print.
101-
*/
102-
void MINBASECLI_NONE::hal_iface_print(const char* str)
103-
{
104-
return;
105-
}
106-
107-
/**
108-
* @brief Print line a given string through the CLI HAL interface.
109-
* @param str String to print.
110-
*/
111-
void MINBASECLI_NONE::hal_iface_println(const char* str)
112-
{
113-
return;
114-
}
115-
11698
/**
11799
* @brief Check if the internal CLI HAL interface has received any data.
118100
* @return The number of bytes received by the interface.
@@ -131,6 +113,15 @@ uint8_t MINBASECLI_NONE::hal_iface_read()
131113
return 0;
132114
}
133115

116+
/**
117+
* @brief Print a byte with ASCII encode to CLI HAL interface.
118+
* @param data_byte Byte of data to write.
119+
*/
120+
void MINBASECLI_NONE::hal_iface_print(const uint8_t data_byte)
121+
{
122+
return;
123+
}
124+
134125
/**
135126
* @brief Initialize System-Tick count.
136127
*/

src/hal/none/minbasecli_none.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/**
33
* @file minbasecli_none.h
44
* @author Jose Miguel Rios Rubio <[email protected]>
5-
* @date 08-02-2022
6-
* @version 1.0.1
5+
* @date 10-02-2022
6+
* @version 1.0.2
77
*
88
* @section DESCRIPTION
99
*
@@ -58,10 +58,9 @@ class MINBASECLI_NONE
5858
protected:
5959
bool hal_setup();
6060
bool hal_setup(void* iface);
61-
void hal_iface_print(const char* str);
62-
void hal_iface_println(const char* str);
6361
size_t hal_iface_available();
6462
uint8_t hal_iface_read();
63+
void hal_iface_print(const uint8_t data_byte);
6564
void hal_millis_init();
6665
uint32_t hal_millis();
6766

0 commit comments

Comments
 (0)