Adding beginning of NxWM touchscreen support

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4718 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-05-09 22:30:19 +00:00
parent a4fecca40b
commit c5e96122d1
20 changed files with 1337 additions and 7 deletions

View File

@ -51,4 +51,7 @@
* All application windows now use CWindowEventHandler and CWindowEventHandlerList * All application windows now use CWindowEventHandler and CWindowEventHandlerList
to get notifications about mouse and keyboard events. These class will to get notifications about mouse and keyboard events. These class will
then automatically handle polling (with no need for a modal loop). then automatically handle polling (with no need for a modal loop).
* CTouchscreen and CCalibration: Add touchscreen support (still a long way
to go).

View File

@ -46,6 +46,7 @@
#include "ctaskbar.hxx" #include "ctaskbar.hxx"
#include "cstartwindow.hxx" #include "cstartwindow.hxx"
#include "ccalibration.hxx"
#include "cnxconsole.hxx" #include "cnxconsole.hxx"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -79,6 +80,9 @@ struct SNxWmTest
{ {
NxWM::CTaskbar *taskbar; // The task bar NxWM::CTaskbar *taskbar; // The task bar
NxWM::CStartWindow *startwindow; // The start window NxWM::CStartWindow *startwindow; // The start window
#ifdef CONFIG_NXWM_TOUCHSCREEN
NxWM::CTouchscreen *touchscreen; // The touchscreen
#endif
unsigned int mmInitial; // Initial memory usage unsigned int mmInitial; // Initial memory usage
unsigned int mmStep; // Memory Usage at beginning of test step unsigned int mmStep; // Memory Usage at beginning of test step
unsigned int mmSubStep; // Memory Usage at beginning of test sub-step unsigned int mmSubStep; // Memory Usage at beginning of test sub-step
@ -326,6 +330,90 @@ int MAIN_NAME(int argc, char *argv[])
} }
showTestCaseMemory("After create the start window application"); showTestCaseMemory("After create the start window application");
// Perform touchscreen calibration
#if 0 // defined(CONFIG_NXWM_TOUCHSCREEN) -- Not ready for prime time
NxWM::CCalibration *calibration = (NxWM::CCalibration *)0; // Avoid compiler complaint
NxWM::CFullScreenWindow *fullscreen = (NxWM::CFullScreenWindow *)0; // Avoid compiler complaint
// Create the touchscreen device
printf(MAIN_STRING "Creating CTouchscreen\n");
g_nxwmtest.touchscreen = new NxWM::CTouchscreen;
if (!touchscreen)
{
printf(MAIN_STRING "ERROR: Failed to create CTouchscreen\n");
goto nocalibration;
}
printf(MAIN_STRING "Initialize the CTouchscreen\n");
if (!g_nxwmtest.touchscreen->open())
{
printf(MAIN_STRING "ERROR: Failed to open the CTouchscreen \n");
delete g_nxwmtest.touchscreen;
goto nocalibration;
}
showTestCaseMemory("After initializing CTouchscreen");
// 1. Call CTaskBar::FullScreenWindow to create a window for the application,
// 2. Instantiate the application, providing the window to the application's
// constructor,
// 3. Then call CStartWindow::addApplication to add the application to the
// start window.
// 4. Call CTaskBar::startApplication start the application and bring its window to
// the top.
printf(MAIN_STRING "Opening the calibrationapplication window\n");
fullscreen = g_nxwmtest.taskbar->openFullScreenWindow();
if (!fullscreen)
{
printf(MAIN_STRING "ERROR: Failed to create CFullScreenWindow for the calibration window\n");
goto nocalibration;
}
showTestCaseMemory("After creating calibration full screen window");
printf(MAIN_STRING "Initialize the CFullScreenWindow\n");
if (!fullscreen->open())
{
printf(MAIN_STRING "ERROR: Failed to open the CFullScreenWindow \n");
delete fullscreen;
goto nocalibration;
}
showTestCaseMemory("After initializing the calibration full screen window");
printf(MAIN_STRING "Creating the CCalibration application\n");
calibration = new NxWM::CCalibration(fullscreen, g_nxwmtest.touchscreen);
if (!calibration)
{
printf(MAIN_STRING "ERROR: Failed to instantiate CCalibration\n");
delete fullscreen;
goto nocalibration;
}
showTestCaseMemory("After creating the CCalibration application");
printf(MAIN_STRING "Adding the CCalibration application to the start window\n");
if (!g_nxwmtest.startwindow->addApplication(calibration))
{
printf(MAIN_STRING "ERROR: Failed to add CCalibration to the start window\n");
delete fullscreen;
goto nocalibration;
}
showTestCaseMemory("After adding the CCalibration application");
// Call CTaskBar::startApplication to start the Calibration application
printf(MAIN_STRING "Start the start window application\n");
if (!g_nxwmtest.taskbar->startApplication(calibration, false))
{
printf(MAIN_STRING "ERROR: Failed to start the calibration application\n");
delete fullscreen;
goto nocalibration;
}
showTestCaseMemory("After starting the start window application");
nocalibration:
#endif
// Add the NxConsole application to the start window // Add the NxConsole application to the start window
NxWM::CNxConsole *console = (NxWM::CNxConsole *)0; // Avoid compiler complaint NxWM::CNxConsole *console = (NxWM::CNxConsole *)0; // Avoid compiler complaint
@ -454,6 +542,7 @@ nocalculator:
// Wait a little bit for the display to stabilize. The simulation pressing of // Wait a little bit for the display to stabilize. The simulation pressing of
// the 'start window' icon in the task bar // the 'start window' icon in the task bar
#ifndef CONFIG_NXWM_TOUCHSCREEN
sleep(2); sleep(2);
g_nxwmtest.taskbar->clickIcon(0); g_nxwmtest.taskbar->clickIcon(0);
showTestCaseMemory("After clicking the start window icon"); showTestCaseMemory("After clicking the start window icon");
@ -464,6 +553,7 @@ nocalculator:
sleep(2); sleep(2);
g_nxwmtest.startwindow->clickIcon(0); g_nxwmtest.startwindow->clickIcon(0);
showTestCaseMemory("After clicking the NxConsole icon"); showTestCaseMemory("After clicking the NxConsole icon");
#endif
// Wait bit to see the result of the button press. // Wait bit to see the result of the button press.

