Skip to content

v0.14.0

Latest
Compare
Choose a tag to compare
@vickash vickash released this 07 Oct 04:08
· 4 commits to master since this release

Known Issues

  • ESP32 Boards
    • USB-CDC (aka native USB) appears to be broken in the 3.0 core. Will eventually hang if sending a lot of data both directions at the same time. Use one of the standard UART interfaces until this is fixed.

New Boards

  • ESP32-H2 and ESP32-C6 variants (--target esp32):
    • Depends on ESP32 Arduino Core 3.0+
    • No WiFi on H2

Board Changes

  • ESP32 Boards

    • 3.0+ version of the ESP32 Arduino Core now required.
  • Raspberry Pi Pico (RP2040)

    • WS2812 LED strips work now.

New Peripherals

  • Bit-Bang I2C:

    • Class: Denko::I2C::BitBang
    • Start a software bit-banged I2C bus on any 2 pins.
    • Interchangeable with hardware bus (Denko::I2C::Bus), as far as I2C peripherals are concerned.
  • ADS1100 Analog-to-Digital Converter:

    • Class: Denko::AnalogIO::ADS1100
    • Connects via I2C bus. Driver written in Ruby.
    • Modeled after AnalogIO::Input since it's a single channel ADC.
    • Can be read directly with #read or polled with #poll.
    • Full scale voltage must be given in the initailize hash, full_scale_voltage:.
    • Gain and sample rate configurable. See example for more.
  • SSD1306 1-Color OLED

    • Added SPI version.
    • Both use Denko::Display::SSD1306. Instances mutate to I2C or SPI behavior, based on bus given.
  • SH1106 1-Color OLED

    • Class: Denko::Display::SH1106
    • Almost the same as SSD1306. Most driver code is shared between them.
    • I2C and SPI versions both supported, as SSD1306 above.

Peripheral Changes

  • All Peripherals:

    • On CRuby, @state_mutex and @callback_mutex are now instances of Denko::MutexStub, which just runs the given block when called with #synchronize.
    • The options hash (now called params), given to #initialize is always available through the #params method.
    • #initialize no longer accepts pullup: true or pulldown: true. Set mode explicitly, like mode: :input_pullup.
  • Temperature / Pressure / Humidity Sensors:

    • DS18B20, DHT and HTU21D readings now match all the others (Hash with same keys).
    • Readings standardized to be in ºC, %RH and Pascals. Callbacks always receive hash with these.
    • [] access for @state removed removed. Use #temperature, #pressure, #humidity instead.
    • Added #temperature_f #temperature_k #pressure_atm #pressure_bar helper conversion methods.
    • #read methods standardized to always read ALL sub-sensors. Affects HTU21D and BMP180.
  • AnalogIO::Input:

    • Added #smoothing= and #smoothing_size= accessors to AnalogIO::Input for configuration.
    • AnalogIO::Sensor removed. Use Input instead.
  • Behavior::InputPin

    • Added #debounce=(time) which just calls Board#set_pin_debounce for the pin. Only on PiBoard.
  • DigitalIO::CBitBang:

    • New helper class. Forces initialize validation for bit-bang pins. Essential for PiBoard.
    • As a side-effect, makes sure 2 low-level bit-bang Components (eg. buses) can't use the same pin.
    • Always starts pins in :input mode. The bit-bang routine is expected to change them.
  • DigitalIO::RotaryEncoder:

    • Pin names standardized to a: and b:, but still accept :clock, :data, :clk, :dt.
    • steps_per_revolution changed to counts_per_revolution
    • Every level change is counted now (full-quadrature). Was half-quadrature before.
    • counts_per_revolution now defaults to 60 instead of 30 (generic 30-detent encoders).
    • state and callback hash store :count instead of :steps.
  • I2C::Bus:

    • No longer requires SDA pin to initialize.
    • Accepts index: param (default 0) on initialize, specifying which I2C interface to use.
      • Only works for PiBoard on Linux right now.
    • #update accepts String of comma delimited ASCII numbers (Board), or Array of bytes (PiBoard).
  • I2C::Peripheral:

    • #i2c_read arg order changed from (register, num_bytes) to (num_bytes, register: nil)
  • LED:

    • Base, RGB and SevenSegment all inherit from PulseIO::PWMOutput, so see that below.
    • #write MUST always be given a PWM value if used, not 0 or 1.
    • Prefer using duty= if possible, which is percentage based.
    • Alternatively, call #digital_write only to stay in faster digital mode.
  • LED::RGB:

    • #write takes 3 regular args now. Use *array instead to pass an array.
    • #color only takes a symbol for one of the predefined colors (or :off) now.
  • Motor::Stepper:

    • #step_cc renamed to #step_ccw.
  • OneWire::Bus:

    • #update accepts String of comma delimited ASCII numbers (Board), or Array of bytes (PiBoard).
  • PulseIO::IRTransmitter:

    • Renamed to PulseIO::IROutput to be more consistent with other classes.
    • #emit renamed to #write for consistency.
  • PulseIO::PWMOutput:

    • #write will never try to call #digital_write, always #pwm_write.
    • Initial mode is :output instead of :output_pwm, saving MCU PWM channels until needed.
    • Mode change is lazy. Happens with first call to #pwm_write.
    • Call only #digital_write to stay in digital :output mode (faster).
    • Added #duty=. Set duty cycle in percentage regardless of PWM resolution.
    • Set resolution and frequency per PWMOutput instance (pin), instead of per Board instance:
      • #initialize hash accepts frequency: and resolution: keys.
      • Call #pwm_enable with frequency: and resolution: kwargs
      • Or use #resolution= and #frequency= methods.
      • Defaults are 1 kHz frequency and 8-bit resolution.
      • ONLY works on ESP32 and PiBoard right now. Others still control at the Board level.
      • Limited to 13-bit resolution on Denko::Board for now.
  • SPI::Bus:

    • Accepts index: param (default 0) on initialize, specifying which SPI interface to use.
      • Only works for PiBoard on Linux right now.
  • SPI::Peripheral:

    • Split into SPI:Peripheral::SinglePin and Spi::Peripheral::MultiPin to allow modeling more complex peripherals.
    • #update accepts String of comma delimited ASCII numbers (Board), or Array of bytes (PiBoard).
  • SPI::OutputRegister:

    • Removed automatic buffering of writes.
    • Call #set_bit(value) instead to modify state in memory, without writing to the physical register.
    • Call #write to send state to the register after modifying.

