Modular Electronics  0.1
 All Classes Namespaces Functions Variables Pages
eeprom.h
1 // Class for eeprom chips
2 // Copyright (C) 2018 Carlos Kometter
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16 
17 #ifndef MODULARELECTRONICS_EEPROM_h
18 #define MODULARELECTRONICS_EEPROM_h
19 
20 #include "Arduino.h"
21 #include "SPI.h"
22 
30 class EepromSpi {
31  private:
32  // sync_pin_ identifies the eeprom chip; each chip has a unique sync_pin_.
33  // spi_bus_config_pin_ identifies the bus configurations.
34  // More than one eeprom can share the same bus if they use the same spi configs.
35  uint8_t sync_pin_, spi_bus_config_pin_, spi_mode_;
36  uint8_t clock_divider_; // For due frequency = 84 MHz / clock_divider_
37  BitOrder bit_order_; // MSBFIRST or LSBFIRST
38  public:
39  EepromSpi(void) = default;
55  EepromSpi(uint8_t sync_pin, uint8_t spi_bus_config_pin,
56  uint8_t clock_divider=7, BitOrder bit_order=MSBFIRST,
57  uint8_t spi_mode=SPI_MODE3);
63  uint8_t Begin(void);
64 };
65 
66 #endif
uint8_t Begin(void)
Definition: eeprom.cpp:27
Definition: eeprom.h:30