Skip to content

Commit f1367c0

Browse files
committed
Add serial_init_direct(), serial_set_flow_control_direct() functions to HAL API
1 parent 80b4676 commit f1367c0

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

hal/serial_api.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,23 @@ typedef struct serial_s serial_t;
104104

105105
#endif
106106

107+
typedef struct {
108+
int peripheral;
109+
PinName tx_pin;
110+
int tx_function;
111+
PinName rx_pin;
112+
int rx_function;
113+
bool stdio_config;
114+
} serial_pinmap_t;
115+
116+
typedef struct {
117+
int peripheral;
118+
PinName tx_flow_pin;
119+
int tx_flow_function;
120+
PinName rx_flow_pin;
121+
int rx_flow_function;
122+
} serial_fc_pinmap_t;
123+
107124
#ifdef __cplusplus
108125
extern "C" {
109126
#endif
@@ -203,6 +220,15 @@ extern "C" {
203220
*/
204221
void serial_init(serial_t *obj, PinName tx, PinName rx);
205222

223+
/** Initialize the serial peripheral. It sets the default parameters for serial
224+
* peripheral, and configures its specifieds pins.
225+
*
226+
* @param obj The serial object
227+
* @param pinmap pointer to strucure which holds static pinmap
228+
*/
229+
void serial_init_direct(serial_t *obj, const serial_pinmap_t *pinmap);
230+
231+
206232
/** Release the serial peripheral, not currently invoked. It requires further
207233
* resource management.
208234
*
@@ -304,6 +330,15 @@ void serial_pinout_tx(PinName tx);
304330
* @param txflow The RX pin name
305331
*/
306332
void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow);
333+
334+
/** Configure the serial for the flow control. It sets flow control in the hardware
335+
* if a serial peripheral supports it, otherwise software emulation is used.
336+
*
337+
* @param obj The serial object
338+
* @param type The type of the flow control. Look at the available FlowControl types.
339+
* @param pinmap Pointer to strucure which holds static pinmap
340+
*/
341+
void serial_set_flow_control_direct(serial_t *obj, FlowControl type, const serial_fc_pinmap_t *pinmap);
307342
#endif
308343

309344
/** Get the pins that support Serial TX

0 commit comments

Comments
 (0)