View File

@ -42,9 +42,11 @@ NXWIDGETDIR := $(NXWMDIR)/../libnxwidgets
ASRCS = ASRCS =
CSRCS = CSRCS =
# Window Manager # Window Manager
CXXSRCS = capplicationwindow.cxx cfullscreenwindow.cxx cnxconsole.cxx cstartwindow.cxx ctaskbar.cxx CXXSRCS = capplicationwindow.cxx ccalibration.cxx cfullscreenwindow.cxx
CXXSRCS += cnxconsole.cxx cstartwindow.cxx ctaskbar.cxx ctouchscreen.cxx
# Images # Images
CXXSRCS += glyph_cmd.cxx glyph_minimize.cxx glyph_nsh.cxx glyph_play.cxx glyph_start.cxx glyph_stop.cxx CXXSRCS += glyph_calibration.cxx glyph_cmd.cxx glyph_minimize.cxx glyph_nsh.cxx
CXXSRCS += glyph_play.cxx glyph_start.cxx glyph_stop.cxx
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)

BIN
nxwm/images/calibration.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

0
nxwm/images/cmd.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 264 B

0
nxwm/images/minimize.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 284 B

0
nxwm/images/nxlogo.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 608 B

After

Width:  |  Height:  |  Size: 608 B

0
nxwm/images/play.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 550 B

0
nxwm/images/start.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 719 B

After

Width:  |  Height:  |  Size: 719 B

0
nxwm/images/stop.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 381 B

View File

@ -0,0 +1,244 @@
/****************************************************************************
* NxWidgets/nxwm/include/ccalibration.hxx
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
* me be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_CCALIBRATION_HXX
#define __INCLUDE_CCALIBRATION_HXX
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/nx/nxglib.h>
#include <fixedmath.h>
#include "cnxstring.hxx"
#include "cwidgeteventhandler.hxx"
#include "cwidgetcontrol.hxx"
#include "iapplication.hxx"
#include "cfullscreenwindow.hxx"
#include "ctouchscreen.hxx"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/**
* Calibration indices
*/
#define CALIB_UPPER_LEFT_INDEX 0
#define CALIB_UPPER_RIGHT_INDEX 1
#define CALIB_LOWER_RIGHT_INDEX 2
#define CALIB_LOWER_LEFT_INDEX 3
#define CALIB_DATA_POINTS 4
/****************************************************************************
* Implementation Classes
****************************************************************************/
namespace NxWM
{
/**
* Touchscreen calibration data
*/
struct SCalibrationData
{
b16_t xSlope; // X conversion: xSlope*(x) + xOffset
b16_t xOffset;
b16_t ySlope; // Y conversion: ySlope*(y) + yOffset
b16_t yOffset;
};
/**
* The CCalibration class provides the the calibration window and obtains
* callibration data.
*/
class CCalibration : public IApplication, private NXWidgets::CWidgetEventHandler
{
private:
/**
* Identifies the current display state
*/
enum ECalibState
{
CALIB_NOT_STARTED = 0, /**< Constructed, but not yet started */
CALIB_UPPER_LEFT, /**< Touch point is in the upper left corner */
CALIB_UPPER_RIGHT, /**< Touch point is in the upper right corner */
CALIB_LOWER_RIGHT, /**< Touch point is in the lower left corner */
CALIB_LOWER_LEFT, /**< Touch point is in the lower right corner */
CALIB_COMPLETE /**< Calibration is complete */
};
/**
* Characterizes one calibration screen
*/
struct SCalibScreenInfo
{
struct nxgl_point_s pos; /**< The position of the touch point */
nxgl_mxpixel_t lineColor; /**< The color of the cross-hair lines */
nxgl_mxpixel_t circleFillColor; /**< The color of the circle */
};
/**
* CCalibration state data
*/
CFullScreenWindow *m_window; /**< The window for the calibration display */
CTouchscreen *m_touchscreen; /**< The touchscreen device */
enum ECalibState m_state; /**< Current calibration display state */
struct SCalibScreenInfo m_screenInfo; /**< Describes the current calibration display */
struct nxgl_point_s m_touchPos; /**< This is the last touch position */
bool m_stop; /**< True: We have been asked to stop the calibration */
bool m_touched; /**< True: The screen is touched */
sem_t m_waitSem; /**< Supports wait for calibration data */
struct nxgl_point_s m_calibData[CALIB_DATA_POINTS];
/**
* Accept raw touchscreen input.
*
* @param sample Touchscreen input sample
*/
void touchscreenInput(struct touch_sample_s &sample);
/**
* This is the calibration state machine. It is called initially and then
* as new touchscreen data is received.
*/
void stateMachine(void);
/**
* Handle a mouse button click event.
*
* @param e The event data.
*/
void handleClickEvent(const NXWidgets::CWidgetEventArgs &e);
/**
* Presents the next calibration screen
*/
void showCalibration(void);
public:
/**
* CCalibration Constructor
*
* @param window. The window to use for the calibration display
* @param touchscreen. An instance of the class that wraps the touchscreen device.
*/
CCalibration(CFullScreenWindow *window, CTouchscreen *touchscreen);
/**
* CCalibration Destructor
*/
~CCalibration(void);
/**
* Each implementation of IApplication must provide a method to recover
* the contained IApplicationWindow instance.
*/
IApplicationWindow *getWindow(void) const;
/**
* Get the icon associated with the application
*
* @return An instance if IBitmap that may be used to rend the
* application's icon. This is an new IBitmap instance that must
* be deleted by the caller when it is no long needed.
*/
NXWidgets::IBitmap *getIcon(void);
/**
* Get the name string associated with the application
*
* @return A copy if CNxString that contains the name of the application.
*/
NXWidgets::CNxString getName(void);
/**
* Start the application (perhaps in the minimized state).
*
* @return True if the application was successfully started.
*/
bool run(void);
/**
* Stop the application.
*/
void stop(void);
/**
* The application window is hidden (either it is minimized or it is
* maximized, but not at the top of the hierarchy
*/
void hide(void);
/**
* Redraw the entire window. The application has been maximized or
* otherwise moved to the top of the hierarchy. This method is called from
* CTaskbar when the application window must be displayed
*/
void redraw(void);
/**
* Wait for calibration data to be received.
*
* @return True if the calibration data was successfully obtained.
*/
bool waitCalibrationData(struct SCalibrationData &data);
};
}
#endif // __INCLUDE_CCALIBRATION_HXX

