New HAL and SimpleMAC for STM32W108.
This commit is contained in:
parent
c9af578eab
commit
eb588f1aec
89 changed files with 1503 additions and 1883 deletions
34
cpu/stm32w108/small_printf/_SP_puts.c
Normal file
34
cpu/stm32w108/small_printf/_SP_puts.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
void __io_putchar ( char );
|
||||
|
||||
void _SMALL_PRINTF_puts(const char *ptr, int len, FILE *fp)
|
||||
{
|
||||
if ( fp && ( fp->_file == -1 ) /* No file => sprintf */
|
||||
&& (fp->_flags & (__SWR | __SSTR) ) )
|
||||
{
|
||||
char *str = fp->_p;
|
||||
|
||||
for ( ; len ; len-- )
|
||||
{
|
||||
*str ++ = *ptr++;
|
||||
}
|
||||
fp->_p = str;
|
||||
}
|
||||
else /* file => printf */
|
||||
{
|
||||
for ( ; len ; len-- )
|
||||
__io_putchar ( *ptr++ );
|
||||
}
|
||||
}
|
||||
|
||||
int puts(const char *str)
|
||||
{
|
||||
int len = strlen ( str );
|
||||
_SMALL_PRINTF_puts(str, len, 0) ;
|
||||
__io_putchar ( '\n' );
|
||||
return len;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue