Commit fc39198b authored by Guillaume Gonnet's avatar Guillaume Gonnet
Browse files

Add implementation of stdio.

parent 52d44dc0
/*
Implement stdio and fetch GPS data.
Copyright (C) 2019, ENSIMAG students
This project is under the MIT license
*/
#include <mutex.h>
#include <stdio.h>
typedef struct {
mutex_t mutex = MUTEX_INIT;
} gps_isr_info_t;
static gps_isr_info_t gps_isr_info;
// Handle
static void gps_isr(gps_isr_info_t *info, char c)
{
mutex_unlock(&info->mutex);
}
// STDIN is disabled in our application.
ssize_t stdio_read(void *buffer, size_t count)
{
return 0;
}
// Write STDOUT data to serial port 0.
ssize_t stdio_write(const void *buffer, size_t len)
{
uart_write(STDIO_UART_DEV, (const uint8_t *)buffer, len);
return len;
}
// Initialize STDIO module.
void stdio_init(void)
{
uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, (uart_rx_cb_t)gps_isr, &gps_isr_info);
}
/*
Fetch GPS data.
Copyright (C) 2019, ENSIMAG students
This project is under the MIT license
*/
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment