From 35cbbbf2955d71e8448e5f0d986497eca4ff945f Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Thu, 28 Sep 2023 14:22:19 +0700 Subject: [PATCH] fram --- .../lib/ESPMegaPRO/ESPMegaPRO.cpp | 4 +- Template Project/lib/ESPMegaPRO/ESPMegaPRO.h | 6 +-- Template Project/platformio.ini | 2 +- Template Project/src/fram_demo.cpp | 37 +++++++++++++++++++ Template Project/src/fram_demo.cpp.disabled | 0 ...c_scanner.cpp => i2c_scanner.cpp.disabled} | 0 6 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 Template Project/src/fram_demo.cpp delete mode 100644 Template Project/src/fram_demo.cpp.disabled rename Template Project/src/{i2c_scanner.cpp => i2c_scanner.cpp.disabled} (100%) diff --git a/Template Project/lib/ESPMegaPRO/ESPMegaPRO.cpp b/Template Project/lib/ESPMegaPRO/ESPMegaPRO.cpp index 57d9457..2db5186 100644 --- a/Template Project/lib/ESPMegaPRO/ESPMegaPRO.cpp +++ b/Template Project/lib/ESPMegaPRO/ESPMegaPRO.cpp @@ -6,7 +6,7 @@ uint8_t inputBufferB; PCF8574 inputBankA(INPUT_BANK_A_ADDRESS); PCF8574 inputBankB(INPUT_BANK_B_ADDRESS); Adafruit_PWMServoDriver pwmBank = Adafruit_PWMServoDriver(PWM_BANK_ADDRESS); -I2C_eeprom ESPMega_EEPROM(EEPROM_ADDRESS); +FRAM ESPMega_FRAM; #ifdef ANALOG_CARD_ENABLE Adafruit_ADS1115 analogInputBankA; @@ -23,7 +23,7 @@ void ESPMega_begin() inputBankA.begin(); inputBankB.begin(); pwmBank.begin(); - ESPMega_EEPROM.begin(); + ESPMega_FRAM.begin(FRAM_ADDRESS); // ESPMegaPRO v3 use the PWMBank to drive Half Bridge // Push Pull Output is required. pwmBank.setOutputMode(true); diff --git a/Template Project/lib/ESPMegaPRO/ESPMegaPRO.h b/Template Project/lib/ESPMegaPRO/ESPMegaPRO.h index e552741..c11688e 100644 --- a/Template Project/lib/ESPMegaPRO/ESPMegaPRO.h +++ b/Template Project/lib/ESPMegaPRO/ESPMegaPRO.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include @@ -24,12 +24,12 @@ #define DAC1_ADDRESS 0x61 #define DAC2_ADDRESS 0x62 #define DAC3_ADDRESS 0x63 -#define EEPROM_ADDRESS 0x5A +#define FRAM_ADDRESS 0x56 //#define USE_INTERRUPT #define INPUT_BANK_A_INTERRUPT 36 #define INPUT_BANK_B_INTERRUPT 39 -extern I2C_eeprom ESPMega_EEPROM; +extern FRAM ESPMega_FRAM; #define ESPMega_configNTP configTime struct rtctime_t { uint8_t hours; diff --git a/Template Project/platformio.ini b/Template Project/platformio.ini index 71dcb86..fc695a6 100644 --- a/Template Project/platformio.ini +++ b/Template Project/platformio.ini @@ -20,7 +20,7 @@ lib_deps = adafruit/Adafruit PWM Servo Driver Library@^2.4.1 arduino-libraries/Arduino_BuiltIn@^1.0.0 SPI@^2.0.0 robtillaart/MCP4725@^0.3.7 - robtillaart/I2C_EEPROM@^1.7.3 + robtillaart/FRAM_I2C@^0.6.1 paulstoffregen/Time@^1.6.1 paulstoffregen/DS1307RTC@0.0.0-alpha+sha.c2590c0033 monitor_speed = 115200 \ No newline at end of file diff --git a/Template Project/src/fram_demo.cpp b/Template Project/src/fram_demo.cpp new file mode 100644 index 0000000..bd77c2b --- /dev/null +++ b/Template Project/src/fram_demo.cpp @@ -0,0 +1,37 @@ +#include +void setup() +{ + ESPMega_begin(); + Serial.begin(115200); + uint8_t a = 35; + uint8_t b = 42; + uint8_t c = 66; + uint8_t d = 251; + + // ESPMega_FRAM.write8(0,a); + // ESPMega_FRAM.write8(1,b); + // ESPMega_FRAM.write8(2,c); + // ESPMega_FRAM.write8(3,d); + + uint8_t e = ESPMega_FRAM.read8(0); + uint8_t f = ESPMega_FRAM.read8(1); + uint8_t g = ESPMega_FRAM.read8(2); + uint8_t h = ESPMega_FRAM.read8(3); + Serial.println(e); + Serial.println(f); + Serial.println(g); + Serial.println(h); + char ll[2000] = "Everyone has a dream they strive to achieve, and so does the musically talented Kanon Shibuya. However, due to her stage fright, Kanon fails to make it into Yuigaoka Girls' High School's music program and instead ends up in the general curriculum. Even though Kanon makes the conscious decision to quit music altogether, her classmate Tang Keke rekindles Kanon's passion for music with her own: a passion for school idols."; + + // ESPMega_FRAM.write(4,(uint8_t*)ll,2000); + + char llr[2000]; + ESPMega_FRAM.read(4,(uint8_t*)llr,2000); + Serial.println(llr); + + +} + +void loop() +{ +} \ No newline at end of file diff --git a/Template Project/src/fram_demo.cpp.disabled b/Template Project/src/fram_demo.cpp.disabled deleted file mode 100644 index e69de29..0000000 diff --git a/Template Project/src/i2c_scanner.cpp b/Template Project/src/i2c_scanner.cpp.disabled similarity index 100% rename from Template Project/src/i2c_scanner.cpp rename to Template Project/src/i2c_scanner.cpp.disabled