1 /* (CC-BY-NC-SA) ROBIN KRENS - ROBIN @ ROBINKRENS.NL
4 * 2019/7/25 - ROBIN KRENS
8 * Hardly a driver, but a driver nonetheless. Enables clock on
9 * a GPIOx range and sets the GPIOx pin in push-pull output mode.
10 * Basic on - off function (writing a 1 or zero 0)
13 * In the code below we enable GPIOC and use PC0 as output. But
14 * basically any GPIO range or pin could be used. Note that the
15 * output register is only word accessible.
24 #include <sys/robsys.h>
26 #include <lib/regfunc.h>
27 #include <lib/string.h>
29 #include <drivers/led.h>
34 rsetbit(RCC_APB2ENR, 5); // enable GPIOD
35 rsetbit(RCC_APB2ENR, 2); // enable GPIOA
37 //rwrite(GPIOD_CRL, 0x44444644);
38 rsetbitsfrom(GPIOD_CRL, 8, 0x6);
39 rsetbitsfrom(GPIOA_CRH, 0, 0x6);
40 rsetbit(GPIOD_ODR, 2);
41 rclrbit(GPIOA_ODR, 8);
46 rsetbit(GPIOD_ODR, 2);
47 rclrbit(GPIOA_ODR, 8);
52 rclrbit(GPIOD_ODR, 2);
53 rsetbit(GPIOA_ODR, 8);