Fiwmare Changes

  • General:

    • Boards now report their serial buffer as 8 bytes less than the actual buffer size.
    • Removed local callback hooks (meant for customization in C) from the Arduino sketches.
    • Improved serial interface selection for ATSAMD21 boards. Some boards have the native interface as Serial, some as SerialUSB. The native interface is always selected now, regardless of its name.
    • More accurate pin counts when initializing digital listener storage for different boards.
  • Core I/O:

    • Removed INPUT_OUTPUT mode. Only ESP32 used it and it's the same as OUTPUT.
    • Added an optimized single-byte binary message type for #digital_write. Improves write throughput 6-7x. Only works for pins 0..63. Fallback automatic for higher pins.
  • Hardware I2C:

    • Message format changed so "value" isn't used. Will be used for differentiating multiple I2C interfaces in future.
    • Responses now prefixed with I2C{index}: (index = I2C device integer, always 0 for now), instead of SDA pin number.
  • Hardware SPI:

    • Transfers don't need a chip select pin now. This is for LED strips like APA102.
  • Bit-Bang I2C:

    • Newly added. Works similar to Bit-Bang SPI.

Board Interface Changes

  • Board#set_pin_mode now takes a third hash argument, options={}. Only used keys are resolution: and frequency: for setting PWM resolution. Only works on ESP32 boards and PiBoard on Linux.

  • Added Board#set_pin_debounce

    • Implemented for Linux GPIO alerts in Denko::PiBoard (denko-piboard gem).
    • Sets a time (in microseconds) that level changes on a pin must be stable for, before an update happens.
    • Does nothing for Denko::Board.
  • Added OUTPUT_OPEN_DRAIN and OUTPUT_OPEN_SOURCE pin modes to support PiBoard.

CLI Changes

  • All Atmel targets now prefixed with "at". Eg. atsamd21 now, instead of samd21 before.

Bugs Fixed

  • ADS111X sensors were incorrectly validating sample rate when set.
  • Handshake could fail if board was left in a state where it kept transmitting data.
  • An ESP32 with no DACs might not release a LEDC channel after use.
  • Denko::Connection could have negative bytes in transit, making it overflow the board's rx buffer.
  • Servo, Buzzer and IRTransmitter didn't start in :output_pwm mode.
  • SSD1306#on and #off would raise errors, trying to write Integer instead of Array to I2C::Bus.
  • SPI::BitBang did not correctly set initial clock state for modes 2 and 3.
  • IRTransmitter.emit didn't work at all ESP8266. Pulse data wasn't aligned properly in memory.
  • Board#ws2812_write was validating max length to 256 instead of 255.
  • WS2812 write on ESP32 would crash it, only with some low 8-bit pixel values. Still unsure why, but four extra 0 bytes (preceding the pixel data in auxMsg) seems to work around this.