parent
cf1d4d2f17
commit
351d6cdd50
@ -1,43 +1,61 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import harbour.i2ctool.I2cif 1.0
|
||||
import melexis.driver 1.0
|
||||
|
||||
Page {
|
||||
id: page
|
||||
id: probePage
|
||||
property string deviceName: "/dev/i2c-1"
|
||||
|
||||
// The effective value will be restricted by ApplicationWindow.allowedOrientations
|
||||
allowedOrientations: Orientation.All
|
||||
SilicaFlickable
|
||||
{
|
||||
Grid
|
||||
{
|
||||
Button
|
||||
{
|
||||
id: probeBTN
|
||||
text: "check camera present"
|
||||
onClicked: {probeBTN.text="probing..."; i2cif.tohVddSet("on"); i2cif.i2cProbe(deviceName)}
|
||||
}
|
||||
Label
|
||||
{
|
||||
|
||||
// To enable PullDownMenu, place our content in a SilicaFlickable
|
||||
SilicaFlickable {
|
||||
anchors.fill: parent
|
||||
id: resultLabel
|
||||
text: "0"
|
||||
}
|
||||
|
||||
// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: qsTr("Show Page 2")
|
||||
onClicked: pageStack.animatorPush(Qt.resolvedUrl("SecondPage.qml"))
|
||||
}
|
||||
}
|
||||
|
||||
I2cif
|
||||
{
|
||||
id: i2cif
|
||||
|
||||
onI2cProbingChanged:
|
||||
{
|
||||
var results = i2cif.i2cProbingStatus;
|
||||
for (var i=0 ; i<i2cif.i2cProbingStatus.length ; i++)
|
||||
{
|
||||
var res = results[i]
|
||||
if(res === "ok"){
|
||||
resultLabel.text = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tell SilicaFlickable the height of its content.
|
||||
contentHeight: column.height
|
||||
probeBTN.text = "probe done";
|
||||
thermal.fuzzyInit();
|
||||
}
|
||||
}
|
||||
|
||||
// Place our content in a Column. The PageHeader is always placed at the top
|
||||
// of the page, followed by our content.
|
||||
Column {
|
||||
id: column
|
||||
MLX90640{
|
||||
id: thermal
|
||||
|
||||
width: page.width
|
||||
spacing: Theme.paddingLarge
|
||||
PageHeader {
|
||||
title: qsTr("UI Template")
|
||||
}
|
||||
Label {
|
||||
x: Theme.horizontalPageMargin
|
||||
text: qsTr("Hello Sailors")
|
||||
color: Theme.secondaryHighlightColor
|
||||
font.pixelSize: Theme.fontSizeExtraLarge
|
||||
}
|
||||
onDataReady:
|
||||
{
|
||||
var image = thermal.imageVect;
|
||||
resultLabel.text = image[200];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,38 +1,40 @@
|
||||
#include "MLX90640_I2C_Driver.h"
|
||||
#include "mlx90640_I2C_Driver.h"
|
||||
#include "i2cdriversingleton.h"
|
||||
#include <QString>
|
||||
|
||||
#define DEFAULT_I2C_DEV QString("/dev/i2c-1/")
|
||||
|
||||
///
|
||||
/// \brief MLX90640_I2CInit Setup the I2C lines
|
||||
/// \brief mlx90640_I2CInit Setup the I2C lines
|
||||
///
|
||||
void MLX90640_I2CInit(void){
|
||||
void mlx90640_I2CInit(void){
|
||||
i2cDriverSingleton::getinstance()->tohVddSet(QString("on"));
|
||||
i2cDriverSingleton::getinstance()->i2cProbe(DEFAULT_I2C_DEV);
|
||||
}
|
||||
|
||||
///
|
||||
/// \brief MLX90640_I2CGeneralReset resets the I2C line and devices
|
||||
/// \brief mlx90640_I2CGeneralReset resets the I2C line and devices
|
||||
/// \return 0 if success
|
||||
///
|
||||
int MLX90640_I2CGeneralReset(void){
|
||||
int mlx90640_I2CGeneralReset(void){
|
||||
|
||||
}
|
||||
|
||||
///
|
||||
/// \brief MLX90640_I2CFreqSet Sets the frequency for the I2C bus
|
||||
/// \brief mlx90640_I2CFreqSet Sets the frequency for the I2C bus
|
||||
/// \param freq
|
||||
///
|
||||
void MLX90640_I2CFreqSet(int freq){
|
||||
void mlx90640_I2CFreqSet(int freq){
|
||||
|
||||
}
|
||||
|
||||
int MLX90640_I2CRead(uint8_t slaveAddr,uint16_t startAddress, uint16_t nMemAddressRead, uint16_t *data){
|
||||
i2cDriverSingleton::getinstance()->i2cRead(DEFAULT_I2C_DEV,nMemAddressRead,nMemAddressRead);
|
||||
int mlx90640_I2CRead(uint8_t slaveAddr,uint16_t startAddress, uint16_t nMemAddressRead, uint16_t *data){
|
||||
i2cDriverSingleton::getinstance()->i2cRead(slaveAddr, startAddress, nMemAddressRead, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MLX90640_I2CWrite(uint8_t slaveAddr,uint16_t writeAddress, uint16_t data)
|
||||
int mlx90640_I2CWrite(uint8_t slaveAddr,uint16_t writeAddress, uint16_t data)
|
||||
{
|
||||
i2cDriverSingleton::getinstance()->i2cWrite(DEFAULT_I2C_DEV,writeAddress,QString(data));
|
||||
i2cDriverSingleton::getinstance()->i2cWrite(slaveAddr, writeAddress, data);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in new issue