parent
cf1d4d2f17
commit
351d6cdd50
@ -1,43 +1,61 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
|
import harbour.i2ctool.I2cif 1.0
|
||||||
|
import melexis.driver 1.0
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
id: page
|
id: probePage
|
||||||
|
property string deviceName: "/dev/i2c-1"
|
||||||
|
|
||||||
// The effective value will be restricted by ApplicationWindow.allowedOrientations
|
|
||||||
allowedOrientations: Orientation.All
|
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
|
id: resultLabel
|
||||||
SilicaFlickable {
|
text: "0"
|
||||||
anchors.fill: parent
|
}
|
||||||
|
|
||||||
// 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"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell SilicaFlickable the height of its content.
|
I2cif
|
||||||
contentHeight: column.height
|
{
|
||||||
|
id: i2cif
|
||||||
|
|
||||||
// Place our content in a Column. The PageHeader is always placed at the top
|
onI2cProbingChanged:
|
||||||
// of the page, followed by our content.
|
{
|
||||||
Column {
|
var results = i2cif.i2cProbingStatus;
|
||||||
id: column
|
for (var i=0 ; i<i2cif.i2cProbingStatus.length ; i++)
|
||||||
|
{
|
||||||
|
var res = results[i]
|
||||||
|
if(res === "ok"){
|
||||||
|
resultLabel.text = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
width: page.width
|
probeBTN.text = "probe done";
|
||||||
spacing: Theme.paddingLarge
|
thermal.fuzzyInit();
|
||||||
PageHeader {
|
|
||||||
title: qsTr("UI Template")
|
|
||||||
}
|
}
|
||||||
Label {
|
|
||||||
x: Theme.horizontalPageMargin
|
|
||||||
text: qsTr("Hello Sailors")
|
|
||||||
color: Theme.secondaryHighlightColor
|
|
||||||
font.pixelSize: Theme.fontSizeExtraLarge
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MLX90640{
|
||||||
|
id: thermal
|
||||||
|
|
||||||
|
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 "i2cdriversingleton.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#define DEFAULT_I2C_DEV QString("/dev/i2c-1/")
|
#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()->tohVddSet(QString("on"));
|
||||||
i2cDriverSingleton::getinstance()->i2cProbe(DEFAULT_I2C_DEV);
|
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
|
/// \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
|
/// \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){
|
int mlx90640_I2CRead(uint8_t slaveAddr,uint16_t startAddress, uint16_t nMemAddressRead, uint16_t *data){
|
||||||
i2cDriverSingleton::getinstance()->i2cRead(DEFAULT_I2C_DEV,nMemAddressRead,nMemAddressRead);
|
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