URL
https://opencores.org/ocsvn/neorv32/neorv32/trunk
Subversion Repositories neorv32
Compare Revisions
- This comparison shows the changes necessary to convert path
/neorv32/trunk/sw/example/blink_led
- from Rev 36 to Rev 37
- ↔ Reverse comparison
Rev 36 → Rev 37
/main.c
48,17 → 48,22
/**@{*/ |
/** UART BAUD rate */ |
#define BAUD_RATE 19200 |
/** Use the custom ASM version for blinking the LEDs if != 0 */ |
#define USE_ASM_VERSION 0 |
/** Use the custom ASM version for blinking the LEDs defined (= uncommented) */ |
//#define USE_ASM_VERSION |
/**@}*/ |
|
|
/**********************************************************************//** |
* ASM function to blink LEDs (if enabled) |
* ASM function to blink LEDs |
**************************************************************************/ |
extern void blink_led_asm(uint32_t gpio_out_addr); |
|
/**********************************************************************//** |
* C function to blink LEDs |
**************************************************************************/ |
void blink_led_c(void); |
|
|
/**********************************************************************//** |
* Main function; shows an incrementing 8-bit counter on GPIO.output(7:0). |
* |
85,9 → 90,26
neorv32_uart_print("Blinking LED demo program\n"); |
|
|
// use ASM version of LED blinking (file: blink_led_in_asm.S) |
#ifdef USE_ASM_VERSION |
|
blink_led_asm((uint32_t)(&GPIO_OUTPUT)); |
|
// use C version of LED blinking |
#if (USE_ASM_VERSION == 0) |
#else |
|
blink_led_c(); |
|
#endif |
return 0; |
} |
|
|
/**********************************************************************//** |
* C-version of blinky LED counter |
**************************************************************************/ |
void blink_led_c(void) { |
|
neorv32_gpio_port_set(0); // clear gpio output put |
|
int cnt = 0; |
96,12 → 118,4
neorv32_gpio_port_set(cnt++ & 0xFF); // increment counter and mask for lowest 8 bit |
neorv32_cpu_delay_ms(200); // wait 200ms using busy wait |
} |
|
// use ASM version of LED blinking (file: blink_led_in_asm.S) |
#else |
|
blink_led_asm((uint32_t)(&GPIO_OUTPUT)); |
|
#endif |
return 0; |
} |