mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-28 07:51:19 +01:00
cpu: msp430: add write() + needed libc header fixes
This commit is contained in:
parent
157f8c93ad
commit
04bc408931
22
cpu/msp430-common/include/sys/types.h
Normal file
22
cpu/msp430-common/include/sys/types.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2014 INRIA
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
#ifndef SYS_TYPES_H_
|
||||
#define SYS_TYPES_H_
|
||||
|
||||
#include "msp430_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYS_TYPES_H_ */
|
||||
@ -18,6 +18,9 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "uart_stdio.h"
|
||||
|
||||
/**
|
||||
@ -37,6 +40,18 @@ int getchar(void)
|
||||
int putchar(int c)
|
||||
{
|
||||
char _c = c;
|
||||
uart_stdio_write(&_c, 1);
|
||||
return 1;
|
||||
return uart_stdio_write(&_c, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write nbyte characters to the STDIO UART interface
|
||||
*/
|
||||
ssize_t write(int fildes, const void *buf, size_t nbyte)
|
||||
{
|
||||
if (fildes == STDOUT_FILENO) {
|
||||
return uart_stdio_write(buf, nbyte);
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user