View File

@ -209,7 +209,7 @@ namespace NxWM
* used during automated testing of NxWM. * used during automated testing of NxWM.
*/ */
#ifdef CONFIG_NXWM_UNITTEST #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
inline void clickIcon(int index) inline void clickIcon(int index)
{ {
if (index < m_slots.size()) if (index < m_slots.size())

View File

@ -390,7 +390,7 @@ namespace NxWM
* used during automated testing of NxWM. * used during automated testing of NxWM.
*/ */
#ifdef CONFIG_NXWM_UNITTEST #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
inline void clickIcon(int index) inline void clickIcon(int index)
{ {
if (index < m_slots.size()) if (index < m_slots.size())

View File

@ -0,0 +1,106 @@
/****************************************************************************
* NxWidgets/nxwm/include/ctouchscreen.hxx
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
* me be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_CTOUCHSCREEN_HXX
#define __INCLUDE_CTOUCHSCREEN_HXX
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/nx/nxglib.h>
#include <semaphore.h>
#include <nuttx/input/touchscreen.h>
#include "cwidgeteventhandler.hxx"
#include "iapplication.hxx"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Implementation Classes
****************************************************************************/
namespace NxWM
{
/**
* The CTouchscreen class provides the the calibration window and obtains
* callibration data.
*/
class CTouchscreen : public IApplication, private NXWidgets::CWidgetEventHandler
{
private:
int m_touchFd; /**< File descriptor of the opened touchscreen device */
sem_t m_waitSem; /**< Semaphore the supports waits for touchscreen data */
public:
/**
* CTouchscreen Constructor
*/
CTouchscreen(void);
/**
* CTouchscreen Destructor
*/
~CTouchscreen(void);
/**
* Initialize the touchscreen device. Initialization is separate from
* object instantiation so that failures can be reported.
*
* @return True if the touchscreen device was correctly initialized
*/
bool open(void);
/**
* Capture raw driver data.
*
*
* @return True if the raw touchscreen data was sucessfully obtained
*/
bool waitRawTouchData(struct touch_sample_s &touch);
};
}
#endif // __INCLUDE_CTOUCHSCREEN_HXX

View File

@ -321,6 +321,29 @@
# define CONFIG_NXWM_NXCONSOLE_ICON NxWM::g_cmdBitmap # define CONFIG_NXWM_NXCONSOLE_ICON NxWM::g_cmdBitmap
#endif #endif
/* Touchscreen device *******************************************************/
#ifndef CONFIG_NXWM_TOUCHSCREEN_DEVPATH
# define CONFIG_NXWM_TOUCHSCREEN_DEVPATH "/dev/input0"
#endif
/* Calibration display ******************************************************/
#ifndef CONFIG_NXWM_CALIBRATION_BACKGROUNDCOLOR
# define CONFIG_NXWM_CALIBRATION_BACKGROUNDCOLOR CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR
#endif
#ifndef CONFIG_NXWM_CALIBRATION_LINECOLOR
# define CONFIG_NXWM_CALIBRATION_LINECOLOR MKRGB(0, 0, 128)
#endif
#ifndef CONFIG_NXWM_CALIBRATION_CIRCLECOLOR
# define CONFIG_NXWM_CALIBRATION_CIRCLECOLOR MKRGB(255, 255, 255)
#endif
#ifndef CONFIG_NXWM_CALIBRATION_ICON
# define CONFIG_NXWM_CALIBRATION_ICON NxWM::g_calibrationBitmap
#endif
/**************************************************************************** /****************************************************************************
* Global Function Prototypes * Global Function Prototypes
****************************************************************************/ ****************************************************************************/

View File

@ -57,6 +57,7 @@
namespace NxWM namespace NxWM
{ {
extern const struct NXWidgets::SRlePaletteBitmap g_calibrationBitmap;
extern const struct NXWidgets::SRlePaletteBitmap g_cmdBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_cmdBitmap;
extern const struct NXWidgets::SRlePaletteBitmap g_minimizeBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_minimizeBitmap;
extern const struct NXWidgets::SRlePaletteBitmap g_nshBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_nshBitmap;

543
nxwm/src/ccalibration.cxx Normal file
View File

@ -0,0 +1,543 @@
/****************************************************************************
* NxWidgets/nxwm/src/capplicationwindow.cxx
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
* me be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include "nxwmconfig.hxx"
#include "nxwmglyphs.hxx"
#include "ccalibration.hxx"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Configuration
*/
#ifndef CONFIG_NX
# error "NX is not enabled (CONFIG_NX)"
#endif
/**
* Positional/size data for the calibration lines and circles
*/
#define CALIBRATION_LEFTX 40
#define CALIBRATION_RIGHTX (windowSize.w - 41)
#define CALIBRATION_TOPY 40
#define CALIBRATION_BOTTOMY (windowSize.h - 41)
#define CALIBRATION_CIRCLE_RADIUS 16
#define CALIBRATION_LINE_THICKNESS 2
/****************************************************************************
* CCalibration Implementation Classes
****************************************************************************/
using namespace NxWM;
/**
* CCalibration Constructor
*
* @param window. The window to use for the calibration display
* @param touchscreen. An instance of the class that wraps the touchscreen device.
*/
CCalibration::CCalibration(CFullScreenWindow *window, CTouchscreen *touchscreen)
{
// Initialize state data
m_window = window;
m_touchscreen = touchscreen;
m_state = CALIB_NOT_STARTED;
m_stop = false;
m_touched = false;
}
/**
* CCalibration Destructor
*/
CCalibration::~CCalibration(void)
{
// Although we did not create the window, the rule is that I have to dispose
// of it
delete m_window;
}
/**
* Each implementation of IApplication must provide a method to recover
* the contained IApplicationWindow instance.
*/
IApplicationWindow *CCalibration::getWindow(void) const
{
return static_cast<IApplicationWindow*>(m_window);
}
/**
* Get the icon associated with the application
*
* @return An instance if IBitmap that may be used to rend the
* application's icon. This is an new IBitmap instance that must
* be deleted by the caller when it is no long needed.
*/
NXWidgets::IBitmap *CCalibration::getIcon(void)
{
NXWidgets::CRlePaletteBitmap *bitmap =
new NXWidgets::CRlePaletteBitmap(&CONFIG_NXWM_CALIBRATION_ICON);
return bitmap;
}
/**
* Get the name string associated with the application
*
* @return A copy if CNxString that contains the name of the application.
*/
NXWidgets::CNxString CCalibration::getName(void)
{
return NXWidgets::CNxString("Touchscreen Calibration");
}
/**
* Start the application (perhaps in the minimized state).
*
* @return True if the application was successfully started.
*/
bool CCalibration::run(void)
{
// Provide the initial display
m_state = CALIB_NOT_STARTED;
stateMachine();
// Loop until calibration completes
while (!m_stop)
{
// Wait for the next raw touchscreen input
struct touch_sample_s sample;
while (!m_touchscreen->waitRawTouchData(sample));
// Then process the raw touchscreen input
touchscreenInput(sample);
}
return !m_stop;
}
/**
* Stop the application.
*/
void CCalibration::stop(void)
{
m_stop = true;
}
/**
* The application window is hidden (either it is minimized or it is
* maximized, but it is not at the top of the hierarchy)
*/
void CCalibration::hide(void)
{
#warning "Revisit"
}
/**
* Redraw the entire window. The application has been maximized or
* otherwise moved to the top of the hierarchy. This method is called from
* CTaskbar when the application window must be displayed
*/
void CCalibration::redraw(void)
{
// Reset the state machine and start over
if (m_state != CALIB_COMPLETE)
{
m_state = CALIB_NOT_STARTED;
stateMachine();
}
}
/**
* Wait for calibration data to be received.
*
* @return True if the calibration data was successfully obtained.
*/
bool CCalibration::waitCalibrationData(struct SCalibrationData &data)
{
// Wait until calibration is finished
while (m_state != CALIB_COMPLETE)
{
int ret = sem_wait(&m_waitSem);
DEBUGASSERT(ret == 0 || errno == EINTR);
}
// Recover the window instance contained in the full screen window
NXWidgets::INxWindow *window = m_window->getWindow();
// Get the size of the fullscreen window
struct nxgl_size_s windowSize;
if (!window->getSize(&windowSize))
{
return false;
}
// Calculate the calibration parameters
//
// (scaledX - LEFTX) / (rawX - leftX) = (RIGHTX - LEFTX) / (rightX - leftX)
// scaledX = (rawX - leftX) * (RIGHTX - LEFTX) / (rightX - leftX) + LEFTX
// = rawX * xSlope + (LEFTX - leftX * xSlope)
// = rawX * xSlope + xOffset
//
// where:
// xSlope = (RIGHTX - LEFTX) / (rightX - leftX)
// xOffset = (LEFTX - leftX * xSlope)
b16_t leftX = (m_calibData[CALIB_UPPER_LEFT_INDEX].x +
m_calibData[CALIB_LOWER_LEFT_INDEX].x) << 15;
b16_t rightX = (m_calibData[CALIB_UPPER_RIGHT_INDEX].x +
m_calibData[CALIB_LOWER_RIGHT_INDEX].x) << 15;
data.xSlope = b16divb16(itob16(CALIBRATION_RIGHTX - CALIBRATION_LEFTX), (rightX - leftX));
data.xOffset = itob16(CALIBRATION_LEFTX) - b16mulb16(leftX, data.xSlope);
gdbg("New xSlope: %08x xOffset: %08x\n", data.xSlope, data.xOffset);
// Similarly for Y
//
// (scaledY - TOPY) / (rawY - topY) = (BOTTOMY - TOPY) / (bottomY - topY)
// scaledY = (rawY - topY) * (BOTTOMY - TOPY) / (bottomY - topY) + TOPY
// = rawY * ySlope + (TOPY - topY * ySlope)
// = rawY * ySlope + yOffset
//
// where:
// ySlope = (BOTTOMY - TOPY) / (bottomY - topY)
// yOffset = (TOPY - topY * ySlope)
b16_t topY = (m_calibData[CALIB_UPPER_LEFT_INDEX].y +
m_calibData[CALIB_UPPER_RIGHT_INDEX].y) << 15;
b16_t bottomY = (m_calibData[CALIB_LOWER_LEFT_INDEX].y +
m_calibData[CALIB_LOWER_RIGHT_INDEX].y) << 15;
data.ySlope = b16divb16(itob16(CALIBRATION_BOTTOMY - CALIBRATION_TOPY), (bottomY - topY));
data.yOffset = itob16(CALIBRATION_TOPY) - b16mulb16(topY, data.ySlope);
gdbg("New ySlope: %08x yOffset: %08x\n", data.ySlope, data.yOffset);
return true;
}
/**
* Accept raw touchscreen input.
*
* @param sample Touchscreen input sample
*/
void CCalibration::touchscreenInput(struct touch_sample_s &sample)
{
// Is this a new touch event? Or is it a drag event?
if ((sample.point[0].flags & (TOUCH_DOWN|TOUCH_MOVE)) != 0)
{
// Yes.. but ignore drag events if we did not see the matching
// touch down event
if ((sample.point[0].flags & TOUCH_DOWN) != 0 || m_touched)
{
// Yes.. save the touch position and wait for the TOUCH_UP report
m_touchPos.x = sample.point[0].x;
m_touchPos.y = sample.point[0].y;
gvdbg("Touch id: %d flags: %02x x: %d y: %d h: %d w: %d pressure: %d\n",
sample.point[0].id, sample.point[0].flags, sample.point[0].x,
sample.point[0].y, sample.point[0].h, sample.point[0].w,
sample.point[0].pressure);
// Remember that we saw the touch down event
m_touched = true;
}
}
// Was the touch released?
else if ((sample.point[0].flags & TOUCH_UP) != 0)
{
// Yes.. did we see the matching pen down event?
if (m_touched)
{
// Yes.. invoke the state machine.
gvdbg("State: %d Screen x: %d y: %d Touch x: %d y: %d\n",
m_state, m_screenInfo.pos.x, m_screenInfo.pos.y,
m_touchPos.x, m_touchPos.y);
stateMachine();
}
// In any event, the touch is not down
m_touched = false;
}
}
/**
* This is the calibration state machine. It is called initially and then
* as new touchscreen data is received.
*/
void CCalibration::stateMachine(void)
{
// Recover the window instance contained in the full screen window
NXWidgets::INxWindow *window = m_window->getWindow();
// Get the size of the fullscreen window
struct nxgl_size_s windowSize;
if (!window->getSize(&windowSize))
{
return;
}
switch (m_state)
{
default:
case CALIB_NOT_STARTED:
{
// Clear the entire screen
// Get the widget control associated with the full screen window
NXWidgets::CWidgetControl *control = window->getWidgetControl();
// Get the CCGraphicsPort instance for this window
NXWidgets::CGraphicsPort *port = control->getGraphicsPort();
// Fill the entire window with the background color
port->drawFilledRect(0, 0, windowSize.w, windowSize.h,
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR);
// Then draw the first calibration screen
m_screenInfo.pos.x = CALIBRATION_LEFTX;
m_screenInfo.pos.y = CALIBRATION_TOPY;
m_screenInfo.lineColor = CONFIG_NXWM_CALIBRATION_LINECOLOR;
m_screenInfo.circleFillColor = CONFIG_NXWM_CALIBRATION_CIRCLECOLOR;
showCalibration();
// Then set up the current state
m_state = CALIB_UPPER_LEFT;
}
break;
case CALIB_UPPER_LEFT:
{
// A touch has been received while in the CALIB_UPPER_LEFT state.
// Save the touch data and set up the next calibration display
m_calibData[CALIB_UPPER_LEFT_INDEX].x = m_touchPos.x;
m_calibData[CALIB_UPPER_LEFT_INDEX].y = m_touchPos.y;
// Clear the previous screen by re-drawing it using the backgro9und
// color. That is much faster than clearing the whole display
m_screenInfo.lineColor = CONFIG_NXWM_CALIBRATION_BACKGROUNDCOLOR;
m_screenInfo.circleFillColor = CONFIG_NXWM_CALIBRATION_BACKGROUNDCOLOR;
showCalibration();
// Then draw the next calibration screen
m_screenInfo.pos.x = CALIBRATION_RIGHTX;
m_screenInfo.pos.y = CALIBRATION_TOPY;
m_screenInfo.lineColor = CONFIG_NXWM_CALIBRATION_LINECOLOR;
m_screenInfo.circleFillColor = CONFIG_NXWM_CALIBRATION_CIRCLECOLOR;
showCalibration();
// Then set up the current state
m_state = CALIB_UPPER_RIGHT;
}
break;
case CALIB_UPPER_RIGHT:
{
// A touch has been received while in the CALIB_UPPER_RIGHT state.
// Save the touch data and set up the next calibration display
m_calibData[CALIB_UPPER_RIGHT_INDEX].x = m_touchPos.x;
m_calibData[CALIB_UPPER_RIGHT_INDEX].y = m_touchPos.y;
// Clear the previous screen by re-drawing it using the backgro9und
// color. That is much faster than clearing the whole display
m_screenInfo.lineColor = CONFIG_NXWM_CALIBRATION_BACKGROUNDCOLOR;
m_screenInfo.circleFillColor = CONFIG_NXWM_CALIBRATION_BACKGROUNDCOLOR;
showCalibration();
// Then draw the next calibration screen
m_screenInfo.pos.x = CALIBRATION_RIGHTX;
m_screenInfo.pos.y = CALIBRATION_BOTTOMY;
m_screenInfo.lineColor = CONFIG_NXWM_CALIBRATION_LINECOLOR;
m_screenInfo.circleFillColor = CONFIG_NXWM_CALIBRATION_CIRCLECOLOR;
showCalibration();
// Then set up the current state
m_state = CALIB_LOWER_RIGHT;
}
break;
case CALIB_LOWER_RIGHT:
{
// A touch has been received while in the CALIB_LOWER_RIGHT state.
// Save the touch data and set up the next calibration display
m_calibData[CALIB_LOWER_RIGHT_INDEX].x = m_touchPos.x;
m_calibData[CALIB_LOWER_RIGHT_INDEX].y = m_touchPos.y;
// Clear the previous screen by re-drawing it using the backgro9und
// color. That is much faster than clearing the whole display
m_screenInfo.lineColor = CONFIG_NXWM_CALIBRATION_BACKGROUNDCOLOR;
m_screenInfo.circleFillColor = CONFIG_NXWM_CALIBRATION_BACKGROUNDCOLOR;
showCalibration();
// Then draw the next calibration screen
m_screenInfo.pos.x = CALIBRATION_LEFTX;
m_screenInfo.pos.y = CALIBRATION_BOTTOMY;
m_screenInfo.lineColor = CONFIG_NXWM_CALIBRATION_LINECOLOR;
m_screenInfo.circleFillColor = CONFIG_NXWM_CALIBRATION_CIRCLECOLOR;
showCalibration();
// Then set up the current state
m_state = CALIB_LOWER_LEFT;
}
break;
case CALIB_LOWER_LEFT:
{
// A touch has been received while in the CALIB_LOWER_LEFT state.
// Save the touch data and set up the next calibration display
m_calibData[CALIB_LOWER_LEFT_INDEX].x = m_touchPos.x;
m_calibData[CALIB_LOWER_LEFT_INDEX].y = m_touchPos.y;
// Inform any waiter that calibration is complete
m_state = CALIB_COMPLETE;
sem_post(&m_waitSem);
}
break;
case CALIB_COMPLETE:
// Might happen... do nothing if it does
break;
}
gvdbg("State: %d Screen x: %d y: %d\n",
m_state, m_screenInfo.pos.x, m_screenInfo.pos.y);
}
/**
* Presents the next calibration screen
*
* @param screenInfo Describes the next calibration screen
*/
void CCalibration::showCalibration(void)
{
// Recover the window instance contained in the full screen window
NXWidgets::INxWindow *window = m_window->getWindow();
// Get the widget control associated with the full screen window
NXWidgets::CWidgetControl *control = window->getWidgetControl();
// Get the CCGraphicsPort instance for this window
NXWidgets::CGraphicsPort *port = control->getGraphicsPort();
// Get the size of the fullscreen window
struct nxgl_size_s windowSize;
if (!window->getSize(&windowSize))
{
return;
}
// Draw the circle at the center of the touch position
port->drawFilledCircle(&m_screenInfo.pos, CALIBRATION_CIRCLE_RADIUS,
m_screenInfo.circleFillColor);
/* Draw horizontal line */
port->drawFilledRect(0, m_screenInfo.pos.y, windowSize.w, CALIBRATION_LINE_THICKNESS,
m_screenInfo.lineColor);
/* Draw vertical line */
port->drawFilledRect(m_screenInfo.pos.x, 0, CALIBRATION_LINE_THICKNESS, windowSize.h,
m_screenInfo.lineColor);
}

View File

@ -1,5 +1,5 @@
/******************************************************************************************** /********************************************************************************************
* NxWidgets/nxwm/src/cfullscreen.cxx * NxWidgets/nxwm/src/cfullscreenwindow.cxx
* *
* Copyright (C) 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>

125
nxwm/src/ctouchscreen.cxx Normal file
View File

@ -0,0 +1,125 @@
/********************************************************************************************
* NxWidgets/nxwm/src/ctouchscreen.cxx
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
* me be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
********************************************************************************************/
/********************************************************************************************
* Included Files
********************************************************************************************/
#include <nuttx/config.h>
#include <cunistd>
#include <cerrno>
#include <cfcntl>
#include <debug.h>
#include <nuttx/nx/nxglib.h>
#include "nxconfig.hxx"
#include "cwidgetcontrol.hxx"
#include "cgraphicsport.hxx"
#include "nxwmconfig.hxx"
#include "nxwmglyphs.hxx"
#include "ctouchscreen.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
/********************************************************************************************
* CTouchscreen Method Implementations
********************************************************************************************/
using namespace NxWM;
/**
* CTouchscreen Constructor
*/
CTouchscreen::CTouchscreen(void)
{
m_touchFd = -1;
sem_init(&m_waitSem, 0, 0);
}
/**
* CTouchscreen Destructor
*/
CTouchscreen::~CTouchscreen(void)
{
if (m_touchFd >= 0)
{
std::close(m_touchFd);
}
sem_destroy(&m_waitSem);
}
/**
* Initialize the touchscreen device. Initialization is separate from
* object instantiation so that failures can be reported.
*
* @return True if the touchscreen device was correctly initialized
*/
bool CTouchscreen::open(void)
{
// Open the touchscreen device
m_touchFd = std::open(CONFIG_NXWM_TOUCHSCREEN_DEVPATH, O_RDONLY);
if (m_touchFd < 0)
{
gdbg("ERROR Failed to open %s for reading: %d\n",
CONFIG_NXWM_TOUCHSCREEN_DEVPATH, errno);
return false;
}
return true;
}
/**
* Capture raw driver data.
*
*
* @return True if the raw touchscreen data was sucessfully obtained
*/
bool CTouchscreen::waitRawTouchData(struct touch_sample_s &touch)
{
#warning "Missing logic"
return true;
}

View File

@ -0,0 +1,193 @@
/********************************************************************************************
* NxWidgets/nxwm/src/glyph_calibration.cxx
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
* me be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
********************************************************************************************/
/********************************************************************************************
* Included Files
********************************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <nuttx/nx/nxglib.h>
#include <nuttx/fb.h>
#include <nuttx/rgbcolors.h>
#include "crlepalettebitmap.hxx"
#include "nxwmconfig.hxx"
#include "nxwmglyphs.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
#define BITMAP_NROWS 21
#define BITMAP_NCOLUMNS 21
#define BITMAP_NLUTCODES 17
/********************************************************************************************
* Private Bitmap Data
********************************************************************************************/
using namespace NxWM;
/* RGB24 (8-8-8) Colors */
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
static const uint32_t g_calibrationLut[BITMAP_NLUTCODES] =
{
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
0x202020, 0x404040, 0x808080, 0xfcfcfc, 0x606060, 0x9c9c9c, 0xdcdcdc, /* Codes 1-7 */
0xececec, 0xacacac, 0x707070, 0x303030, 0x101010, 0xcccccc, 0x505050, /* Codes 8-15 */
0x8c8c8c, 0xbcbcbc, /* Codes 15-16 */
};
/* RGB16 (565) Colors (four of the colors in this map are duplicates) */
#elif CONFIG_NXWIDGETS_BPP == 16
static const uint16_t g_calibrationLut[BITMAP_NLUTCODES] =
{
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
0x2104, 0x4208, 0x8410, 0xffff, 0x630c, 0x9cf3, 0xdefb, 0xef7d, 0xad75, /* Codes 1-9 */
0x738e, 0x3186, 0x1082, 0xce79, 0x528a, 0x8c71, 0xbdf7 /* Codes 10-16 */
};
/* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
* to lookup an 8-bit value. There is no savings in that! It would be better to just put
* the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
* pointless lookups. But these p;ointless lookups do make the logic compatible with the
* 16- and 24-bit types.
*/
#elif CONFIG_NXWIDGETS_BPP == 8
# ifdef CONFIG_NXWIDGETS_GREYSCALE
/* 8-bit Greyscale */
static const uint8_t g_calibrationLut[BITMAP_NLUTCODES] =
{
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
0x20, 0x40, 0x80, 0xfc, 0x60, 0x9c, 0xdc, 0xec, 0xac, 0x70, 0x30, 0x10, /* Codes 1-12 */
0xcc, 0x50, 0x8c, 0xbc, /* Codes 13-16 */
};
# else /* CONFIG_NXWIDGETS_GREYSCALE */
/* RGB8 (332) Colors */
static const nxgl_mxpixel_t g_calibrationLut[BITMAP_NLUTCODES] =
{
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
0x24, 0x49, 0x92, 0xff, 0x6d, 0x92, 0xdb, 0xff, 0xb6, 0x6d, 0x24, 0x00, /* Codes 1-12 */
0xdb, 0x49, 0x92, 0xb7 /* Codes 13-16 */
};
# endif
#else
# error "Unsupport pixel format"
#endif
static const struct NXWidgets::SRlePaletteBitmapEntry g_calibrationRleEntries[] =
{
{ 25, 0}, /* Row 0 */
{ 25, 0}, /* Row 1 */
{ 12, 0}, { 1, 1}, { 1, 2}, { 11, 0}, /* Row 2 */
{ 12, 0}, { 1, 3}, { 1, 4}, { 6, 0}, { 1, 1}, { 2, 5}, { 2, 0}, /* Row 3 */
{ 12, 0}, { 1, 3}, { 1, 4}, { 2, 0}, { 1, 1}, { 1, 5}, { 1, 6}, { 1, 7}, /* Row 4 */
{ 2, 4}, { 1, 7}, { 2, 0},
{ 12, 0}, { 1, 3}, { 1, 4}, { 1, 6}, { 1, 7}, { 2, 4}, { 1, 8}, { 1, 9}, /* Row 5 */
{ 1, 7}, { 1, 9}, { 3, 0},
{ 8, 0}, { 1, 1}, { 1, 5}, { 1, 6}, { 1, 7}, { 2, 4}, { 1, 8}, { 1, 9}, /* Row 6 */
{ 1, 10}, { 1, 11}, { 1, 0}, { 1, 12}, { 2, 13}, { 3, 0},
{ 4, 0}, { 1, 12}, { 1, 14}, { 1, 15}, { 1, 7}, { 2, 4}, { 1, 8}, { 1, 9}, /* Row 7 */
{ 1, 16}, { 1, 4}, { 5, 0}, { 1, 10}, { 1, 5}, { 1, 3}, { 1, 5}, { 2, 0},
{ 3, 0}, { 1, 1}, { 2, 4}, { 1, 8}, { 1, 9}, { 1, 10}, { 1, 11}, { 2, 0}, /* Row 8 */
{ 1, 3}, { 1, 4}, { 5, 0}, { 1, 13}, { 1, 0}, { 1, 1}, { 1, 9}, { 2, 0},
{ 4, 0}, { 1, 15}, { 1, 4}, { 1, 5}, { 5, 0}, { 1, 3}, { 1, 4}, { 4, 0}, /* Row 9 */
{ 1, 14}, { 1, 15}, { 2, 0}, { 1, 16}, { 1, 1}, { 1, 0},
{ 4, 0}, { 1, 5}, { 1, 10}, { 1, 13}, { 5, 0}, { 1, 3}, { 1, 4}, { 4, 0}, /* Row 10 */
{ 1, 9}, { 1, 1}, { 2, 0}, { 1, 5}, { 1, 10}, { 1, 0},
{ 4, 0}, { 1, 13}, { 1, 12}, { 1, 6}, { 1, 1}, { 4, 0}, { 1, 3}, { 1, 4}, /* Row 11 */
{ 3, 0}, { 1, 1}, { 1, 16}, { 1, 0}, { 1, 6}, { 1, 14}, { 1, 12}, { 1, 13},
{ 1, 0},
{ 3, 0}, { 1, 2}, { 1, 6}, { 1, 0}, { 1, 14}, { 1, 15}, { 4, 0}, { 1, 3}, /* Row 12 */
{ 1, 4}, { 3, 0}, { 1, 3}, { 1, 5}, { 1, 1}, { 1, 8}, { 1, 6}, { 1, 0},
{ 1, 6}, { 1, 11},
{ 3, 0}, { 1, 6}, { 1, 11}, { 2, 0}, { 1, 16}, { 4, 0}, { 1, 3}, { 1, 4}, /* Row 13 */
{ 3, 0}, { 1, 16}, { 1, 0}, { 1, 2}, { 1, 4}, { 1, 16}, { 1, 0}, { 1, 2},
{ 1, 6},
{ 2, 0}, { 1, 12}, { 1, 13}, { 1, 12}, { 1, 16}, { 1, 1}, { 1, 15}, { 1, 14}, /* Row 14 */
{ 3, 0}, { 1, 3}, { 1, 4}, { 2, 0}, { 1, 10}, { 1, 13}, { 1, 3}, { 1, 6},
{ 1, 4}, { 1, 7}, { 2, 3}, { 1, 8},
{ 2, 0}, { 1, 10}, { 1, 5}, { 1, 9}, { 1, 4}, { 1, 16}, { 1, 2}, { 1, 6}, /* Row 15 */
{ 3, 0}, { 1, 3}, { 1, 4}, { 2, 0}, { 1, 11}, { 1, 16}, { 5, 4}, { 1, 8},
{ 1, 15},
{ 2, 0}, { 1, 13}, { 1, 0}, { 3, 4}, { 1, 2}, { 1, 13}, { 1, 12}, { 2, 0}, /* Row 16 */
{ 1, 3}, { 1, 4}, { 4, 0}, { 1, 12}, { 3, 2}, { 1, 11}, { 2, 0},
{ 1, 0}, { 1, 14}, { 1, 15}, { 1, 0}, { 3, 4}, { 1, 2}, { 2, 5}, { 2, 0}, /* Row 17 */
{ 1, 3}, { 1, 4}, { 11, 0},
{ 1, 0}, { 1, 16}, { 1, 13}, { 1, 16}, { 3, 4}, { 2, 13}, { 1, 7}, { 2, 0}, /* Row 18 */
{ 1, 3}, { 1, 4}, { 11, 0},
{ 1, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 3, 4}, { 1, 7}, { 1, 6}, { 1, 11}, /* Row 19 */
{ 2, 0}, { 1, 3}, { 1, 4}, { 11, 0},
{ 12, 0}, { 1, 3}, { 1, 4}, { 11, 0}, /* Row 20 */
{ 5, 0}, { 1, 2}, { 14, 4}, { 1, 3}, { 4, 0}, /* Row 21 */
{ 5, 0}, { 1, 2}, { 14, 4}, { 1, 3}, { 4, 0}, /* Row 22 */
{ 25, 0}, /* Row 23 */
{ 25, 0}, /* Row 24 */
};
/********************************************************************************************
* Public Bitmap Structure Defintions
********************************************************************************************/
const struct NXWidgets::SRlePaletteBitmap NxWM::g_calibrationBitmap =
{
CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
CONFIG_NXWIDGETS_FMT, // fmt - Color format
BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT)
BITMAP_NCOLUMNS, // width - Width in pixels
BITMAP_NROWS, // height - Height in rows
{ // lut - Pointer to the beginning of the Look-Up Table (LUT)
g_calibrationLut, // Index 0: Unselected LUT
g_calibrationLut, // Index 1: Selected LUT
},
g_calibrationRleEntries // data - Pointer to the beginning of the RLE data
};