This commit is contained in:
Siwat Sirichai 2023-09-28 14:22:19 +07:00
parent cf35e07c2f
commit 35cbbbf295
6 changed files with 43 additions and 6 deletions

View File

@ -6,7 +6,7 @@ uint8_t inputBufferB;
PCF8574 inputBankA(INPUT_BANK_A_ADDRESS); PCF8574 inputBankA(INPUT_BANK_A_ADDRESS);
PCF8574 inputBankB(INPUT_BANK_B_ADDRESS); PCF8574 inputBankB(INPUT_BANK_B_ADDRESS);
Adafruit_PWMServoDriver pwmBank = Adafruit_PWMServoDriver(PWM_BANK_ADDRESS); Adafruit_PWMServoDriver pwmBank = Adafruit_PWMServoDriver(PWM_BANK_ADDRESS);
I2C_eeprom ESPMega_EEPROM(EEPROM_ADDRESS); FRAM ESPMega_FRAM;
#ifdef ANALOG_CARD_ENABLE #ifdef ANALOG_CARD_ENABLE
Adafruit_ADS1115 analogInputBankA; Adafruit_ADS1115 analogInputBankA;
@ -23,7 +23,7 @@ void ESPMega_begin()
inputBankA.begin(); inputBankA.begin();
inputBankB.begin(); inputBankB.begin();
pwmBank.begin(); pwmBank.begin();
ESPMega_EEPROM.begin(); ESPMega_FRAM.begin(FRAM_ADDRESS);
// ESPMegaPRO v3 use the PWMBank to drive Half Bridge // ESPMegaPRO v3 use the PWMBank to drive Half Bridge
// Push Pull Output is required. // Push Pull Output is required.
pwmBank.setOutputMode(true); pwmBank.setOutputMode(true);

View File

@ -5,7 +5,7 @@
#include <Wire.h> #include <Wire.h>
#include <Adafruit_PWMServoDriver.h> #include <Adafruit_PWMServoDriver.h>
#include <PCF8574.h> #include <PCF8574.h>
#include <I2C_eeprom.h> #include <FRAM.h>
#include <TimeLib.h> #include <TimeLib.h>
#include <DS1307RTC.h> #include <DS1307RTC.h>
#include <time.h> #include <time.h>
@ -24,12 +24,12 @@
#define DAC1_ADDRESS 0x61 #define DAC1_ADDRESS 0x61
#define DAC2_ADDRESS 0x62 #define DAC2_ADDRESS 0x62
#define DAC3_ADDRESS 0x63 #define DAC3_ADDRESS 0x63
#define EEPROM_ADDRESS 0x5A #define FRAM_ADDRESS 0x56
//#define USE_INTERRUPT //#define USE_INTERRUPT
#define INPUT_BANK_A_INTERRUPT 36 #define INPUT_BANK_A_INTERRUPT 36
#define INPUT_BANK_B_INTERRUPT 39 #define INPUT_BANK_B_INTERRUPT 39
extern I2C_eeprom ESPMega_EEPROM; extern FRAM ESPMega_FRAM;
#define ESPMega_configNTP configTime #define ESPMega_configNTP configTime
struct rtctime_t { struct rtctime_t {
uint8_t hours; uint8_t hours;

View File

@ -20,7 +20,7 @@ lib_deps = adafruit/Adafruit PWM Servo Driver Library@^2.4.1
arduino-libraries/Arduino_BuiltIn@^1.0.0 arduino-libraries/Arduino_BuiltIn@^1.0.0
SPI@^2.0.0 SPI@^2.0.0
robtillaart/MCP4725@^0.3.7 robtillaart/MCP4725@^0.3.7
robtillaart/I2C_EEPROM@^1.7.3 robtillaart/FRAM_I2C@^0.6.1
paulstoffregen/Time@^1.6.1 paulstoffregen/Time@^1.6.1
paulstoffregen/DS1307RTC@0.0.0-alpha+sha.c2590c0033 paulstoffregen/DS1307RTC@0.0.0-alpha+sha.c2590c0033
monitor_speed = 115200 monitor_speed = 115200

View File

@ -0,0 +1,37 @@
#include <ESPMegaPRO.h>
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()
{
}