Files
Embedded-Hacking/drivers/0x04_pwm_cbm/Inc/rp2350_led.h
T
Kevin Thomas 7a42b2e088 Add 0x04_pwm_cbm: bare-metal RP2350 PWM driver
- PWM slice 4, channel B on GPIO25 (onboard LED)
- Duty cycle sweep 0-100% in 5% steps for breathing effect
- Wrap 9999 with no clock division (~650 Hz from ROSC)
- UART reports each duty step
- 1390B FLASH, 11 source files, zero warnings
2026-04-05 16:21:47 -04:00

64 lines
1.6 KiB
C

/**
******************************************************************************
* @file rp2350_led.h
* @author Kevin Thomas
* @brief LED driver header for RP2350.
*
* High-level GPIO output / LED driver wrapping the
* low-level GPIO functions.
*
******************************************************************************
* @attention
*
* Copyright (c) 2026 Kevin Thomas.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
#ifndef __RP2350_LED_H
#define __RP2350_LED_H
#include "rp2350.h"
/**
* @brief Initialize a GPIO pin as a push-pull digital output.
* @param pin GPIO pin number to configure
* @retval None
*/
void led_init(uint32_t pin);
/**
* @brief Drive the output pin high (LED on).
* @param pin GPIO pin number
* @retval None
*/
void led_on(uint32_t pin);
/**
* @brief Drive the output pin low (LED off).
* @param pin GPIO pin number
* @retval None
*/
void led_off(uint32_t pin);
/**
* @brief Toggle the current state of the output pin.
* @param pin GPIO pin number
* @retval None
*/
void led_toggle(uint32_t pin);
/**
* @brief Query the current drive state of the output pin.
* @param pin GPIO pin number
* @retval bool true if the pin is driven high, false if low
*/
bool led_get_state(uint32_t pin);
#endif /* __RP2350_LED_H */