0xJoey / Arduino_93C46

A simple library to interface an arduino with a 93C46 EEPROM chip
GNU General Public License v3.0
20 stars 13 forks source link

About CONTROL #1

Closed nopnop2002 closed 4 years ago

nopnop2002 commented 5 years ago

Hello. I think that:

void eeprom_93C46::ew_enable() {
    digitalWrite(_pCS, HIGH);
    send_bits(HIGH, 1);
        if(_mode) {
            send_bits(EW_ENABLE, 8);
        } else {
            send_bits(EW_ENABLE<<1, 9);
        }
    digitalWrite(_pCS, LOW);
    _ew = true;
};

void eeprom_93C46::ew_disable() {
    digitalWrite(_pCS, HIGH);
    send_bits(HIGH, 1);
    if(_mode) {
        send_bits(EW_DISABLE, 8);
    } else {
        send_bits(EW_DISABLE<<1, 9);
    }
    digitalWrite(_pCS, LOW);
    _ew = false;
}

void eeprom_93C46::erase_all() {
    if(!this->is_ew_enabled()) {
        return;
    }
    digitalWrite(_pCS, HIGH);
    send_bits(HIGH, 1);
    if(_mode) {
        send_bits(ERASE_ALL, 8);
    } else {
        send_bits(ERASE_ALL<<1, 9);
    }
    digitalWrite(_pCS, LOW);
    wait();
}

void eeprom_93C46::write_all(word value) {
    if(!this->is_ew_enabled()) {
        return;
    }
    digitalWrite(_pCS, HIGH);
    send_bits(HIGH, 1);
    if(_mode) {
        send_bits(WRITE_ALL, 8);
        send_bits(0xFFFF & value, 16);
    } else {
        send_bits(WRITE_ALL<<1, 9);
        send_bits(0xFF & value, 8);
    }
    digitalWrite(_pCS, LOW);
    wait();
}
0xJoey commented 4 years ago

I'm not sure what the question is here

nopnop2002 commented 4 years ago

maybe my misstake.