Bit of scaffolding for I2C. Meme commit.

This commit is contained in:
EspoTek 2017-12-01 15:31:21 +11:00
parent 2e803a6f94
commit c93cf854da
21 changed files with 293 additions and 136 deletions

2
.gitignore vendored
View File

@ -26,3 +26,5 @@ Desktop_Interface/build_android/package_source/gradle.properties~
Desktop_Interface/build_android/package_source/local.properties
Desktop_Interface/build_android/package_source/local.properties~
Desktop_Interface/qrc_resources.cpp
AVR Code/USB_BULK_TEST/Debug
AVR Code/USB_BULK_TEST/Release

View File

@ -108,17 +108,17 @@
<documentation help="http://asf.atmel.com/docs/3.22.0/common.applications.user_application.user_board.xmegaau/html/index.html" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.22.0" />
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.26.0" />
</dependencies>
<project id="common.applications.user_application.user_board.xmegaau" value="Add" config="" content-id="Atmel.ASF" />
<board id="board.user_board.xmegaau" value="Add" config="" content-id="Atmel.ASF" />
</framework-data>
</AsfFrameworkConfig>
<avrtool>com.atmel.avrdbg.tool.atmelice</avrtool>
<avrtool>custom</avrtool>
<com_atmel_avrdbg_tool_atmelice>
<ToolOptions>
<InterfaceProperties>
<PdiClock>4000000</PdiClock>
<PdiClock>0</PdiClock>
<JtagDbgClock>7500000</JtagDbgClock>
</InterfaceProperties>
<InterfaceName>PDI</InterfaceName>
@ -139,9 +139,23 @@
</ToolNumber>
<ToolName>Simulator</ToolName>
</com_atmel_avrdbg_tool_simulator>
<avrtoolserialnumber>J41800006314</avrtoolserialnumber>
<avrtoolserialnumber>
</avrtoolserialnumber>
<avrdeviceexpectedsignature>0x1E9541</avrdeviceexpectedsignature>
<avrtoolinterfaceclock>4000000</avrtoolinterfaceclock>
<avrtoolinterfaceclock>0</avrtoolinterfaceclock>
<ResetRule>0</ResetRule>
<EraseKey />
<custom>
<ToolOptions xmlns="">
<InterfaceProperties>
</InterfaceProperties>
<InterfaceName>PDI</InterfaceName>
</ToolOptions>
<ToolType xmlns="">custom</ToolType>
<ToolNumber xmlns="">
</ToolNumber>
<ToolName xmlns="">Custom Programming Tool</ToolName>
</custom>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>

View File

@ -9,7 +9,7 @@
#ifndef GLOBALS_H_
#define GLOBALS_H_
#define SINGLE_ENDPOINT_INTERFACE
//#define SINGLE_ENDPOINT_INTERFACE
//#define VERO
#define OVERCLOCK 48

Binary file not shown.

View File

@ -4,6 +4,6 @@
# as it contains information specific to your local configuration.
androidBuildToolsVersion=25.0.2
androidCompileSdkVersion=25
androidCompileSdkVersion=22
buildDir=.build
qt5AndroidDir=C:/Qt/5.7/android_armv7/src/android/java

View File

