Run prek; remove trailing whitespace; cleanup markdown

This commit is contained in:
John Bampton
2026-05-10 14:46:11 +10:00
parent 575609f3b9
commit bda1d2d5a5
8 changed files with 36 additions and 36 deletions
+8 -8
View File
@@ -36,14 +36,14 @@ end
These flags can be combined with bitwise OR.
| Flag | Value | Description |
|---------------------|--------|----------------------------|
| `GPIO::IN` | `0x01` | Input mode |
| `GPIO::OUT` | `0x02` | Output mode |
| `GPIO::HIGH_Z` | `0x04` | High-impedance (tri-state) |
| `GPIO::PULL_UP` | `0x08` | Enable pull-up resistor |
| `GPIO::PULL_DOWN` | `0x10` | Enable pull-down resistor |
| `GPIO::OPEN_DRAIN` | `0x20` | Enable open-drain output |
| Flag | Value | Description |
| ------------------ | ------ | -------------------------- |
| `GPIO::IN` | `0x01` | Input mode |
| `GPIO::OUT` | `0x02` | Output mode |
| `GPIO::HIGH_Z` | `0x04` | High-impedance (tri-state) |
| `GPIO::PULL_UP` | `0x08` | Enable pull-up resistor |
| `GPIO::PULL_DOWN` | `0x10` | Enable pull-down resistor |
| `GPIO::OPEN_DRAIN` | `0x20` | Enable open-drain output |
### GPIO.new
+4 -4
View File
@@ -44,10 +44,10 @@ i2c = I2C.new(
#### Unit Names
| Platform | Available Units |
|----------|---------------------------------|
| ESP32 | `:ESP32_I2C0`, `:ESP32_I2C1` |
| RP2040 | `:RP2040_I2C0`, `:RP2040_I2C1` |
| Platform | Available Units |
| -------- | ------------------------------ |
| ESP32 | `:ESP32_I2C0`, `:ESP32_I2C1` |
| RP2040 | `:RP2040_I2C0`, `:RP2040_I2C1` |
On RP2040, if `sda_pin` or `scl_pin` is -1, the Pico SDK default pins are used.
+7 -7
View File
@@ -42,15 +42,15 @@ spi = SPI.new(
#### Unit Names
| Platform | Available Units |
|----------|-----------------------------------------------------|
| ESP32 | `:ESP32_SPI2_HOST`, `:ESP32_HSPI_HOST`, |
| | `:ESP32_SPI3_HOST`\*, `:ESP32_VSPI_HOST`\* |
| RP2040 | `:RP2040_SPI0`, `:RP2040_SPI1` |
| Platform | Available Units |
| -------- | ------------------------------------------ |
| ESP32 | `:ESP32_SPI2_HOST`, `:ESP32_HSPI_HOST`, |
| | `:ESP32_SPI3_HOST`\*, `:ESP32_VSPI_HOST`\* |
| RP2040 | `:RP2040_SPI0`, `:RP2040_SPI1` |
\*SPI3 availability depends on ESP32 variant.
### SPI#write(*data)
### SPI#write(\*data)
Write data to the SPI bus. Data can be Integer, Array, or String.
@@ -68,7 +68,7 @@ data = spi.read(4) # transmits 0x00 while reading
data = spi.read(4, 0xFF) # transmits 0xFF while reading
```
### SPI#transfer(*data, additional_read_bytes: 0)
### SPI#transfer(\*data, additional_read_bytes: 0)
Full-duplex transfer. Sends data and returns received bytes.
Use `additional_read_bytes:` to append zero-filled read bytes.
+8 -8
View File
@@ -35,13 +35,13 @@ end
### Constants
| Constant | Value | Description |
|-------------------------------|-------|---------------------|
| `UART::PARITY_NONE` | `0` | No parity |
| `UART::PARITY_EVEN` | `1` | Even parity |
| `UART::PARITY_ODD` | `2` | Odd parity |
| `UART::FLOW_CONTROL_NONE` | `0` | No flow control |
| `UART::FLOW_CONTROL_RTS_CTS` | `1` | Hardware flow ctrl |
| Constant | Value | Description |
| ---------------------------- | ----- | ------------------ |
| `UART::PARITY_NONE` | `0` | No parity |
| `UART::PARITY_EVEN` | `1` | Even parity |
| `UART::PARITY_ODD` | `2` | Odd parity |
| `UART::FLOW_CONTROL_NONE` | `0` | No flow control |
| `UART::FLOW_CONTROL_RTS_CTS` | `1` | Hardware flow ctrl |
### UART.new
@@ -62,7 +62,7 @@ uart = UART.new(
#### Unit Names
| Platform | Available Units |
|----------|--------------------------------------------------|
| -------- | ------------------------------------------------ |
| ESP32 | `:ESP32_UART0`, `:ESP32_UART1`, `:ESP32_UART2`\* |
| RP2040 | `:RP2040_UART0`, `:RP2040_UART1` |
+2 -2
View File
@@ -11,10 +11,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t size) {
if (!mrb) {
return 0;
}
/* mrb_load_irep_buf returns the result of the last expression */
mrb_load_irep_buf(mrb, Data, size);
mrb_close(mrb);
return 0;
}
+2 -2
View File
@@ -39,12 +39,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t size) {
case 0: mrb_funcall(mrb, b1, "+", 1, b2); break;
case 1: mrb_funcall(mrb, b1, "-", 1, b2); break;
case 2: mrb_funcall(mrb, b1, "*", 1, b2); break;
case 3:
case 3:
if (mrb_test(mrb_funcall(mrb, b2, "!=", 1, mrb_fixnum_value(0)))) {
mrb_funcall(mrb, b1, "/", 1, b2);
}
break;
case 4:
case 4:
if (mrb_test(mrb_funcall(mrb, b2, "<", 1, mrb_fixnum_value(1000)))) {
mrb_funcall(mrb, b1, "**", 1, b2);
}
+2 -2
View File
@@ -17,10 +17,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t size) {
if (fmt_len > size - 1) {
fmt_len = size - 1;
}
mrb_value fmt = mrb_str_new(mrb, (const char *)(Data + 1), fmt_len);
mrb_value str = mrb_str_new(mrb, (const char *)(Data + 1 + fmt_len), size - 1 - fmt_len);
/* Target String#unpack */
mrb_funcall(mrb, str, "unpack", 1, fmt);
+3 -3
View File
@@ -19,9 +19,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t size) {
if (fmt_len > size - 1) {
fmt_len = size - 1;
}
mrb_value fmt = mrb_str_new(mrb, (const char *)(Data + 1), fmt_len);
/* provide some arguments of different types to satisfy various format specifiers */
mrb_value args[5];
args[0] = mrb_fixnum_value(123);
@@ -29,7 +29,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t size) {
args[2] = mrb_str_new_cstr(mrb, "fuzz");
args[3] = mrb_symbol_value(mrb_intern_cstr(mrb, "symbol"));
args[4] = mrb_ary_new(mrb);
/* Call sprintf via mrb_funcall */
/* We don't use all args every time, but it doesn't hurt to pass them */
mrb_funcall(mrb, mrb_obj_value(mrb->kernel_module), "sprintf", 6, fmt, args[0], args[1], args[2], args[3], args[4]);