Cosmetics.
This commit is contained in:
parent
44442e44c9
commit
5060261413
@ -17,6 +17,6 @@
|
|||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
BINARY = led
|
BINARY = led
|
||||||
|
|
||||||
include ../../Makefile.include
|
include ../../Makefile.include
|
||||||
|
@ -31,20 +31,17 @@ void clock_setup(void)
|
|||||||
|
|
||||||
/* Enable GPIOB clock. */
|
/* Enable GPIOB clock. */
|
||||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpio_setup(void)
|
void gpio_setup(void)
|
||||||
{
|
{
|
||||||
/* Set GPIO6 and 7 (in GPIO port A) to 'output push-pull'. */
|
/* Set GPIO6 and 7 (in GPIO port A) to 'output push-pull'. */
|
||||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||||
GPIO_CNF_OUTPUT_PUSHPULL,
|
GPIO_CNF_OUTPUT_PUSHPULL, GPIO6 | GPIO7);
|
||||||
GPIO6 | GPIO7);
|
|
||||||
|
|
||||||
/* Set GPIO0 and 1 (in GPIO port B) to 'output push-pull'. */
|
/* Set GPIO0 and 1 (in GPIO port B) to 'output push-pull'. */
|
||||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
|
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
|
||||||
GPIO_CNF_OUTPUT_PUSHPULL,
|
GPIO_CNF_OUTPUT_PUSHPULL, GPIO0 | GPIO1);
|
||||||
GPIO0 | GPIO1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
@ -54,7 +51,7 @@ int main(void)
|
|||||||
clock_setup();
|
clock_setup();
|
||||||
gpio_setup();
|
gpio_setup();
|
||||||
|
|
||||||
/* Blink the LED (PC12) on the board. */
|
/* Blink the LEDs on the board. */
|
||||||
while (1) {
|
while (1) {
|
||||||
gpio_toggle(GPIOA, GPIO6); /* LED on/off */
|
gpio_toggle(GPIOA, GPIO6); /* LED on/off */
|
||||||
for (i = 0; i < 800000; i++); /* Wait (needs -O0 CFLAGS). */
|
for (i = 0; i < 800000; i++); /* Wait (needs -O0 CFLAGS). */
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Linker script for Olimex STM32-H103 (STM32F103RBT6, 128K flash, 20K RAM). */
|
/* Linker script for Open-BLDC (STM32F103CBT6, 128K flash, 20K RAM). */
|
||||||
|
|
||||||
/* Define memory regions. */
|
/* Define memory regions. */
|
||||||
MEMORY
|
MEMORY
|
||||||
|
@ -17,6 +17,6 @@
|
|||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
##
|
##
|
||||||
|
|
||||||
BINARY = systick
|
BINARY = systick
|
||||||
|
|
||||||
include ../../Makefile.include
|
include ../../Makefile.include
|
||||||
|
@ -30,6 +30,7 @@ void gpio_setup(void)
|
|||||||
{
|
{
|
||||||
/* Enable GPIOA clock. */
|
/* Enable GPIOA clock. */
|
||||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||||
|
|
||||||
/* Enable GPIOB clock. */
|
/* Enable GPIOB clock. */
|
||||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
|
||||||
|
|
||||||
@ -51,11 +52,11 @@ void gpio_setup(void)
|
|||||||
GPIO_CNF_OUTPUT_PUSHPULL, GPIO1);
|
GPIO_CNF_OUTPUT_PUSHPULL, GPIO1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sys_tick_handler()
|
void sys_tick_handler(void)
|
||||||
{
|
{
|
||||||
temp32++;
|
temp32++;
|
||||||
|
|
||||||
/* we call this handler every 1ms so 1000ms = 1s on/off */
|
/* We call this handler every 1ms so 1000ms = 1s on/off. */
|
||||||
if (temp32 == 1000) {
|
if (temp32 == 1000) {
|
||||||
gpio_toggle(GPIOA, GPIO6); /* LED2 on/off */
|
gpio_toggle(GPIOA, GPIO6); /* LED2 on/off */
|
||||||
temp32 = 0;
|
temp32 = 0;
|
||||||
@ -64,7 +65,7 @@ void sys_tick_handler()
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
rcc_clock_setup_in_hse_16mhz_out_72mhz();
|
rcc_clock_setup_in_hse_16mhz_out_72mhz();
|
||||||
gpio_setup();
|
gpio_setup();
|
||||||
|
|
||||||
gpio_clear(GPIOA, GPIO7); /* LED1 on */
|
gpio_clear(GPIOA, GPIO7); /* LED1 on */
|
||||||
@ -80,10 +81,10 @@ int main(void)
|
|||||||
|
|
||||||
systick_interrupt_enable();
|
systick_interrupt_enable();
|
||||||
|
|
||||||
/* start counting */
|
/* Start counting. */
|
||||||
systick_counter_enable();
|
systick_counter_enable();
|
||||||
|
|
||||||
while(1); /* Halt. */
|
while (1); /* Halt. */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Linker script for an STM32F103RBT6 board (128K flash, 20K RAM). */
|
/* Linker script for an STM32F103CBT6 board (128K flash, 20K RAM). */
|
||||||
|
|
||||||
/* Define memory regions. */
|
/* Define memory regions. */
|
||||||
MEMORY
|
MEMORY
|
||||||
|
Loading…
x
Reference in New Issue
Block a user