Flash pages are only erased as needed during the flash routine, which makes flashing faster as well as making the transfer consistent. Later datasheets have the flash clock set to 2MHz. I've set it to 2MHz here. I may undo this change later depending on how slow loading a 14K firmware feels. Was able to save enough space to reduce bootloader size from almost 2.5K to 2K exactly. Adjusted flash offsets to start from 0x800. GPIO values are now mostly reset to power-on defaults. Fixed some formatting. Removed dead code.
36 lines
667 B
C
36 lines
667 B
C
/*
|
|
* user_io.h
|
|
*
|
|
* Created on: Jun 23, 2023
|
|
* Author: true
|
|
*/
|
|
|
|
#ifndef CODE_INC_USER_IO_H_
|
|
#define CODE_INC_USER_IO_H_
|
|
|
|
|
|
#include "hk32f030m.h"
|
|
|
|
|
|
|
|
// bootloader activation button (MODE button)
|
|
#define BTN_CLK RCC_AHBPeriph_GPIOA
|
|
#define BTN_PORT GPIOA
|
|
#define BTN_PIN 1
|
|
#define BTN_ACT_DIR 0 // when pushed, is signal high (1) or low (0)?
|
|
|
|
// bootloader indicator LED
|
|
#define LED_CLK RCC_AHBPeriph_GPIOD
|
|
#define LED_PORT GPIOD
|
|
#define LED_PIN 7
|
|
#define LED_ACT_DIR 0 // to light, does signal need to be high (1) or low (0)?
|
|
|
|
|
|
|
|
void user_io_init();
|
|
void user_led_init();
|
|
|
|
|
|
|
|
#endif /* CODE_INC_USER_IO_H_ */
|