Updated Drivers

This commit is contained in:
Kevin Thomas
2026-03-23 09:33:04 -04:00
parent 6ee30d0520
commit 91faba6800
31 changed files with 827 additions and 337 deletions
+11 -2
View File
@@ -43,15 +43,24 @@
#define LED_PIN 25
#define BLINK_DELAY_MS 500
/**
* @brief Application entry point for the LED blink demo
*
* Initializes the onboard LED and enters an infinite loop that
* toggles the LED state every BLINK_DELAY_MS milliseconds.
*
* @return int Does not return
*/
int main(void) {
stdio_init_all();
blink_init(LED_PIN);
printf("Blink driver initialized on GPIO %d\r\n", LED_PIN);
while (true) {
blink_toggle(LED_PIN);
printf("LED: %s\r\n", blink_get_state(LED_PIN) ? "ON" : "OFF");
sleep_ms(BLINK_DELAY_MS);
}
}
}
}
+5
View File
@@ -31,24 +31,29 @@
#include "pico/stdlib.h"
#include "hardware/gpio.h"
void blink_init(uint32_t pin) {
gpio_init(pin);
gpio_set_dir(pin, GPIO_OUT);
gpio_put(pin, false);
}
void blink_on(uint32_t pin) {
gpio_put(pin, true);
}
void blink_off(uint32_t pin) {
gpio_put(pin, false);
}
void blink_toggle(uint32_t pin) {
gpio_put(pin, !gpio_get(pin));
}
bool blink_get_state(uint32_t pin) {
return (bool)gpio_get(pin);
}