added gpio

This commit is contained in:
mvturnho 2019-05-24 21:50:21 +02:00
parent dad38bb220
commit 7ab2a0cfe5
3 changed files with 270 additions and 123 deletions

View file

@ -1,13 +1,23 @@
import esphome.codegen as cg import esphome.codegen as cg
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome import pins
from esphome.components import i2c from esphome.components import i2c
from esphome.const import CONF_FREQUENCY, CONF_ID from esphome.const import CONF_ID, CONF_NUMBER, CONF_MODE, CONF_INVERTED
DEPENDENCIES = ['i2c'] DEPENDENCIES = ['i2c']
MULTI_CONF = True MULTI_CONF = True
sx1509_ns = cg.esphome_ns.namespace('sx1509') sx1509_ns = cg.esphome_ns.namespace('sx1509')
SX1509GPIOMode = sx1509_ns.enum('SX1509GPIOMode')
SX1509_GPIO_MODES = {
'INPUT': SX1509GPIOMode.SX1509_INPUT,
'INPUT_PULLUP': SX1509GPIOMode.SX1509_INPUT_PULLUP,
'OUTPUT': SX1509GPIOMode.SX1509_OUTPUT,
'BREATHE_OUTPUT' : SX1509GPIOMode.SX1509_BREATHE_OUTPUT
}
SX1509Component = sx1509_ns.class_('SX1509Component', cg.Component, i2c.I2CDevice) SX1509Component = sx1509_ns.class_('SX1509Component', cg.Component, i2c.I2CDevice)
SX1509GPIOPin = sx1509_ns.class_('SX1509GPIOPin', cg.GPIOPin)
CONFIG_SCHEMA = cv.Schema({ CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(SX1509Component), cv.GenerateID(): cv.declare_id(SX1509Component),
@ -18,3 +28,25 @@ def to_code(config):
var = cg.new_Pvariable(config[CONF_ID]) var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config) yield cg.register_component(var, config)
yield i2c.register_i2c_device(var, config) yield i2c.register_i2c_device(var, config)
CONF_SX1509 = 'sx1509'
SX1509_OUTPUT_PIN_SCHEMA = cv.Schema({
cv.Required(CONF_SX1509): cv.use_id(SX1509Component),
cv.Required(CONF_NUMBER): cv.int_,
cv.Optional(CONF_MODE, default="OUTPUT"): cv.enum(SX1509_GPIO_MODES, upper=True),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
})
SX1509_INPUT_PIN_SCHEMA = cv.Schema({
cv.Required(CONF_SX1509): cv.use_id(SX1509Component),
cv.Required(CONF_NUMBER): cv.int_,
cv.Optional(CONF_MODE, default="INPUT"): cv.enum(SX1509_GPIO_MODES, upper=True),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
})
@pins.PIN_SCHEMA_REGISTRY.register(CONF_SX1509,
(SX1509_OUTPUT_PIN_SCHEMA, SX1509_INPUT_PIN_SCHEMA))
def sx1509_pin_to_code(config):
parent = yield cg.get_variable(config[CONF_SX1509])
yield SX1509GPIOPin.new(parent, config[CONF_NUMBER], config[CONF_MODE], config[CONF_INVERTED])

View file

@ -41,99 +41,110 @@ void SX1509Component::dump_config() {
void SX1509Component::loop() {} void SX1509Component::loop() {}
SX1509FloatOutputChannel * SX1509FloatOutputChannel *SX1509Component::create_float_output_channel(uint8_t pin) {
SX1509Component::create_float_output_channel(uint8_t channel) { ESP_LOGD(TAG, "Set pin mode for pin %d", pin);
ESP_LOGD(TAG, "Set pin mode for channel %d", channel); auto *c = new SX1509FloatOutputChannel(this, pin);
auto *c = new SX1509FloatOutputChannel(this, channel);
float_output_channels_.push_back(c); float_output_channels_.push_back(c);
return c; return c;
} }
void SX1509Component::digitalWrite(uint8_t channel, uint8_t highLow) { uint8_t SX1509Component::digital_read(uint8_t pin) {
uint16_t tempRegDir = 0; uint16_t tempRegDir;
this->read_byte_16(REG_DIR_B, &tempRegDir); this->read_byte_16(REG_DIR_B, &tempRegDir);
if ((0xFFFF ^ tempRegDir) & if (tempRegDir & (1 << pin)) {
(1 << channel)) // If the pin is an output, write high/low uint16_t tempRegData;
{
uint16_t tempRegData = 0;
this->read_byte_16(REG_DATA_B, &tempRegData); this->read_byte_16(REG_DATA_B, &tempRegData);
if (highLow) if (tempRegData & (1 << pin))
tempRegData |= (1 << channel); return 1;
}
return 0;
}
void SX1509Component::digital_write(uint8_t pin, uint8_t bit_value) {
uint16_t temp_reg_dir = 0;
this->read_byte_16(REG_DIR_B, &temp_reg_dir);
if ((0xFFFF ^ temp_reg_dir) & (1 << pin)) // If the pin is an output, write high/low
{
uint16_t temp_reg_data = 0;
this->read_byte_16(REG_DATA_B, &temp_reg_data);
if (bit_value)
temp_reg_data |= (1 << pin);
else else
tempRegData &= ~(1 << channel); temp_reg_data &= ~(1 << pin);
this->write_byte_16(REG_DATA_B, tempRegData); this->write_byte_16(REG_DATA_B, temp_reg_data);
} else // Otherwise the pin is an input, pull-up/down } else // Otherwise the pin is an input, pull-up/down
{ {
uint16_t tempPullUp; uint16_t temp_pullup;
this->read_byte_16(REG_PULL_UP_B, &tempPullUp); this->read_byte_16(REG_PULL_UP_B, &temp_pullup);
uint16_t tempPullDown; uint16_t temp_pull_down;
this->read_byte_16(REG_PULL_DOWN_B, &tempPullDown); this->read_byte_16(REG_PULL_DOWN_B, &temp_pull_down);
if (highLow) // if HIGH, do pull-up, disable pull-down if (bit_value) // if HIGH, do pull-up, disable pull-down
{ {
tempPullUp |= (1 << channel); temp_pullup |= (1 << pin);
tempPullDown &= ~(1 << channel); temp_pull_down &= ~(1 << pin);
this->write_byte_16(REG_PULL_UP_B, tempPullUp); this->write_byte_16(REG_PULL_UP_B, temp_pullup);
this->write_byte_16(REG_PULL_DOWN_B, tempPullDown); this->write_byte_16(REG_PULL_DOWN_B, temp_pull_down);
} else // If LOW do pull-down, disable pull-up } else // If LOW do pull-down, disable pull-up
{ {
tempPullDown |= (1 << channel); temp_pull_down |= (1 << pin);
tempPullUp &= ~(1 << channel); temp_pullup &= ~(1 << pin);
this->write_byte_16(REG_PULL_UP_B, tempPullUp); this->write_byte_16(REG_PULL_UP_B, temp_pullup);
this->write_byte_16(REG_PULL_DOWN_B, tempPullDown); this->write_byte_16(REG_PULL_DOWN_B, temp_pull_down);
} }
} }
} }
void SX1509Component::pinMode(uint8_t channel, uint8_t inOut) { void SX1509Component::pin_mode(uint8_t pin, uint8_t mode) {
// The SX1509 RegDir registers: REG_DIR_B, REG_DIR_A uint8_t mode_bit;
// 0: IO is configured as an output if ((mode == OUTPUT) || (mode == ANALOG_OUTPUT) || (mode == BREATHE_OUTPUT))
// 1: IO is configured as an input mode_bit = 0;
uint8_t modeBit;
if ((inOut == OUTPUT) || (inOut == ANALOG_OUTPUT))
modeBit = 0;
else else
modeBit = 1; mode_bit = 1;
uint16_t tempRegDir = 0; uint16_t temp_reg_dir = 0;
this->read_byte_16(REG_DIR_B, &tempRegDir); this->read_byte_16(REG_DIR_B, &temp_reg_dir);
if (modeBit) if (mode_bit)
tempRegDir |= (1 << channel); temp_reg_dir |= (1 << pin);
else else
tempRegDir &= ~(1 << channel); temp_reg_dir &= ~(1 << pin);
this->write_byte_16(REG_DIR_B, tempRegDir); this->write_byte_16(REG_DIR_B, temp_reg_dir);
// If INPUT_PULLUP was called, set up the pullup too: if (mode == INPUT_PULLUP)
if (inOut == INPUT_PULLUP) digital_write(pin, HIGH);
digitalWrite(channel, HIGH);
if (inOut == ANALOG_OUTPUT) { if (mode == ANALOG_OUTPUT) {
ledDriverInit(channel); led_driver_init(pin);
}
if (mode == BREATHE_OUTPUT) {
breathe(pin, 1000, 1000, 1000, 1000);
} }
} }
void SX1509Component::ledDriverInit(uint8_t channel, uint8_t freq, bool log) { void SX1509Component::led_driver_init(uint8_t pin, uint8_t freq, bool log) {
uint16_t tempWord; uint16_t tempWord;
uint8_t tempByte; uint8_t tempByte;
// Disable input buffer // Disable input buffer
// Writing a 1 to the pin bit will disable that pins input buffer // Writing a 1 to the pin bit will disable that pins input buffer
this->read_byte_16(REG_INPUT_DISABLE_B, &tempWord); this->read_byte_16(REG_INPUT_DISABLE_B, &tempWord);
tempWord |= (1 << channel); tempWord |= (1 << pin);
this->write_byte_16(REG_INPUT_DISABLE_B, tempWord); this->write_byte_16(REG_INPUT_DISABLE_B, tempWord);
// Disable pull-up // Disable pull-up
// Writing a 0 to the pin bit will disable that pull-up resistor // Writing a 0 to the pin bit will disable that pull-up resistor
this->read_byte_16(REG_PULL_UP_B, &tempWord); this->read_byte_16(REG_PULL_UP_B, &tempWord);
tempWord &= ~(1 << channel); tempWord &= ~(1 << pin);
this->write_byte_16(REG_PULL_UP_B, tempWord); this->write_byte_16(REG_PULL_UP_B, tempWord);
// Set direction to output (REG_DIR_B) // Set direction to output (REG_DIR_B)
this->read_byte_16(REG_DIR_B, &tempWord); this->read_byte_16(REG_DIR_B, &tempWord);
tempWord &= ~(1 << channel); // 0=output tempWord &= ~(1 << pin); // 0=output
this->write_byte_16(REG_DIR_B, tempWord); this->write_byte_16(REG_DIR_B, tempWord);
// Enable oscillator (REG_CLOCK) // Enable oscillator (REG_CLOCK)
@ -157,24 +168,60 @@ void SX1509Component::ledDriverInit(uint8_t channel, uint8_t freq, bool log) {
{ {
_clkX = 2000000.0 / (1 << (1 - 1)); // Update private clock variable _clkX = 2000000.0 / (1 << (1 - 1)); // Update private clock variable
byte freq = (1 & 0x07) << 4; // freq should only be 3 bits from 6:4 uint8_t freq = (1 & 0x07) << 4; // freq should only be 3 bits from 6:4
tempByte |= freq; tempByte |= freq;
} }
this->write_byte(REG_MISC, tempByte); this->write_byte(REG_MISC, tempByte);
// Enable LED driver operation (REG_LED_DRIVER_ENABLE) // Enable LED driver operation (REG_LED_DRIVER_ENABLE)
this->read_byte_16(REG_LED_DRIVER_ENABLE_B, &tempWord); this->read_byte_16(REG_LED_DRIVER_ENABLE_B, &tempWord);
tempWord |= (1 << channel); tempWord |= (1 << pin);
this->write_byte_16(REG_LED_DRIVER_ENABLE_B, tempWord); this->write_byte_16(REG_LED_DRIVER_ENABLE_B, tempWord);
// Set REG_DATA bit low ~ LED driver started // Set REG_DATA bit low ~ LED driver started
this->read_byte_16(REG_DATA_B, &tempWord); this->read_byte_16(REG_DATA_B, &tempWord);
tempWord &= ~(1 << channel); tempWord &= ~(1 << pin);
this->write_byte_16(REG_DATA_B, tempWord); this->write_byte_16(REG_DATA_B, tempWord);
} }
void SX1509Component::clock(byte oscSource, byte oscPinFunction, void SX1509Component::breathe(uint8_t pin, unsigned long tOn, unsigned long tOff, unsigned long rise,
byte oscFreqOut, byte oscDivider) { unsigned long fall, uint8_t onInt, uint8_t offInt, bool log) {
offInt = constrain(offInt, 0, 7);
uint8_t onReg = calculate_led_t_register(tOn);
uint8_t offReg = calculate_led_t_register(tOff);
uint8_t riseTime = calculate_slope_register(rise, onInt, offInt);
uint8_t fallTime = calculate_slope_register(fall, onInt, offInt);
setup_blink(pin, onReg, offReg, onInt, offInt, riseTime, fallTime, log);
}
void SX1509Component::setup_blink(uint8_t pin, uint8_t tOn, uint8_t tOff, uint8_t onIntensity, uint8_t offIntensity,
uint8_t tRise, uint8_t tFall, bool log) {
led_driver_init(pin, log);
tOn &= 0x1F; // tOn should be a 5-bit value
tOff &= 0x1F; // tOff should be a 5-bit value
offIntensity &= 0x07;
// Write the time on
this->write_byte(REG_T_ON[pin], tOn);
this->write_byte(REG_OFF[pin], (tOff << 3) | offIntensity);
this->write_byte(REG_I_ON[pin], onIntensity);
tRise &= 0x1F;
tFall &= 0x1F;
if (REG_T_RISE[pin] != 0xFF)
this->write_byte(REG_T_RISE[pin], tRise);
if (REG_T_FALL[pin] != 0xFF)
this->write_byte(REG_T_FALL[pin], tFall);
}
void SX1509Component::clock(byte oscSource, byte oscPinFunction, byte oscFreqOut, byte oscDivider) {
oscSource = (oscSource & 0b11) << 5; // 2-bit value, bits 6:5 oscSource = (oscSource & 0b11) << 5; // 2-bit value, bits 6:5
oscPinFunction = (oscPinFunction & 1) << 4; // 1-bit value bit 4 oscPinFunction = (oscPinFunction & 1) << 4; // 1-bit value bit 4
oscFreqOut = (oscFreqOut & 0b1111); // 4-bit value, bits 3:0 oscFreqOut = (oscFreqOut & 0b1111); // 4-bit value, bits 3:0
@ -192,9 +239,55 @@ void SX1509Component::clock(byte oscSource, byte oscPinFunction,
this->write_byte(REG_MISC, regMisc); this->write_byte(REG_MISC, regMisc);
} }
void SX1509Component::set_channel_value_(uint8_t channel, uint8_t iOn) { void SX1509Component::set_pin_value_(uint8_t pin, uint8_t iOn) {
ESP_LOGD(TAG, "set_channel_value_ for channel %d to %d", channel, iOn); ESP_LOGD(TAG, "set_pin_value_ for pin %d to %d", pin, iOn);
this->write_byte(REG_I_ON[channel], iOn); this->write_byte(REG_I_ON[pin], iOn);
}
uint8_t SX1509Component::calculate_led_t_register(uint16_t ms) {
uint16_t regOn1, regOn2;
float timeOn1, timeOn2;
if (_clkX == 0)
return 0;
regOn1 = (float) (ms / 1000.0) / (64.0 * 255.0 / (float) _clkX);
regOn2 = regOn1 / 8;
regOn1 = constrain(regOn1, 1, 15);
regOn2 = constrain(regOn2, 16, 31);
timeOn1 = 64.0 * regOn1 * 255.0 / _clkX * 1000.0;
timeOn2 = 512.0 * regOn2 * 255.0 / _clkX * 1000.0;
if (abs(timeOn1 - ms) < abs(timeOn2 - ms))
return regOn1;
else
return regOn2;
}
uint8_t SX1509Component::calculate_slope_register(uint16_t ms, uint8_t onIntensity, uint8_t offIntensity) {
uint16_t regSlope1, regSlope2;
float regTime1, regTime2;
if (_clkX == 0)
return 0;
float tFactor = ((float) onIntensity - (4.0 * (float)offIntensity)) * 255.0 / (float) _clkX;
float timeS = float(ms) / 1000.0;
regSlope1 = timeS / tFactor;
regSlope2 = regSlope1 / 16;
regSlope1 = constrain(regSlope1, 1, 15);
regSlope2 = constrain(regSlope2, 16, 31);
regTime1 = regSlope1 * tFactor * 1000.0;
regTime2 = 16 * regTime1;
if (abs(regTime1 - ms) < abs(regTime2 - ms))
return regSlope1;
else
return regSlope2;
} }
void SX1509FloatOutputChannel::write_state(float state) { void SX1509FloatOutputChannel::write_state(float state) {
@ -202,12 +295,17 @@ void SX1509FloatOutputChannel::write_state(float state) {
const uint16_t max_duty = 255; const uint16_t max_duty = 255;
const float duty_rounded = roundf(state * max_duty); const float duty_rounded = roundf(state * max_duty);
auto duty = static_cast<uint16_t>(duty_rounded); auto duty = static_cast<uint16_t>(duty_rounded);
this->parent_->set_channel_value_(this->channel_, duty); this->parent_->set_pin_value_(this->pin_, duty);
} }
void SX1509FloatOutputChannel::setup_channel() { void SX1509FloatOutputChannel::setup_channel() { this->parent_->pin_mode(this->pin_, ANALOG_OUTPUT); }
this->parent_->pinMode(this->channel_, ANALOG_OUTPUT);
} SX1509GPIOPin::SX1509GPIOPin(SX1509Component *parent, uint8_t pin, uint8_t mode, bool inverted)
: GPIOPin(pin, mode, inverted), parent_(parent) {}
void SX1509GPIOPin::setup() { this->pin_mode(this->mode_); }
void SX1509GPIOPin::pin_mode(uint8_t mode) { this->parent_->pin_mode(this->pin_, mode); }
bool SX1509GPIOPin::digital_read() { return this->parent_->digital_read(this->pin_) != this->inverted_; }
void SX1509GPIOPin::digital_write(bool value) { this->parent_->digital_write(this->pin_, value != this->inverted_); }
} // namespace sx1509 } // namespace sx1509
} // namespace esphome } // namespace esphome

View file

@ -19,47 +19,74 @@ namespace sx1509 {
#define SOFTWARE_RESET 0 #define SOFTWARE_RESET 0
#define HARDWARE_RESET 1 #define HARDWARE_RESET 1
#define ANALOG_OUTPUT 0x3 // To set a pin mode for PWM output #define ANALOG_OUTPUT 0x03 // To set a pin mode for PWM output
#define BREATHE_OUTPUT 0x04
/// Modes for MCP23017 pins
enum SX1509GPIOMode : uint8_t {
SX1509_INPUT = INPUT, // 0x00
SX1509_INPUT_PULLUP = INPUT_PULLUP, // 0x02
SX1509_OUTPUT = OUTPUT, // 0x01
SX1509_BREATHE_OUTPUT = BREATHE_OUTPUT // 0x04
};
class SX1509Component; class SX1509Component;
class SX1509FloatOutputChannel : public output::FloatOutput { class SX1509FloatOutputChannel : public output::FloatOutput {
public: public:
SX1509FloatOutputChannel(SX1509Component *parent, uint8_t channel) SX1509FloatOutputChannel(SX1509Component *parent, uint8_t pin) : parent_(parent), pin_(pin) {}
: parent_(parent), channel_(channel) {}
void setup_channel(); void setup_channel();
protected: protected:
void write_state(float state) override; void write_state(float state) override;
SX1509Component *parent_; SX1509Component *parent_;
uint8_t channel_; uint8_t pin_;
};
class SX1509GPIOPin : public GPIOPin {
public:
SX1509GPIOPin(SX1509Component *parent, uint8_t pin, uint8_t mode, bool inverted = false);
void setup() override;
void pin_mode(uint8_t mode) override;
bool digital_read() override;
void digital_write(bool value) override;
protected:
SX1509Component *parent_;
}; };
/// SX1509 float output component. /// SX1509 float output component.
class SX1509Component : public Component, public i2c::I2CDevice { class SX1509Component : public Component, public i2c::I2CDevice {
public: public:
SX1509Component() {} SX1509Component() {}
SX1509FloatOutputChannel *create_float_output_channel(uint8_t channel); SX1509FloatOutputChannel *create_float_output_channel(uint8_t pin);
void setup() override; void setup() override;
void dump_config() override; void dump_config() override;
float get_setup_priority() const override { return setup_priority::HARDWARE; } float get_setup_priority() const override { return setup_priority::HARDWARE; }
void loop() override; void loop() override;
void pin_mode(uint8_t pin, uint8_t inOut);
void led_driver_init(uint8_t pin, uint8_t freq = 1, bool log = false);
void clock(uint8_t oscSource = 2, uint8_t oscDivider = 1, uint8_t oscPinFunction = 0, uint8_t oscFreqOut = 0);
void digital_write(uint8_t pin, uint8_t highLow);
uint8_t digital_read(uint8_t pin);
void set_pin_value_(uint8_t pin, uint8_t iOn);
void setup_blink(uint8_t pin, uint8_t tOn, uint8_t toff, uint8_t onIntensity = 255, uint8_t offIntensity = 0,
uint8_t tRise = 0, uint8_t tFall = 0, bool log = false);
void blink(uint8_t pin, unsigned long tOn, unsigned long tOff, uint8_t onIntensity = 255, uint8_t offIntensity = 0);
void breathe(uint8_t pin, unsigned long tOn, unsigned long tOff, unsigned long rise, unsigned long fall,
uint8_t onInt = 255, uint8_t offInt = 0, bool log = LINEAR);
uint8_t calculate_led_t_register(uint16_t ms);
uint8_t calculate_slope_register(uint16_t ms, uint8_t onIntensity, uint8_t offIntensity);
protected: protected:
friend SX1509FloatOutputChannel; friend SX1509FloatOutputChannel;
std::vector<SX1509FloatOutputChannel *> float_output_channels_{}; std::vector<SX1509FloatOutputChannel *> float_output_channels_{};
void pinMode(uint8_t channel, uint8_t inOut);
void ledDriverInit(uint8_t channel, uint8_t freq = 1, bool log = false);
void clock(uint8_t oscSource = 2, uint8_t oscDivider = 1,
uint8_t oscPinFunction = 0, uint8_t oscFreqOut = 0);
void digitalWrite(uint8_t channel, uint8_t highLow);
void set_channel_value_(uint8_t channel, uint8_t iOn);
// Pin definitions: // Pin definitions:
uint8_t pinInterrupt_; uint8_t pinInterrupt_;
uint8_t pinOscillator_; uint8_t pinOscillator_;
@ -70,32 +97,22 @@ protected:
bool update_{true}; bool update_{true};
byte REG_I_ON[16] = {REG_I_ON_0, REG_I_ON_1, REG_I_ON_2, REG_I_ON_3, uint8_t REG_I_ON[16] = {REG_I_ON_0, REG_I_ON_1, REG_I_ON_2, REG_I_ON_3, REG_I_ON_4, REG_I_ON_5,
REG_I_ON_4, REG_I_ON_5, REG_I_ON_6, REG_I_ON_7, REG_I_ON_6, REG_I_ON_7, REG_I_ON_8, REG_I_ON_9, REG_I_ON_10, REG_I_ON_11,
REG_I_ON_8, REG_I_ON_9, REG_I_ON_10, REG_I_ON_11,
REG_I_ON_12, REG_I_ON_13, REG_I_ON_14, REG_I_ON_15}; REG_I_ON_12, REG_I_ON_13, REG_I_ON_14, REG_I_ON_15};
byte REG_T_ON[16] = {REG_T_ON_0, REG_T_ON_1, REG_T_ON_2, REG_T_ON_3, uint8_t REG_T_ON[16] = {REG_T_ON_0, REG_T_ON_1, REG_T_ON_2, REG_T_ON_3, REG_T_ON_4, REG_T_ON_5,
REG_T_ON_4, REG_T_ON_5, REG_T_ON_6, REG_T_ON_7, REG_T_ON_6, REG_T_ON_7, REG_T_ON_8, REG_T_ON_9, REG_T_ON_10, REG_T_ON_11,
REG_T_ON_8, REG_T_ON_9, REG_T_ON_10, REG_T_ON_11,
REG_T_ON_12, REG_T_ON_13, REG_T_ON_14, REG_T_ON_15}; REG_T_ON_12, REG_T_ON_13, REG_T_ON_14, REG_T_ON_15};
byte REG_OFF[16] = {REG_OFF_0, REG_OFF_1, REG_OFF_2, REG_OFF_3, uint8_t REG_OFF[16] = {REG_OFF_0, REG_OFF_1, REG_OFF_2, REG_OFF_3, REG_OFF_4, REG_OFF_5, REG_OFF_6, REG_OFF_7,
REG_OFF_4, REG_OFF_5, REG_OFF_6, REG_OFF_7, REG_OFF_8, REG_OFF_9, REG_OFF_10, REG_OFF_11, REG_OFF_12, REG_OFF_13, REG_OFF_14, REG_OFF_15};
REG_OFF_8, REG_OFF_9, REG_OFF_10, REG_OFF_11,
REG_OFF_12, REG_OFF_13, REG_OFF_14, REG_OFF_15};
byte REG_T_RISE[16] = { uint8_t REG_T_RISE[16] = {0xFF, 0xFF, 0xFF, 0xFF, REG_T_RISE_4, REG_T_RISE_5, REG_T_RISE_6, REG_T_RISE_7,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, REG_T_RISE_12, REG_T_RISE_13, REG_T_RISE_14, REG_T_RISE_15};
REG_T_RISE_4, REG_T_RISE_5, REG_T_RISE_6, REG_T_RISE_7,
0xFF, 0xFF, 0xFF, 0xFF,
REG_T_RISE_12, REG_T_RISE_13, REG_T_RISE_14, REG_T_RISE_15};
byte REG_T_FALL[16] = { uint8_t REG_T_FALL[16] = {0xFF, 0xFF, 0xFF, 0xFF, REG_T_FALL_4, REG_T_FALL_5, REG_T_FALL_6, REG_T_FALL_7,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, REG_T_FALL_12, REG_T_FALL_13, REG_T_FALL_14, REG_T_FALL_15};
REG_T_FALL_4, REG_T_FALL_5, REG_T_FALL_6, REG_T_FALL_7,
0xFF, 0xFF, 0xFF, 0xFF,
REG_T_FALL_12, REG_T_FALL_13, REG_T_FALL_14, REG_T_FALL_15};
}; };
} // namespace sx1509 } // namespace sx1509