working digital output card implementation
This commit is contained in:
parent
ca228f7cd0
commit
63a34afee3
7 changed files with 87 additions and 31 deletions
|
@ -57,4 +57,16 @@ uint16_t DigitalOutputCard::getValue(uint8_t pin) {
|
|||
// Get type of card
|
||||
uint8_t DigitalOutputCard::getType() {
|
||||
return CARD_TYPE_DIGITAL_OUTPUT;
|
||||
}
|
||||
}
|
||||
|
||||
void DigitalOutputCard::setState(uint8_t pin, bool state) {
|
||||
this-> state_buffer[pin] = state;
|
||||
this->pwm.setPin(pin, state*value_buffer[pin]);
|
||||
}
|
||||
|
||||
void DigitalOutputCard::setValue(uint8_t pin, uint16_t value) {
|
||||
// If value is greater than 4095, set it to 4095
|
||||
if (value > 4095) value = 4095;
|
||||
this-> value_buffer[pin] = value;
|
||||
this->pwm.setPin(pin, state_buffer[pin]*value);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue