Example gpio hal usage
parent
ea3ab2e263
commit
65e45b2cc2
|
|
@ -1,8 +1,11 @@
|
||||||
#include "logic/mm_control.h"
|
#include "logic/mm_control.h"
|
||||||
|
#include "hal/gpio.h"
|
||||||
|
|
||||||
/// One-time setup of HW and SW components
|
/// One-time setup of HW and SW components
|
||||||
/// Called before entering the loop() function
|
/// Called before entering the loop() function
|
||||||
void setup(){
|
void setup(){
|
||||||
|
using namespace hal::gpio;
|
||||||
|
hal::gpio::Init(GPIOB, 1, GPIO_InitTypeDef(Mode::output, Level::low));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -27,6 +30,11 @@ void loop(){
|
||||||
int main() {
|
int main() {
|
||||||
setup();
|
setup();
|
||||||
for(;;){
|
for(;;){
|
||||||
|
using namespace hal::gpio;
|
||||||
|
WritePin(GPIOB, 5, Level::low);
|
||||||
|
TogglePin(GPIOB, 6);
|
||||||
|
if (hal::gpio::ReadPin(GPIOB, 7) == hal::gpio::Level::low)
|
||||||
|
break;
|
||||||
loop();
|
loop();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue