You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
611 B
43 lines
611 B
#include "bsl_nucleo_f042k6.hpp"
|
|
int startBSL()
|
|
{
|
|
stmStart();
|
|
Delay delay;
|
|
|
|
STM_Pin<LED_PIN, LED_PORT> led;
|
|
STM_Pin<A0_PIN, A0_PORT> pin_a0;
|
|
|
|
led.init();
|
|
led.setMode(Pin::mode::output);
|
|
led.setSpeed(Pin::speed::fast);
|
|
|
|
pin_a0.init();
|
|
pin_a0.setMode(Pin::mode::input);
|
|
pin_a0.setSpeed(Pin::speed::slow);
|
|
pin_a0.setPullUpDonw(Pin::pullUpDown::pullDown);
|
|
|
|
uint8_t i = 0;
|
|
|
|
for(i = 0 ; i < 10 ; i++)
|
|
{
|
|
delay.ms(100);
|
|
led.write(true);
|
|
delay.ms(100);
|
|
led.write(false);
|
|
}
|
|
|
|
while(1)
|
|
{
|
|
if(pin_a0.read())
|
|
{
|
|
led.write(true);
|
|
}
|
|
else
|
|
{
|
|
led.write(false);
|
|
}
|
|
}
|
|
return 1;
|
|
}
|
|
|