mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
0ff41e4e28
Add three new gems for GPIO pin control: - hw-gpio: common Ruby API, C bindings, and HAL header - hw-esp32-gpio: ESP32 HAL using ESP-IDF GPIO driver - hw-rp2040-gpio: RP2040 HAL using Pico SDK Co-authored-by: Claude <noreply@anthropic.com>
32 lines
734 B
C
32 lines
734 B
C
#ifndef MRUBY_GPIO_H
|
|
#define MRUBY_GPIO_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* direction/mode flags (bitmask) */
|
|
#define MRB_GPIO_IN 0x01
|
|
#define MRB_GPIO_OUT 0x02
|
|
#define MRB_GPIO_HIGH_Z 0x04
|
|
#define MRB_GPIO_PULL_UP 0x08
|
|
#define MRB_GPIO_PULL_DOWN 0x10
|
|
#define MRB_GPIO_OPEN_DRAIN 0x20
|
|
|
|
/* HAL functions - implemented by hw-<platform>-gpio gems */
|
|
void mrb_gpio_init(uint8_t pin);
|
|
void mrb_gpio_set_dir(uint8_t pin, uint8_t flags);
|
|
void mrb_gpio_pull_up(uint8_t pin);
|
|
void mrb_gpio_pull_down(uint8_t pin);
|
|
void mrb_gpio_open_drain(uint8_t pin);
|
|
int mrb_gpio_read(uint8_t pin);
|
|
void mrb_gpio_write(uint8_t pin, uint8_t val);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* MRUBY_GPIO_H */
|