Cleanup and refactoring of the STM32w port
This is a general cleanup of things like code style issues and code structure of the STM32w port to make it more like the rest of Contiki is structured.
This commit is contained in:
parent
12b3d02ba1
commit
a5046e83c7
118 changed files with 4470 additions and 4281 deletions
43
cpu/stm32w108/e_stdio/src/sp-puts.c
Normal file
43
cpu/stm32w108/e_stdio/src/sp-puts.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
#include <stdio.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)
|
||||
{
|
||||
#if 1 //VC090825: cleaner and faster version
|
||||
int len = 0;
|
||||
while ( str && (*str) )
|
||||
{
|
||||
__io_putchar ( *(str++) );
|
||||
len++;
|
||||
}
|
||||
#else //VC090825: cleaner, lighter and faster version
|
||||
int len = strlen ( str );
|
||||
_SMALL_PRINTF_puts(str, len, 0) ;
|
||||
#endif //VC090825: cleaner, lighter and faster version
|
||||
__io_putchar ( '\n' );
|
||||
return len;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue