Skip to content

Commit

Permalink
feat(uart):implement header file
Browse files Browse the repository at this point in the history
-add function UART_Init()
-add function UART_PutChar()
-add function UART_PutString()
  • Loading branch information
abdullahbagyapan committed Apr 19, 2024
1 parent 7f1fec7 commit b16b16b
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions uart/uart.c
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);

}

0 comments on commit b16b16b

Please sign in to comment.