Compare commits

...

3 Commits

Author SHA1 Message Date
Siwat Sirichai 8bb4a2ff55 Update analogdemo.cpp 2023-10-12 19:40:50 +07:00
Siwat Sirichai 46ec54355a analog SDK 2023-10-12 19:36:47 +07:00
Siwat Sirichai 35cbbbf295 fram 2023-09-28 14:22:19 +07:00
8 changed files with 67 additions and 21 deletions

View File

@ -10,5 +10,6 @@
"initializer_list": "cpp",
"adafruit_ads1x15.h": "c"
},
"cmake.configureOnOpen": true
"cmake.configureOnOpen": true,
"cmake.sourceDirectory": "D:/Git/ESPMegaPRO-v3-SDK/Template Project/.pio/libdeps/wt32-eth01/Adafruit BusIO"
}

View File

@ -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);

View File

@ -5,7 +5,7 @@
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
#include <PCF8574.h>
#include <I2C_eeprom.h>
#include <FRAM.h>
#include <TimeLib.h>
#include <DS1307RTC.h>
#include <time.h>
@ -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;

View File

@ -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

View File

@ -0,0 +1,22 @@
#include <ESPMegaPRO.h>
#define ADC
void setup()
{
Serial.begin(115200);
ESPMega_begin();
}
void loop()
{
#ifdef DAC
for(int i=0;i<4096;i++) {
ESPMega_dacWrite(0,i);
double dac_val_sine = 2047.5*sin(i*2*PI/2047.5)+2047.5;
ESPMega_dacWrite(1,(int)dac_val_sine);
}
#endif
#ifdef ADC
Serial.printf("A0: %d",ESPMega_analogRead(0));
#endif
}

View File

@ -1,14 +0,0 @@
#include <ESPMegaPRO.h>
void setup()
{
Serial.begin(115200);
ESPMega_begin();
ESPMega_dacWrite(0,2000);
ESPMega_dacWrite(1,2000);
}
void loop()
{
delay(100);
}

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()
{
}