@ -4,6 +4,6 @@
# as it contains information specific to your local configuration.
androidBuildToolsVersion=25.0.2
androidCompileSdkVersion=25
androidCompileSdkVersion=22
buildDir=.build
qt5AndroidDir=C:/Qt/5.7/android_armv7/src/android/java

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,137 @@
/****************************************************************************
** Resource object code
**
** Created by: The Resource Compiler for Qt version 5.9.1
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
static const unsigned char qt_resource_data[] = {
// C:/Users/Esposch/Documents/Git/Labrador/Desktop_Interface/buffer_0.bmp
0x0,0x0,0x0,0x8d,
0x0,
0x0,0x28,0xb6,0x78,0x9c,0xed,0xd0,0xb1,0xd,0xc2,0x30,0x0,0x45,0xc1,0xb0,0x45,
0x6,0xa0,0xc8,0x4,0xc,0x90,0x3e,0x3b,0x30,0xa,0x53,0xb1,0x1e,0x98,0x28,0x5,
0xd5,0xd5,0x2e,0xde,0x49,0x5f,0xb2,0xec,0xc6,0x7a,0xfb,0xf1,0xde,0x96,0xd3,0x63,
0xec,0x77,0x7c,0x8e,0xdd,0xc7,0x6e,0xcb,0x7a,0xde,0xbf,0xae,0xf7,0x7f,0x9f,0x69,
0x4c,0xfb,0xb1,0x49,0xd4,0xc7,0xea,0x63,0xf5,0xb1,0xfa,0x58,0x7d,0xac,0x3e,0x56,
0x1f,0xab,0x8f,0xd5,0xc7,0xea,0x63,0xf5,0xb1,0xfa,0x58,0x7d,0xac,0x3e,0x56,0x1f,
0xab,0x8f,0xd5,0xc7,0xea,0x63,0xf5,0xb1,0xfa,0x58,0x7d,0xac,0x3e,0x56,0x1f,0xab,
0x8f,0xd5,0xc7,0xea,0x63,0xf5,0xb1,0xfa,0x58,0x7d,0xac,0x3e,0x56,0x1f,0xab,0x8f,
0xd5,0xc7,0xea,0x63,0x73,0xf6,0xf9,0x2,0xf4,0x4,0x42,0xe7,
// C:/Users/Esposch/Documents/Git/Labrador/Desktop_Interface/buffer_2.bmp
0x0,0x0,0x0,0x7b,
0x0,
0x0,0x28,0xb6,0x78,0x9c,0xed,0xd0,0x31,0xd,0x80,0x30,0x14,0x45,0xd1,0xe2,0x82,
0x81,0xb1,0x3,0xa,0x10,0xc0,0x8e,0x7,0xa4,0xa0,0xa,0x57,0x78,0xa0,0x34,0xc,
0x95,0xf0,0x86,0xf3,0x73,0x7f,0xd2,0xb4,0x4b,0x73,0xf6,0xe3,0x5e,0x4b,0x9f,0xad,
0xed,0x77,0x3c,0xdb,0xd6,0xb6,0x53,0x99,0xfb,0xfd,0xf5,0xbf,0x8f,0x53,0x97,0x27,
0xa4,0xd8,0x8f,0x85,0xc4,0x87,0xf,0x1f,0x3e,0x7c,0x32,0xe3,0xc3,0x87,0xf,0x1f,
0x3e,0x99,0xf1,0xe1,0xc3,0x87,0xf,0x9f,0xcc,0xf8,0xf0,0xe1,0xc3,0x87,0x4f,0x66,
0x7c,0xf8,0xf0,0xe1,0xc3,0x27,0x33,0x3e,0x7c,0xf8,0xf0,0xe1,0x93,0x19,0x1f,0x3e,
0x7c,0xf8,0xf0,0x19,0x7b,0x1,0x6d,0x5a,0xf,0xce,
// C:/Users/Esposch/Documents/Git/Labrador/Desktop_Interface/buffer_1.bmp
0x0,0x0,0x0,0x97,
0x0,
0x0,0x28,0xb6,0x78,0x9c,0xed,0xd0,0xb1,0xd,0xc2,0x30,0x10,0x40,0xd1,0xb0,0x5,
0x5,0x65,0xa,0x26,0x60,0x0,0x7a,0x76,0x60,0x14,0xa6,0x62,0x2b,0x66,0x0,0x27,
0x42,0x2,0x51,0xbc,0x96,0x14,0xff,0xc9,0x27,0x9d,0xec,0xc6,0xfa,0xe7,0xcb,0xfd,
0x38,0xad,0x4e,0x63,0x96,0xf5,0x3a,0x66,0x1e,0xb3,0x9b,0xf6,0xeb,0xfd,0xed,0xfd,
0xfe,0xed,0xb9,0x19,0x3f,0x1f,0x9b,0xf,0x8f,0x2d,0x9c,0x7f,0x57,0xf9,0xa8,0x8f,
0xd5,0xc7,0xea,0x63,0xf5,0xb1,0xfa,0x58,0x7d,0xac,0x3e,0x56,0x1f,0xab,0x8f,0xd5,
0xc7,0xea,0x63,0xf5,0xb1,0xfa,0x58,0x7d,0xac,0x3e,0x56,0x1f,0xab,0x8f,0xd5,0xc7,
0xea,0x63,0xf5,0xb1,0xfa,0x58,0x7d,0xac,0x3e,0x56,0x1f,0xab,0x8f,0xd5,0xc7,0xea,
0x63,0xf5,0xb1,0xfa,0x58,0x7d,0xac,0x3e,0x56,0x1f,0xab,0x8f,0xd5,0xc7,0xb6,0xd9,
0xe7,0x5,0x35,0x2d,0xc9,0xf3,
};
static const unsigned char qt_resource_name[] = {
// bitmap
0x0,0x6,
0x6,0x90,0xb3,0x80,
0x0,0x62,
0x0,0x69,0x0,0x74,0x0,0x6d,0x0,0x61,0x0,0x70,
// buffer_0.bmp
0x0,0xc,
0xd,0x14,0xd0,0xc0,
0x0,0x62,
0x0,0x75,0x0,0x66,0x0,0x66,0x0,0x65,0x0,0x72,0x0,0x5f,0x0,0x30,0x0,0x2e,0x0,0x62,0x0,0x6d,0x0,0x70,
// buffer_2.bmp
0x0,0xc,
0xd,0x12,0xd0,0xc0,
0x0,0x62,
0x0,0x75,0x0,0x66,0x0,0x66,0x0,0x65,0x0,0x72,0x0,0x5f,0x0,0x32,0x0,0x2e,0x0,0x62,0x0,0x6d,0x0,0x70,
// buffer_1.bmp
0x0,0xc,
0xd,0x17,0xd0,0xc0,
0x0,0x62,
0x0,0x75,0x0,0x66,0x0,0x66,0x0,0x65,0x0,0x72,0x0,0x5f,0x0,0x31,0x0,0x2e,0x0,0x62,0x0,0x6d,0x0,0x70,
};
static const unsigned char qt_resource_struct[] = {
// :
0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// :/bitmap
0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x2,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// :/bitmap/buffer_2.bmp
0x0,0x0,0x0,0x30,0x0,0x1,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x91,
0x0,0x0,0x1,0x5f,0x3d,0x9a,0x27,0x47,
// :/bitmap/buffer_0.bmp
0x0,0x0,0x0,0x12,0x0,0x1,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,
0x0,0x0,0x1,0x5f,0x3d,0x9a,0x27,0x46,
// :/bitmap/buffer_1.bmp
0x0,0x0,0x0,0x4e,0x0,0x1,0x0,0x0,0x0,0x1,0x0,0x0,0x1,0x10,
0x0,0x0,0x1,0x5f,0x3d,0x9a,0x27,0x46,
};
#ifdef QT_NAMESPACE
# define QT_RCC_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name
# define QT_RCC_MANGLE_NAMESPACE0(x) x
# define QT_RCC_MANGLE_NAMESPACE1(a, b) a##_##b
# define QT_RCC_MANGLE_NAMESPACE2(a, b) QT_RCC_MANGLE_NAMESPACE1(a,b)
# define QT_RCC_MANGLE_NAMESPACE(name) QT_RCC_MANGLE_NAMESPACE2( \
QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE))
#else
# define QT_RCC_PREPEND_NAMESPACE(name) name
# define QT_RCC_MANGLE_NAMESPACE(name) name
#endif
#ifdef QT_NAMESPACE
namespace QT_NAMESPACE {
#endif
bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
#ifdef QT_NAMESPACE
}
#endif
int QT_RCC_MANGLE_NAMESPACE(qInitResources_resources)();
int QT_RCC_MANGLE_NAMESPACE(qInitResources_resources)()
{
QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData)
(0x2, qt_resource_struct, qt_resource_name, qt_resource_data);
return 1;
}
int QT_RCC_MANGLE_NAMESPACE(qCleanupResources_resources)();
int QT_RCC_MANGLE_NAMESPACE(qCleanupResources_resources)()
{
QT_RCC_PREPEND_NAMESPACE(qUnregisterResourceData)
(0x2, qt_resource_struct, qt_resource_name, qt_resource_data);
return 1;
}
namespace {
struct initializer {
initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources_resources)(); }
~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources_resources)(); }
} dummy;
}

View File

@ -17,7 +17,7 @@
#define EXPECTED_FIRMWARE_VERSION 0x0003
#ifdef BABABOOEY_BABABOOEY_HOWARD_STERNS_PENIS
#ifdef PLATFORM_WINDOWS
#define DEFINED_EXPECTED_VARIANT 1
#define ISO_PACKET_SIZE 125
#define NUM_ISO_ENDPOINTS (6)

View File

@ -302,19 +302,19 @@ int isoBuffer::cap_x2fromLast(double seconds, int x1, double vtop){
}
void isoBuffer::serialManage(double baudRate, int type){
qDebug() << "serialManage() checkpoint 1";
//Types:
// 0 - standard UART, no parity
// 1 - standard UART, with parity bit
// 100 - I2C
if(decoder == NULL){
decoder = new uartStyleDecoder(this);
qDebug() << decoder;
connect(decoder, SIGNAL(wireDisconnected(int)), virtualParent, SLOT(serialNeedsDisabling(int)));
}
if(stopDecoding){
decoder->updateTimer->start(CONSOLE_UPDATE_TIMER_PERIOD);
stopDecoding = false;
}
qDebug() << "serialManage() checkpoint 2";
decoder->serialDecode(baudRate);
qDebug() << "serialManage() end";
}

View File

@ -22,7 +22,7 @@ class uartStyleDecoder;
//isoBuffer is a generic class that enables O(1) read times (!!!) on all read/write operations, while maintaining a huge buffer size.
//Imagine it as a circular buffer, but with access functions specifically designed for isochronous data from an Xmega.
#define CONSOLE_UPDATE_TIMER_PERIOD (ISO_PACKETS_PER_CTX * 2)
#define CONSOLE_UPDATE_TIMER_PERIOD (ISO_PACKETS_PER_CTX * 4)
class isoBuffer : public QWidget
{

View File

@ -157,6 +157,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->controller_iso, SIGNAL(sendVRMS_CH2(double)), ui->voltageInfoRmsDisplay_CH2, SLOT(display(double)));
connect(ui->controller_iso, SIGNAL(mainWindowPleaseDisableSerial(int)), this, SLOT(serialEmergencyDisable(int)));
connect(ui->serialDecodingModeSelect_CH1, SIGNAL(currentIndexChanged(int)), this, SLOT(checkForI2C(int)));
}
@ -1716,3 +1718,16 @@ void MainWindow::serialEmergencyDisable(int channel){
}
}
//This is a slot that intercepts a signal from the serial decoding CH1 checkbox.
//It changes the mode to ensure I2C can work.
//Both channels are necessary; SDA and SCL.
void MainWindow::checkForI2C(int value){
if(value==2){
ui->scopeGroup_CH1->setChecked(false);
ui->scopeGroup_CH2->setChecked(false);
ui->multimeterGroup->setChecked(false);
}
return;
}

View File

@ -156,6 +156,8 @@ private slots:
void on_actionRecord_CH2_triggered(bool checked);
void serialEmergencyDisable(int channel);
void checkForI2C(int value);
private:
//Generic Vars
Ui::MainWindow *ui;

View File

@ -2,16 +2,13 @@
uartStyleDecoder::uartStyleDecoder(QObject *parent_in) : QObject(parent_in)
{
qDebug() << "uartStyleDecoder() checkpoint 1";
parent = (isoBuffer *) parent_in;
qDebug() << "uartStyleDecoder() checkpoint 2";
updateTimer = new QTimer();
updateTimer->setTimerType(Qt::PreciseTimer);
updateTimer->start(CONSOLE_UPDATE_TIMER_PERIOD);
connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateConsole()));
qDebug() << "uartStyleDecoder() checkpoint 3";
serialBuffer = new isoBufferBuffer(SERIAL_BUFFER_LENGTH*2);
if(parent->channel == 1) console = parent->console1;
@ -22,7 +19,7 @@ uartStyleDecoder::uartStyleDecoder(QObject *parent_in) : QObject(parent_in)
void uartStyleDecoder::updateConsole(){
if(!newUartSymbol) return;
qDebug() << numCharsInBuffer;
//qDebug() << numCharsInBuffer;
console->setPlainText(QString::fromLocal8Bit(serialBuffer->get(numCharsInBuffer), numCharsInBuffer));
if(parent->serialAutoScroll){

View File

@ -1223,11 +1223,6 @@
<string>SPI</string>
</property>
</item>
<item>
<property name="text">
<string>I2C</string>
</property>
</item>
</widget>
</item>
</layout>

View File

@ -88,7 +88,7 @@
</font>
</property>
<property name="currentIndex">
<number>1</number>
<number>4</number>
</property>
<widget class="QWidget" name="page">
<property name="font">
@ -1752,11 +1752,6 @@
<string>SPI</string>
</property>
</item>
<item>
<property name="text">
<string>I2C</string>
</property>
</item>
</widget>
</item>
</layout>
@ -1792,7 +1787,7 @@
<x>0</x>
<y>0</y>
<width>720</width>
<height>21</height>
<height>31</height>
</rect>
</property>
<widget class="QMenu" name="menuOscilloscope_2">