hw-uart: consolidate platform gems into ports/ directories

Move hw-esp32-uart and hw-rp2040-uart into hw-uart/ports/esp32/
and hw-uart/ports/rp2040/ using the new ports build system.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-03-27 22:48:53 +09:00
parent 53a43e9d36
commit a8c82b506f
5 changed files with 11 additions and 36 deletions
-7
View File
@@ -1,7 +0,0 @@
MRuby::Gem::Specification.new('hw-esp32-uart') do |spec|
spec.license = 'MIT'
spec.author = 'mruby developers'
spec.summary = 'UART HAL for ESP32'
spec.add_dependency 'hw-uart'
end
-7
View File
@@ -1,7 +0,0 @@
MRuby::Gem::Specification.new('hw-rp2040-uart') do |spec|
spec.license = 'MIT'
spec.author = 'mruby developers'
spec.summary = 'UART HAL for RP2040'
spec.add_dependency 'hw-uart'
end
+11 -12
View File
@@ -5,12 +5,11 @@ It is designed for embedded platforms such as ESP32 and RP2040.
## Architecture
- **hw-uart** (this gem) - Ruby API, C bindings, ring buffer, and HAL
function declarations
- **hw-esp32-uart** - HAL implementation for ESP32 (using ESP-IDF UART
driver with FreeRTOS task for RX)
- **hw-rp2040-uart** - HAL implementation for RP2040 (using Pico SDK
with IRQ-driven RX)
Platform-specific HAL implementations are in `ports/` directories:
- `ports/esp32/` - ESP32 using ESP-IDF UART driver with FreeRTOS
task for RX
- `ports/rp2040/` - RP2040 using Pico SDK with IRQ-driven RX
Received data is buffered in a ring buffer (allocated by the common
gem) that the platform HAL populates via interrupt or task. The ring
@@ -21,14 +20,14 @@ buffer size must be a power of two.
```ruby
# For ESP32
MRuby::CrossBuild.new('esp32') do |conf|
# ...
conf.gem "#{root}/mrbgems/hw-esp32-uart"
conf.ports :esp32
conf.gem core: 'hw-uart'
end
# For RP2040
MRuby::CrossBuild.new('rp2040') do |conf|
# ...
conf.gem "#{root}/mrbgems/hw-rp2040-uart"
conf.ports :rp2040
conf.gem core: 'hw-uart'
end
```
@@ -153,8 +152,8 @@ Set the line ending used by `puts`. Must be `"\n"`, `"\r"`, or
## HAL Interface
To add support for a new platform, create a gem that depends on
`hw-uart` and implements the following C functions declared in
To add support for a new platform, create a `ports/<name>/`
directory and implement the following C functions declared in
`<mruby/uart.h>`:
```c
@@ -145,8 +145,3 @@ mrb_uart_clear_tx(int unit)
{
/* not supported on ESP-IDF */
}
#include <mruby.h>
void mrb_hw_esp32_uart_gem_init(mrb_state *mrb) {}
void mrb_hw_esp32_uart_gem_final(mrb_state *mrb) {}
@@ -134,8 +134,3 @@ mrb_uart_clear_tx(int unit)
{
/* not supported on RP2040 */
}
#include <mruby.h>
void mrb_hw_rp2040_uart_gem_init(mrb_state *mrb) {}
void mrb_hw_rp2040_uart_gem_final(mrb_state *mrb) {}