-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-add function UART_Init() -add function UART_PutChar() -add function UART_PutString()
- Loading branch information
1 parent
7f1fec7
commit b16b16b
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
@module: UART | ||
@author: Abdullah Bagyapan | ||
@date: 19/04/2024 | ||
*/ | ||
|
||
/*================================== Libraries ==================================*/ | ||
|
||
|
||
#include "uart.h" | ||
|
||
#include "pico/stdlib.h" | ||
|
||
|
||
/*================================== Functions ==================================*/ | ||
|
||
|
||
|
||
void UART_Init(void) { | ||
|
||
// Set UART instance and baudrate | ||
uart_init(UART_DEFAULT_INSTANCE, UART_BAUDRATE); | ||
|
||
// set gpio 0 & 1 pins as UART | ||
gpio_set_function(0, GPIO_FUNC_UART); | ||
gpio_set_function(1, GPIO_FUNC_UART); | ||
|
||
} | ||
|
||
|
||
void UART_PutChar(uint8_t ui8Data) { | ||
|
||
uart_putc(UART_DEFAULT_INSTANCE, ui8Data); | ||
|
||
} | ||
|
||
|
||
void UART_PutString(uint8_t *ui8pData) { | ||
|
||
uart_puts(UART_DEFAULT_INSTANCE, ui8pData); | ||
|
||
} |