- Zadatak - Pitaj Boga jel valja ovo, ali vidim da nitko nije ništa stavio pa ako vidite grešku, javite
//retarget.c
#include <stdio.h> // decl. of FILE, __stdin, __stdout
#include <rt_sys.h> // declaration of _sys_exit, etc.
// to warn in all semihosting calls are not redefined
__asm(".global __use_no_semihosting");
int fputc(int c, FILE *f) {
(void)f; // suppress warning for unused parameter
GPIOD -> IDR &= 0x00000000;
GPIOD -> IDR |= (c << 8); // GPIO 8-15
return(c);
}
int fgetc(FILE *f) {
volatile uint32_t c;
(void)f; // suppress warning for unused parameter
c = GPIOD -> (IDR & 0x000000FF); // GPIO 0-7
return( c );
}
int ferror(FILE *f) {
(void)f;
return 0;
}
__attribute__((noreturn)) void _sys_exit(int return_code){
(void)return_code;
while(1);
}
// main
#include <stm32f407xx.h>
#include <stdio.h>
extern void init_GPIOD(void);
int main (void) {
init_GPIOD(); // Inicijalizacija GPIOD
volatile uint32_t c;
while (1) {
scanf("%d",c);
if (c%2 == 0){
c++;
}
printf ("c");
}}