Reinsertion of doxygen headers
Reinsertion of doxygen headers that got lost in license change
This commit is contained in:
parent
bbfeec2dd7
commit
3374aa25c6
31 changed files with 1276 additions and 900 deletions
|
@ -5,6 +5,15 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file drivers/gadc/AT91SAM7/gadc_lld.c
|
||||||
|
* @brief GADC - Periodic ADC driver source file for the AT91SAM7 cpu.
|
||||||
|
*
|
||||||
|
* @defgroup Driver Driver
|
||||||
|
* @ingroup GADC
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include "gfx.h"
|
#include "gfx.h"
|
||||||
|
|
|
@ -4,6 +4,15 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file drivers/gaudin/gadc/gaudin_lld.c
|
||||||
|
* @brief GAUDIN - Driver file for using the cpu ADC (via GADC).
|
||||||
|
*
|
||||||
|
* @addtogroup GAUDIN
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,29 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LLD_GINPUT_MOUSE_CONFIG_H
|
/**
|
||||||
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
* @file drivers/ginput/touch/ADS7843/ginput_lld_mouse_config.h
|
||||||
|
* @brief GINPUT LLD header file for mouse/touch driver.
|
||||||
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
*
|
||||||
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
|
* @defgroup Mouse Mouse
|
||||||
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
* @ingroup GINPUT
|
||||||
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 5
|
*
|
||||||
#define GINPUT_MOUSE_READ_CYCLES 4
|
* @{
|
||||||
#define GINPUT_MOUSE_POLL_PERIOD 25
|
*/
|
||||||
#define GINPUT_MOUSE_MAX_CLICK_JITTER 10
|
|
||||||
#define GINPUT_MOUSE_MAX_MOVE_JITTER 2
|
#ifndef _LLD_GINPUT_MOUSE_CONFIG_H
|
||||||
#define GINPUT_MOUSE_CLICK_TIME 500
|
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
||||||
|
|
||||||
#endif /* _LLD_GINPUT_MOUSE_CONFIG_H */
|
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
||||||
/** @} */
|
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
|
||||||
|
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
||||||
|
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 5
|
||||||
|
#define GINPUT_MOUSE_READ_CYCLES 4
|
||||||
|
#define GINPUT_MOUSE_POLL_PERIOD 25
|
||||||
|
#define GINPUT_MOUSE_MAX_CLICK_JITTER 10
|
||||||
|
#define GINPUT_MOUSE_MAX_MOVE_JITTER 2
|
||||||
|
#define GINPUT_MOUSE_CLICK_TIME 500
|
||||||
|
|
||||||
|
#endif /* _LLD_GINPUT_MOUSE_CONFIG_H */
|
||||||
|
/** @} */
|
||||||
|
|
|
@ -4,19 +4,29 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LLD_GINPUT_MOUSE_CONFIG_H
|
/**
|
||||||
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
* @file drivers/ginput/touch/MCU/ginput_lld_mouse_config.h
|
||||||
|
* @brief GINPUT LLD header file for touch driver.
|
||||||
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
*
|
||||||
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
|
* @defgroup Mouse Mouse
|
||||||
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
* @ingroup GINPUT
|
||||||
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 12
|
*
|
||||||
#define GINPUT_MOUSE_READ_CYCLES 4
|
* @{
|
||||||
#define GINPUT_MOUSE_POLL_PERIOD 25
|
*/
|
||||||
#define GINPUT_MOUSE_MAX_CLICK_JITTER 2
|
|
||||||
#define GINPUT_MOUSE_MAX_MOVE_JITTER 2
|
#ifndef _LLD_GINPUT_MOUSE_CONFIG_H
|
||||||
#define GINPUT_MOUSE_CLICK_TIME 500
|
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
||||||
|
|
||||||
#endif /* _LLD_GINPUT_MOUSE_CONFIG_H */
|
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
||||||
/** @} */
|
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
|
||||||
|
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
||||||
|
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 12
|
||||||
|
#define GINPUT_MOUSE_READ_CYCLES 4
|
||||||
|
#define GINPUT_MOUSE_POLL_PERIOD 25
|
||||||
|
#define GINPUT_MOUSE_MAX_CLICK_JITTER 2
|
||||||
|
#define GINPUT_MOUSE_MAX_MOVE_JITTER 2
|
||||||
|
#define GINPUT_MOUSE_CLICK_TIME 500
|
||||||
|
|
||||||
|
#endif /* _LLD_GINPUT_MOUSE_CONFIG_H */
|
||||||
|
/** @} */
|
||||||
|
|
|
@ -4,23 +4,33 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LLD_GINPUT_MOUSE_CONFIG_H
|
/**
|
||||||
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
* @file drivers/ginput/touch/STMPE811/ginput_lld_mouse_config.h
|
||||||
|
* @brief GINPUT LLD header file for mouse/touch driver.
|
||||||
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
*
|
||||||
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
|
* @defgroup Mouse Mouse
|
||||||
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
* @ingroup GINPUT
|
||||||
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 5
|
*
|
||||||
#define GINPUT_MOUSE_READ_CYCLES 1
|
* @{
|
||||||
#define GINPUT_MOUSE_POLL_PERIOD 25
|
*/
|
||||||
#define GINPUT_MOUSE_MAX_CLICK_JITTER 10
|
|
||||||
#define GINPUT_MOUSE_MAX_MOVE_JITTER 5
|
#ifndef _LLD_GINPUT_MOUSE_CONFIG_H
|
||||||
#define GINPUT_MOUSE_CLICK_TIME 450
|
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
||||||
|
|
||||||
/* default values - over write these in your boad files */
|
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
||||||
#define STMP811_SLOWER_RESPONSE FALSE
|
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
|
||||||
#define STMP811_NO_GPIO_IRQPIN FALSE
|
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
||||||
|
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 5
|
||||||
#endif /* _LLD_GINPUT_MOUSE_CONFIG_H */
|
#define GINPUT_MOUSE_READ_CYCLES 1
|
||||||
/** @} */
|
#define GINPUT_MOUSE_POLL_PERIOD 25
|
||||||
|
#define GINPUT_MOUSE_MAX_CLICK_JITTER 10
|
||||||
|
#define GINPUT_MOUSE_MAX_MOVE_JITTER 5
|
||||||
|
#define GINPUT_MOUSE_CLICK_TIME 450
|
||||||
|
|
||||||
|
/* default values - over write these in your boad files */
|
||||||
|
#define STMP811_SLOWER_RESPONSE FALSE
|
||||||
|
#define STMP811_NO_GPIO_IRQPIN FALSE
|
||||||
|
|
||||||
|
#endif /* _LLD_GINPUT_MOUSE_CONFIG_H */
|
||||||
|
/** @} */
|
||||||
|
|
|
@ -4,37 +4,47 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LLD_GINPUT_MOUSE_CONFIG_H
|
/**
|
||||||
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
* @file drivers/multiple/Win32/ginput_lld_mouse_config.h
|
||||||
|
* @brief GINPUT LLD header file for mouse/touch driver.
|
||||||
// This driver supports being both a mouse or a touch device (we don't actually know which it really is)
|
*
|
||||||
// When operating in mouse mode a long left button click does not generate a context click.
|
* @defgroup Mouse Mouse
|
||||||
// When operating in touch mode we allow sloppier clicks etc
|
* @ingroup GINPUT
|
||||||
#if 1
|
*
|
||||||
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_MOUSE
|
* @{
|
||||||
#define GINPUT_MOUSE_CLICK_TIME TIME_INFINITE // Long click != Context Click
|
*/
|
||||||
#define GINPUT_MOUSE_NEED_CALIBRATION FALSE
|
|
||||||
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
#ifndef _LLD_GINPUT_MOUSE_CONFIG_H
|
||||||
#define GINPUT_MOUSE_READ_CYCLES 1
|
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
||||||
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR -1
|
|
||||||
#define GINPUT_MOUSE_MAX_CLICK_JITTER 0
|
// This driver supports being both a mouse or a touch device (we don't actually know which it really is)
|
||||||
#define GINPUT_MOUSE_MAX_MOVE_JITTER 0
|
// When operating in mouse mode a long left button click does not generate a context click.
|
||||||
#else
|
// When operating in touch mode we allow sloppier clicks etc
|
||||||
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
#if 1
|
||||||
#define GINPUT_MOUSE_CLICK_TIME 700 // Long click = Context Click
|
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_MOUSE
|
||||||
#define GINPUT_MOUSE_NEED_CALIBRATION FALSE // Can be set to TRUE just for testing
|
#define GINPUT_MOUSE_CLICK_TIME TIME_INFINITE // Long click != Context Click
|
||||||
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
#define GINPUT_MOUSE_NEED_CALIBRATION FALSE
|
||||||
#define GINPUT_MOUSE_READ_CYCLES 1
|
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
||||||
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 2
|
#define GINPUT_MOUSE_READ_CYCLES 1
|
||||||
#define GINPUT_MOUSE_MAX_CLICK_JITTER 2
|
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR -1
|
||||||
#define GINPUT_MOUSE_MAX_MOVE_JITTER 2
|
#define GINPUT_MOUSE_MAX_CLICK_JITTER 0
|
||||||
#endif
|
#define GINPUT_MOUSE_MAX_MOVE_JITTER 0
|
||||||
|
#else
|
||||||
// This driver supports both an "interrupt" mode, and a polled mode
|
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
||||||
#define GINPUT_MOUSE_POLL_PERIOD TIME_INFINITE // Interrupt driven by the Window thread
|
#define GINPUT_MOUSE_CLICK_TIME 700 // Long click = Context Click
|
||||||
//#define GINPUT_MOUSE_POLL_PERIOD 25 // Poll driven
|
#define GINPUT_MOUSE_NEED_CALIBRATION FALSE // Can be set to TRUE just for testing
|
||||||
|
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
||||||
#endif /* _LLD_GINPUT_MOUSE_CONFIG_H */
|
#define GINPUT_MOUSE_READ_CYCLES 1
|
||||||
/** @} */
|
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 2
|
||||||
|
#define GINPUT_MOUSE_MAX_CLICK_JITTER 2
|
||||||
|
#define GINPUT_MOUSE_MAX_MOVE_JITTER 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// This driver supports both an "interrupt" mode, and a polled mode
|
||||||
|
#define GINPUT_MOUSE_POLL_PERIOD TIME_INFINITE // Interrupt driven by the Window thread
|
||||||
|
//#define GINPUT_MOUSE_POLL_PERIOD 25 // Poll driven
|
||||||
|
|
||||||
|
#endif /* _LLD_GINPUT_MOUSE_CONFIG_H */
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,35 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/gadc/gadc.h
|
||||||
|
* @brief GADC - Periodic ADC subsystem header file.
|
||||||
|
*
|
||||||
|
* @addtogroup GADC
|
||||||
|
*
|
||||||
|
* @details The reason why ChibiOS/GFX has it's own ADC abstraction is because
|
||||||
|
* the Chibi-OS drivers are very CPU specific and do not
|
||||||
|
* provide a way across all hardware platforms to create periodic
|
||||||
|
* ADC conversions. There are also issues with devices with different
|
||||||
|
* characteristics or periodic requirements on the same ADC
|
||||||
|
* device (but different channels). This layer attempts to solve these
|
||||||
|
* problems to provide a architecture neutral API. It also provides extra
|
||||||
|
* features such as multi-buffer chaining for high speed ADC sources.
|
||||||
|
* It provides one high speed virtual ADC device (eg a microphone) and
|
||||||
|
* numerous low speed (less than 100Hz) virtual ADC devices (eg dials,
|
||||||
|
* temperature sensors etc). The high speed device has timer based polling
|
||||||
|
* to ensure exact conversion periods and a buffer management system.
|
||||||
|
* The low speed devices are assumed to be non-critical timing devices
|
||||||
|
* and do not have any buffer management.
|
||||||
|
* Note that while only one high speed device has been provided it can
|
||||||
|
* be used to read multiple physical ADC channels on the one physical
|
||||||
|
* ADC device.
|
||||||
|
* All callback routines are thread based unlike the Chibi-OS interrupt based
|
||||||
|
* routines.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _GADC_H
|
#ifndef _GADC_H
|
||||||
#define _GADC_H
|
#define _GADC_H
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,15 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/gadc/lld/gadc_lld.h
|
||||||
|
* @brief GADC - Periodic ADC driver header file.
|
||||||
|
*
|
||||||
|
* @defgroup Driver Driver
|
||||||
|
* @ingroup GADC
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _GADC_LLD_H
|
#ifndef _GADC_LLD_H
|
||||||
#define _GADC_LLD_H
|
#define _GADC_LLD_H
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,15 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/gaudin/gaudin.h
|
||||||
|
* @brief GAUDIN - Audio Input subsystem header file.
|
||||||
|
*
|
||||||
|
* @addtogroup GAUDIN
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _GAUDIN_H
|
#ifndef _GAUDIN_H
|
||||||
#define _GAUDIN_H
|
#define _GAUDIN_H
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,15 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/gaudin/lld/gaudin_lld.h
|
||||||
|
* @brief GAUDIN - Audio Input driver header file.
|
||||||
|
*
|
||||||
|
* @defgroup Driver Driver
|
||||||
|
* @ingroup GAUDIN
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _GAUDIN_LLD_H
|
#ifndef _GAUDIN_LLD_H
|
||||||
#define _GAUDIN_LLD_H
|
#define _GAUDIN_LLD_H
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,15 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/gaudout/gaudout.h
|
||||||
|
* @brief GAUDOUT - Audio Output subsystem header file.
|
||||||
|
*
|
||||||
|
* @addtogroup GAUDOUT
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _GAUDOUT_H
|
#ifndef _GAUDOUT_H
|
||||||
#define _GAUDOUT_H
|
#define _GAUDOUT_H
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,20 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/gevent/gevent.h
|
||||||
|
* @brief GEVENT GFX User Event subsystem header file.
|
||||||
|
*
|
||||||
|
* @addtogroup GEVENT
|
||||||
|
*
|
||||||
|
* @details GEVENT provides a simple to use but yet powerful event
|
||||||
|
* system.
|
||||||
|
*
|
||||||
|
* @pre GFX_USE_GEVENT must be set to TRUE in your gfxconf.h
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
#ifndef _GEVENT_H
|
#ifndef _GEVENT_H
|
||||||
#define _GEVENT_H
|
#define _GEVENT_H
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,22 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/ginput/dial.h
|
||||||
|
* @brief GINPUT GFX User Input subsystem header file.
|
||||||
|
*
|
||||||
|
* @defgroup Dial Dial
|
||||||
|
* @ingroup GINPUT
|
||||||
|
*
|
||||||
|
* @details A dial provides a powerful way to navigate through menus
|
||||||
|
* on a display.
|
||||||
|
*
|
||||||
|
* @pre GFX_USE_GINPUT must be set to TRUE in your gfxconf.h
|
||||||
|
* @pre GINPUT_NEED_DIAL must be set to TRUE in your gfxconf.h
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
#ifndef _GINPUT_DIAL_H
|
#ifndef _GINPUT_DIAL_H
|
||||||
#define _GINPUT_DIAL_H
|
#define _GINPUT_DIAL_H
|
||||||
|
|
||||||
|
|
|
@ -4,32 +4,46 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
#ifndef _GINPUT_H
|
|
||||||
#define _GINPUT_H
|
/**
|
||||||
|
* @file include/ginput/ginput.h
|
||||||
#include "gfx.h"
|
* @brief GINPUT GFX User Input subsystem header file.
|
||||||
|
*
|
||||||
#if GFX_USE_GINPUT || defined(__DOXYGEN__)
|
* @addtogroup GINPUT
|
||||||
|
*
|
||||||
/* How to use...
|
* @details GINPUT provides an easy and common interface to use different input devices
|
||||||
|
* such as touchscreens and mices.
|
||||||
1. Get source handles for all the inputs you are interested in.
|
*
|
||||||
- Attempting to get a handle for one instance of an input more than once will return the same handle
|
* @pre GFX_USE_GINPUT must be set to TRUE in your gfxconf.h
|
||||||
2. Create a listener
|
*
|
||||||
3. Assign inputs to your listener.
|
* @{
|
||||||
- Inputs can be assigned or released from a listener at any time.
|
*/
|
||||||
- An input can be assigned to more than one listener.
|
#ifndef _GINPUT_H
|
||||||
4. Loop on getting listener events
|
#define _GINPUT_H
|
||||||
5. When complete destroy the listener
|
|
||||||
*/
|
#include "gfx.h"
|
||||||
|
|
||||||
// Include various ginput types
|
#if GFX_USE_GINPUT || defined(__DOXYGEN__)
|
||||||
#include "ginput/mouse.h"
|
|
||||||
#include "ginput/keyboard.h"
|
/* How to use...
|
||||||
#include "ginput/toggle.h"
|
|
||||||
#include "ginput/dial.h"
|
1. Get source handles for all the inputs you are interested in.
|
||||||
|
- Attempting to get a handle for one instance of an input more than once will return the same handle
|
||||||
#endif /* GFX_USE_GINPUT */
|
2. Create a listener
|
||||||
|
3. Assign inputs to your listener.
|
||||||
#endif /* _GINPUT_H */
|
- Inputs can be assigned or released from a listener at any time.
|
||||||
/** @} */
|
- An input can be assigned to more than one listener.
|
||||||
|
4. Loop on getting listener events
|
||||||
|
5. When complete destroy the listener
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Include various ginput types
|
||||||
|
#include "ginput/mouse.h"
|
||||||
|
#include "ginput/keyboard.h"
|
||||||
|
#include "ginput/toggle.h"
|
||||||
|
#include "ginput/dial.h"
|
||||||
|
|
||||||
|
#endif /* GFX_USE_GINPUT */
|
||||||
|
|
||||||
|
#endif /* _GINPUT_H */
|
||||||
|
/** @} */
|
||||||
|
|
|
@ -4,116 +4,125 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GINPUT_KEYBOARD_H
|
/**
|
||||||
#define _GINPUT_KEYBOARD_H
|
* @file include/ginput/keyboard.h
|
||||||
|
* @brief GINPUT GFX User Input subsystem header file.
|
||||||
#if GINPUT_NEED_KEYBOARD || defined(__DOXYGEN__)
|
*
|
||||||
|
* @defgroup Keyboard Keyboard
|
||||||
/*===========================================================================*/
|
* @ingroup GINPUT
|
||||||
/* Type definitions */
|
* @{
|
||||||
/*===========================================================================*/
|
*/
|
||||||
|
|
||||||
#define GINPUT_KEYBOARD_NUM_PORTS 1 // The total number of keyboard inputs
|
#ifndef _GINPUT_KEYBOARD_H
|
||||||
|
#define _GINPUT_KEYBOARD_H
|
||||||
// Event types for various ginput sources
|
|
||||||
#define GEVENT_KEYBOARD (GEVENT_GINPUT_FIRST+2)
|
#if GINPUT_NEED_KEYBOARD || defined(__DOXYGEN__)
|
||||||
|
|
||||||
typedef struct GEventKeyboard_t {
|
/*===========================================================================*/
|
||||||
GEventType type; // The type of this event (GEVENT_KEYBOARD)
|
/* Type definitions */
|
||||||
uint16_t instance; // The keyboard instance
|
/*===========================================================================*/
|
||||||
char c; // The Ascii code for the current key press.
|
|
||||||
// The only possible values are 0(NUL), 8(BS), 9(TAB), 13(CR), 27(ESC), 32(SPACE) to 126(~), 127(DEL)
|
#define GINPUT_KEYBOARD_NUM_PORTS 1 // The total number of keyboard inputs
|
||||||
// 0 indicates an extended only key.
|
|
||||||
uint16_t code; // An extended keyboard code. Codes less than 128 match their ascii equivelent.
|
// Event types for various ginput sources
|
||||||
#define GKEY_NULL 0
|
#define GEVENT_KEYBOARD (GEVENT_GINPUT_FIRST+2)
|
||||||
#define GKEY_BACKSPACE 8
|
|
||||||
#define GKEY_TAB 9
|
typedef struct GEventKeyboard_t {
|
||||||
#define GKEY_CR 13
|
GEventType type; // The type of this event (GEVENT_KEYBOARD)
|
||||||
#define GKEY_ESC 27
|
uint16_t instance; // The keyboard instance
|
||||||
#define GKEY_SPACE 32
|
char c; // The Ascii code for the current key press.
|
||||||
#define GKEY_DEL 127
|
// The only possible values are 0(NUL), 8(BS), 9(TAB), 13(CR), 27(ESC), 32(SPACE) to 126(~), 127(DEL)
|
||||||
#define GKEY_UP 0x0101
|
// 0 indicates an extended only key.
|
||||||
#define GKEY_DOWN 0x0102
|
uint16_t code; // An extended keyboard code. Codes less than 128 match their ascii equivelent.
|
||||||
#define GKEY_LEFT 0x0103
|
#define GKEY_NULL 0
|
||||||
#define GKEY_RIGHT 0x0104
|
#define GKEY_BACKSPACE 8
|
||||||
#define GKEY_HOME 0x0105
|
#define GKEY_TAB 9
|
||||||
#define GKEY_END 0x0106
|
#define GKEY_CR 13
|
||||||
#define GKEY_PAGEUP 0x0107
|
#define GKEY_ESC 27
|
||||||
#define GKEY_PAGEDOWN 0x0108
|
#define GKEY_SPACE 32
|
||||||
#define GKEY_INSERT 0x0109
|
#define GKEY_DEL 127
|
||||||
#define GKEY_DELETE 0x010A
|
#define GKEY_UP 0x0101
|
||||||
#define GKEY_SHIFT 0x0201
|
#define GKEY_DOWN 0x0102
|
||||||
#define GKEY_CNTRL 0x0202
|
#define GKEY_LEFT 0x0103
|
||||||
#define GKEY_ALT 0x0203
|
#define GKEY_RIGHT 0x0104
|
||||||
#define GKEY_WINKEY 0x0204
|
#define GKEY_HOME 0x0105
|
||||||
#define GKEY_RCLKEY 0x0205
|
#define GKEY_END 0x0106
|
||||||
#define GKEY_FNKEY 0x0206
|
#define GKEY_PAGEUP 0x0107
|
||||||
#define GKEY_FN1 0x0301
|
#define GKEY_PAGEDOWN 0x0108
|
||||||
#define GKEY_FN2 0x0302
|
#define GKEY_INSERT 0x0109
|
||||||
#define GKEY_FN3 0x0303
|
#define GKEY_DELETE 0x010A
|
||||||
#define GKEY_FN4 0x0304
|
#define GKEY_SHIFT 0x0201
|
||||||
#define GKEY_FN5 0x0305
|
#define GKEY_CNTRL 0x0202
|
||||||
#define GKEY_FN6 0x0306
|
#define GKEY_ALT 0x0203
|
||||||
#define GKEY_FN7 0x0307
|
#define GKEY_WINKEY 0x0204
|
||||||
#define GKEY_FN8 0x0308
|
#define GKEY_RCLKEY 0x0205
|
||||||
#define GKEY_FN9 0x0309
|
#define GKEY_FNKEY 0x0206
|
||||||
#define GKEY_FN10 0x030A
|
#define GKEY_FN1 0x0301
|
||||||
#define GKEY_FN11 0x030B
|
#define GKEY_FN2 0x0302
|
||||||
#define GKEY_FN12 0x030C
|
#define GKEY_FN3 0x0303
|
||||||
uint16_t current_buttons; // A bit is set to indicate various meta status.
|
#define GKEY_FN4 0x0304
|
||||||
#define GMETA_KEY_DOWN 0x0001
|
#define GKEY_FN5 0x0305
|
||||||
#define GMETA_KEY_SHIFT 0x0002
|
#define GKEY_FN6 0x0306
|
||||||
#define GMETA_KEY_CNTRL 0x0004
|
#define GKEY_FN7 0x0307
|
||||||
#define GMETA_KEY_ALT 0x0008
|
#define GKEY_FN8 0x0308
|
||||||
#define GMETA_KEY_WINKEY 0x0010
|
#define GKEY_FN9 0x0309
|
||||||
#define GMETA_KEY_RCLKKEY 0x0020
|
#define GKEY_FN10 0x030A
|
||||||
#define GMETA_KEY_FN 0x0040
|
#define GKEY_FN11 0x030B
|
||||||
#define GMETA_KEY_MISSED_EVENT 0x8000
|
#define GKEY_FN12 0x030C
|
||||||
uint16_t last_buttons; // The value of current_buttons on the last event
|
uint16_t current_buttons; // A bit is set to indicate various meta status.
|
||||||
} GEventKeyboard;
|
#define GMETA_KEY_DOWN 0x0001
|
||||||
|
#define GMETA_KEY_SHIFT 0x0002
|
||||||
// Keyboard Listen Flags - passed to geventAddSourceToListener()
|
#define GMETA_KEY_CNTRL 0x0004
|
||||||
#define GLISTEN_KEYREPEATS 0x0001 // Return key repeats (where the key is held down to get a repeat character)
|
#define GMETA_KEY_ALT 0x0008
|
||||||
#define GLISTEN_KEYCODES 0x0002 // Return all key presses including extended code key presses (not just ascii codes)
|
#define GMETA_KEY_WINKEY 0x0010
|
||||||
#define GLISTEN_KEYALL 0x0004 // Return keyup's, keydown's and everything in between (but not repeats unless GLISTEN_KEYREPEATS is set).
|
#define GMETA_KEY_RCLKKEY 0x0020
|
||||||
#define GLISTEN_KEYSINGLE 0x8000 // Return only when one particular extended code key is pressed or released. The particular extended code is OR'd into this value
|
#define GMETA_KEY_FN 0x0040
|
||||||
// eg. (GLISTEN_KEYSINGLE | GKEY_CR)
|
#define GMETA_KEY_MISSED_EVENT 0x8000
|
||||||
// No other flags may be set with this flag.
|
uint16_t last_buttons; // The value of current_buttons on the last event
|
||||||
|
} GEventKeyboard;
|
||||||
/*===========================================================================*/
|
|
||||||
/* External declarations. */
|
// Keyboard Listen Flags - passed to geventAddSourceToListener()
|
||||||
/*===========================================================================*/
|
#define GLISTEN_KEYREPEATS 0x0001 // Return key repeats (where the key is held down to get a repeat character)
|
||||||
|
#define GLISTEN_KEYCODES 0x0002 // Return all key presses including extended code key presses (not just ascii codes)
|
||||||
#ifdef __cplusplus
|
#define GLISTEN_KEYALL 0x0004 // Return keyup's, keydown's and everything in between (but not repeats unless GLISTEN_KEYREPEATS is set).
|
||||||
extern "C" {
|
#define GLISTEN_KEYSINGLE 0x8000 // Return only when one particular extended code key is pressed or released. The particular extended code is OR'd into this value
|
||||||
#endif
|
// eg. (GLISTEN_KEYSINGLE | GKEY_CR)
|
||||||
|
// No other flags may be set with this flag.
|
||||||
/**
|
|
||||||
* @brief Create a keyboard input instance
|
/*===========================================================================*/
|
||||||
*
|
/* External declarations. */
|
||||||
* @param[in] instance The ID of the keyboard input instance (from 0 to 9999)
|
/*===========================================================================*/
|
||||||
*
|
|
||||||
* @return The source handle of the created input instance
|
#ifdef __cplusplus
|
||||||
*/
|
extern "C" {
|
||||||
GSourceHandle ginputGetKeyboard(uint16_t instance);
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the current keyboard status
|
* @brief Create a keyboard input instance
|
||||||
*
|
*
|
||||||
* @param[in] instance The ID of the keyboard input instance
|
* @param[in] instance The ID of the keyboard input instance (from 0 to 9999)
|
||||||
* @param[in] pkeyboard The keyboard event struct
|
*
|
||||||
*
|
* @return The source handle of the created input instance
|
||||||
* @return Returns FALSE on an error (eg invalid instance)
|
*/
|
||||||
*/
|
GSourceHandle ginputGetKeyboard(uint16_t instance);
|
||||||
bool_t ginputGetKeyboardStatus(uint16_t instance, GEventKeyboard *pkeyboard);
|
|
||||||
|
/**
|
||||||
#ifdef __cplusplus
|
* @brief Get the current keyboard status
|
||||||
}
|
*
|
||||||
#endif
|
* @param[in] instance The ID of the keyboard input instance
|
||||||
|
* @param[in] pkeyboard The keyboard event struct
|
||||||
#endif /* GINPUT_NEED_KEYBOARD */
|
*
|
||||||
|
* @return Returns FALSE on an error (eg invalid instance)
|
||||||
#endif /* _GINPUT_KEYBOARD_H */
|
*/
|
||||||
/** @} */
|
bool_t ginputGetKeyboardStatus(uint16_t instance, GEventKeyboard *pkeyboard);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* GINPUT_NEED_KEYBOARD */
|
||||||
|
|
||||||
|
#endif /* _GINPUT_KEYBOARD_H */
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,15 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/ginput/lld/dial.h
|
||||||
|
* @brief GINPUT header file for dial drivers.
|
||||||
|
*
|
||||||
|
* @defgroup Dial Dial
|
||||||
|
* @ingroup GINPUT
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _LLD_GINPUT_DIAL_H
|
#ifndef _LLD_GINPUT_DIAL_H
|
||||||
#define _LLD_GINPUT_DIAL_H
|
#define _LLD_GINPUT_DIAL_H
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,15 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/ginput/lld/mouse.h
|
||||||
|
* @brief GINPUT LLD header file for mouse/touch drivers.
|
||||||
|
*
|
||||||
|
* @defgroup Mouse Mouse
|
||||||
|
* @ingroup GINPUT
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _LLD_GINPUT_MOUSE_H
|
#ifndef _LLD_GINPUT_MOUSE_H
|
||||||
#define _LLD_GINPUT_MOUSE_H
|
#define _LLD_GINPUT_MOUSE_H
|
||||||
|
|
||||||
|
|
|
@ -4,49 +4,58 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LLD_GINPUT_TOGGLE_H
|
/**
|
||||||
#define _LLD_GINPUT_TOGGLE_H
|
* @file include/ginput/lld/toggle.h
|
||||||
|
* @brief GINPUT header file for toggle drivers.
|
||||||
#if GINPUT_NEED_TOGGLE || defined(__DOXYGEN__)
|
*
|
||||||
|
* @defgroup Toggle Toggle
|
||||||
// Describes how the toggle bits are obtained
|
* @ingroup GINPUT
|
||||||
typedef struct GToggleConfig_t {
|
* @{
|
||||||
void *id;
|
*/
|
||||||
unsigned mask;
|
|
||||||
unsigned invert;
|
#ifndef _LLD_GINPUT_TOGGLE_H
|
||||||
iomode_t mode;
|
#define _LLD_GINPUT_TOGGLE_H
|
||||||
} GToggleConfig;
|
|
||||||
|
#if GINPUT_NEED_TOGGLE || defined(__DOXYGEN__)
|
||||||
/*===========================================================================*/
|
|
||||||
/* External declarations. */
|
// Describes how the toggle bits are obtained
|
||||||
/*===========================================================================*/
|
typedef struct GToggleConfig_t {
|
||||||
|
void *id;
|
||||||
#ifdef __cplusplus
|
unsigned mask;
|
||||||
extern "C" {
|
unsigned invert;
|
||||||
#endif
|
iomode_t mode;
|
||||||
|
} GToggleConfig;
|
||||||
extern const GToggleConfig GInputToggleConfigTable[GINPUT_TOGGLE_CONFIG_ENTRIES];
|
|
||||||
|
/*===========================================================================*/
|
||||||
void ginput_lld_toggle_init(const GToggleConfig *ptc);
|
/* External declarations. */
|
||||||
unsigned ginput_lld_toggle_getbits(const GToggleConfig *ptc);
|
/*===========================================================================*/
|
||||||
|
|
||||||
/* This routine is provided to low level drivers to wakeup a value read from a thread context.
|
#ifdef __cplusplus
|
||||||
* Particularly useful if GINPUT_TOGGLE_POLL_PERIOD = TIME_INFINITE
|
extern "C" {
|
||||||
*/
|
#endif
|
||||||
void ginputToggleWakeup(void);
|
|
||||||
|
extern const GToggleConfig GInputToggleConfigTable[GINPUT_TOGGLE_CONFIG_ENTRIES];
|
||||||
/* This routine is provided to low level drivers to wakeup a value read from an ISR
|
|
||||||
* Particularly useful if GINPUT_TOGGLE_POLL_PERIOD = TIME_INFINITE
|
void ginput_lld_toggle_init(const GToggleConfig *ptc);
|
||||||
*/
|
unsigned ginput_lld_toggle_getbits(const GToggleConfig *ptc);
|
||||||
void ginputToggleWakeupI(void);
|
|
||||||
|
/* This routine is provided to low level drivers to wakeup a value read from a thread context.
|
||||||
#ifdef __cplusplus
|
* Particularly useful if GINPUT_TOGGLE_POLL_PERIOD = TIME_INFINITE
|
||||||
}
|
*/
|
||||||
#endif
|
void ginputToggleWakeup(void);
|
||||||
|
|
||||||
#endif /* GFX_USE_GINPUT && GINPUT_NEED_TOGGLE */
|
/* This routine is provided to low level drivers to wakeup a value read from an ISR
|
||||||
|
* Particularly useful if GINPUT_TOGGLE_POLL_PERIOD = TIME_INFINITE
|
||||||
#endif /* _LLD_GINPUT_TOGGLE_H */
|
*/
|
||||||
/** @} */
|
void ginputToggleWakeupI(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* GFX_USE_GINPUT && GINPUT_NEED_TOGGLE */
|
||||||
|
|
||||||
|
#endif /* _LLD_GINPUT_TOGGLE_H */
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -4,140 +4,156 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GINPUT_MOUSE_H
|
/**
|
||||||
#define _GINPUT_MOUSE_H
|
* @file include/ginput/mouse.h
|
||||||
|
* @brief GINPUT GFX User Input subsystem header file for mouse and touch.
|
||||||
#if GINPUT_NEED_MOUSE || defined(__DOXYGEN__)
|
*
|
||||||
|
* @defgroup Mouse Mouse
|
||||||
/*===========================================================================*/
|
* @ingroup GINPUT
|
||||||
/* Type definitions */
|
*
|
||||||
/*===========================================================================*/
|
* @details GINPUT allows it to easily interface touchscreens and mices to
|
||||||
|
* your application.
|
||||||
/* This type definition is also used by touch */
|
*
|
||||||
typedef struct GEventMouse_t {
|
* @pre GFX_USE_GINPUT must be set to TRUE in your gfxconf.h
|
||||||
GEventType type; // The type of this event (GEVENT_MOUSE or GEVENT_TOUCH)
|
* @pre GINPUT_NEED_MOUSE must be set to TRUE in your gfxconf.h
|
||||||
uint16_t instance; // The mouse/touch instance
|
*
|
||||||
coord_t x, y, z; // The position of the mouse.
|
* @{
|
||||||
// - For touch devices, Z is the current pressure if supported (otherwise 0)
|
*/
|
||||||
// - For mice, Z is the 3rd dimension if supported (otherwise 0)
|
|
||||||
uint16_t current_buttons; // A bit is set if the button is down.
|
#ifndef _GINPUT_MOUSE_H
|
||||||
// - For touch only bit 0 is relevant
|
#define _GINPUT_MOUSE_H
|
||||||
// - For mice the order of the buttons is (from 0 to n) left, right, middle, any other buttons
|
|
||||||
// - Bit 15 being set indicates that an important mouse event has been missed.
|
#if GINPUT_NEED_MOUSE || defined(__DOXYGEN__)
|
||||||
#define GINPUT_MOUSE_BTN_LEFT 0x0001
|
|
||||||
#define GINPUT_MOUSE_BTN_RIGHT 0x0002
|
/*===========================================================================*/
|
||||||
#define GINPUT_MOUSE_BTN_MIDDLE 0x0004
|
/* Type definitions */
|
||||||
#define GINPUT_MOUSE_BTN_4 0x0008
|
/*===========================================================================*/
|
||||||
#define GINPUT_MISSED_MOUSE_EVENT 0x8000
|
|
||||||
#define GINPUT_TOUCH_PRESSED GINPUT_MOUSE_BTN_LEFT
|
/* This type definition is also used by touch */
|
||||||
uint16_t last_buttons; // The value of current_buttons on the last event
|
typedef struct GEventMouse_t {
|
||||||
enum GMouseMeta_e {
|
GEventType type; // The type of this event (GEVENT_MOUSE or GEVENT_TOUCH)
|
||||||
GMETA_NONE = 0, // There is no meta event currently happening
|
uint16_t instance; // The mouse/touch instance
|
||||||
GMETA_MOUSE_DOWN = 1, // Button 0 has just gone down
|
coord_t x, y, z; // The position of the mouse.
|
||||||
GMETA_MOUSE_UP = 2, // Button 0 has just gone up
|
// - For touch devices, Z is the current pressure if supported (otherwise 0)
|
||||||
GMETA_MOUSE_CLICK = 4, // Button 0 has just gone through a short down - up cycle
|
// - For mice, Z is the 3rd dimension if supported (otherwise 0)
|
||||||
GMETA_MOUSE_CXTCLICK = 8 // For mice - The right button has just been depressed
|
uint16_t current_buttons; // A bit is set if the button is down.
|
||||||
// For touch - a long press has just occurred
|
// - For touch only bit 0 is relevant
|
||||||
} meta;
|
// - For mice the order of the buttons is (from 0 to n) left, right, middle, any other buttons
|
||||||
} GEventMouse;
|
// - Bit 15 being set indicates that an important mouse event has been missed.
|
||||||
|
#define GINPUT_MOUSE_BTN_LEFT 0x0001
|
||||||
// Mouse/Touch Listen Flags - passed to geventAddSourceToListener()
|
#define GINPUT_MOUSE_BTN_RIGHT 0x0002
|
||||||
#define GLISTEN_MOUSEMETA 0x0001 // Create events for meta events such as CLICK and CXTCLICK
|
#define GINPUT_MOUSE_BTN_MIDDLE 0x0004
|
||||||
#define GLISTEN_MOUSEDOWNMOVES 0x0002 // Creates mouse move events when the primary mouse button is down (touch is on the surface)
|
#define GINPUT_MOUSE_BTN_4 0x0008
|
||||||
#define GLISTEN_MOUSEUPMOVES 0x0004 // Creates mouse move events when the primary mouse button is up (touch is off the surface - if the hardware allows).
|
#define GINPUT_MISSED_MOUSE_EVENT 0x8000
|
||||||
#define GLISTEN_MOUSENOFILTER 0x0008 // Don't filter out mouse moves where the position hasn't changed.
|
#define GINPUT_TOUCH_PRESSED GINPUT_MOUSE_BTN_LEFT
|
||||||
#define GLISTEN_TOUCHMETA GLISTEN_MOUSEMETA
|
uint16_t last_buttons; // The value of current_buttons on the last event
|
||||||
#define GLISTEN_TOUCHDOWNMOVES GLISTEN_MOUSEDOWNMOVES
|
enum GMouseMeta_e {
|
||||||
#define GLISTEN_TOUCHUPMOVES GLISTEN_MOUSEUPMOVES
|
GMETA_NONE = 0, // There is no meta event currently happening
|
||||||
#define GLISTEN_TOUCHNOFILTER GLISTEN_MOUSENOFILTER
|
GMETA_MOUSE_DOWN = 1, // Button 0 has just gone down
|
||||||
|
GMETA_MOUSE_UP = 2, // Button 0 has just gone up
|
||||||
#define GINPUT_MOUSE_NUM_PORTS 1 // The total number of mouse/touch inputs supported
|
GMETA_MOUSE_CLICK = 4, // Button 0 has just gone through a short down - up cycle
|
||||||
|
GMETA_MOUSE_CXTCLICK = 8 // For mice - The right button has just been depressed
|
||||||
// Event types for the mouse ginput source
|
// For touch - a long press has just occurred
|
||||||
#define GEVENT_MOUSE (GEVENT_GINPUT_FIRST+0)
|
} meta;
|
||||||
#define GEVENT_TOUCH (GEVENT_GINPUT_FIRST+1)
|
} GEventMouse;
|
||||||
|
|
||||||
/*===========================================================================*/
|
// Mouse/Touch Listen Flags - passed to geventAddSourceToListener()
|
||||||
/* External declarations. */
|
#define GLISTEN_MOUSEMETA 0x0001 // Create events for meta events such as CLICK and CXTCLICK
|
||||||
/*===========================================================================*/
|
#define GLISTEN_MOUSEDOWNMOVES 0x0002 // Creates mouse move events when the primary mouse button is down (touch is on the surface)
|
||||||
|
#define GLISTEN_MOUSEUPMOVES 0x0004 // Creates mouse move events when the primary mouse button is up (touch is off the surface - if the hardware allows).
|
||||||
#ifdef __cplusplus
|
#define GLISTEN_MOUSENOFILTER 0x0008 // Don't filter out mouse moves where the position hasn't changed.
|
||||||
extern "C" {
|
#define GLISTEN_TOUCHMETA GLISTEN_MOUSEMETA
|
||||||
#endif
|
#define GLISTEN_TOUCHDOWNMOVES GLISTEN_MOUSEDOWNMOVES
|
||||||
|
#define GLISTEN_TOUCHUPMOVES GLISTEN_MOUSEUPMOVES
|
||||||
/**
|
#define GLISTEN_TOUCHNOFILTER GLISTEN_MOUSENOFILTER
|
||||||
* @brief Creates an instance of a mouse and returns the Source handler
|
|
||||||
* @note hack: if the instance is 9999, no calibration will be performed!
|
#define GINPUT_MOUSE_NUM_PORTS 1 // The total number of mouse/touch inputs supported
|
||||||
*
|
|
||||||
* @param[in] instance The ID of the mouse input instance (from 0 to 9999)
|
// Event types for the mouse ginput source
|
||||||
*
|
#define GEVENT_MOUSE (GEVENT_GINPUT_FIRST+0)
|
||||||
* @return The source handle of the created instance
|
#define GEVENT_TOUCH (GEVENT_GINPUT_FIRST+1)
|
||||||
*/
|
|
||||||
GSourceHandle ginputGetMouse(uint16_t instance);
|
/*===========================================================================*/
|
||||||
|
/* External declarations. */
|
||||||
/**
|
/*===========================================================================*/
|
||||||
* @brief Get the current mouse position and button status
|
|
||||||
* @note Unlinke a listener event, this status cannot record meta events such as
|
#ifdef __cplusplus
|
||||||
* "CLICK".
|
extern "C" {
|
||||||
*
|
#endif
|
||||||
* @param[in] instance The ID of the mouse input instance
|
|
||||||
* @param[in] pmouse The mouse event
|
/**
|
||||||
*
|
* @brief Creates an instance of a mouse and returns the Source handler
|
||||||
* @return FALSE on an error (eg. invalid instance)
|
* @note hack: if the instance is 9999, no calibration will be performed!
|
||||||
*/
|
*
|
||||||
bool_t ginputGetMouseStatus(uint16_t instance, GEventMouse *pmouse);
|
* @param[in] instance The ID of the mouse input instance (from 0 to 9999)
|
||||||
|
*
|
||||||
/**
|
* @return The source handle of the created instance
|
||||||
* @brief Performs a calibration
|
*/
|
||||||
*
|
GSourceHandle ginputGetMouse(uint16_t instance);
|
||||||
* @param[in] instance The ID of the mouse input instance
|
|
||||||
*
|
/**
|
||||||
* @return FALSE if the driver dosen't support a calibration of if the handle is invalid
|
* @brief Get the current mouse position and button status
|
||||||
*/
|
* @note Unlinke a listener event, this status cannot record meta events such as
|
||||||
bool_t ginputCalibrateMouse(uint16_t instance);
|
* "CLICK".
|
||||||
|
*
|
||||||
/* Set the routines to save and fetch calibration data.
|
* @param[in] instance The ID of the mouse input instance
|
||||||
* This function should be called before first calling ginputGetMouse() for a particular instance
|
* @param[in] pmouse The mouse event
|
||||||
* as the gdispGetMouse() routine may attempt to fetch calibration data and perform a startup calibration if there is no way to get it.
|
*
|
||||||
* If this is called after gdispGetMouse() has been called and the driver requires calibration storage, it will immediately save the data is has already obtained.
|
* @return FALSE on an error (eg. invalid instance)
|
||||||
* The 'requireFree' parameter indicates if the fetch buffer must be free()'d to deallocate the buffer provided by the Fetch routine.
|
*/
|
||||||
*/
|
bool_t ginputGetMouseStatus(uint16_t instance, GEventMouse *pmouse);
|
||||||
typedef void (*GMouseCalibrationSaveRoutine)(uint16_t instance, const uint8_t *calbuf, size_t sz); // Save calibration data
|
|
||||||
typedef const char * (*GMouseCalibrationLoadRoutine)(uint16_t instance); // Load calibration data (returns NULL if not data saved)
|
/**
|
||||||
|
* @brief Performs a calibration
|
||||||
/**
|
*
|
||||||
* @brief Set the routines to store and restore calibration data
|
* @param[in] instance The ID of the mouse input instance
|
||||||
*
|
*
|
||||||
* @details This function should be called before first calling ginputGetMouse() for a particular instance
|
* @return FALSE if the driver dosen't support a calibration of if the handle is invalid
|
||||||
* as the gdispGetMouse() routine may attempt to fetch calibration data and perform a startup calibration if there is no way to get it.
|
*/
|
||||||
* If this is called after gdispGetMouse() has been called and the driver requires calibration storage, it will immediately save the
|
bool_t ginputCalibrateMouse(uint16_t instance);
|
||||||
* data is has already obtained.
|
|
||||||
* The 'requireFree' parameter indicates if the fetch buffer must be free()'d to deallocate the buffer provided by the Fetch routine.
|
/* Set the routines to save and fetch calibration data.
|
||||||
*
|
* This function should be called before first calling ginputGetMouse() for a particular instance
|
||||||
* @param[in] instance The ID of the mouse input instance
|
* as the gdispGetMouse() routine may attempt to fetch calibration data and perform a startup calibration if there is no way to get it.
|
||||||
* @param[in] fnsave The routine to save the data
|
* If this is called after gdispGetMouse() has been called and the driver requires calibration storage, it will immediately save the data is has already obtained.
|
||||||
* @param[in] fnload The routine to restore the data
|
* The 'requireFree' parameter indicates if the fetch buffer must be free()'d to deallocate the buffer provided by the Fetch routine.
|
||||||
* @param[in] requireFree ToDo
|
*/
|
||||||
*/
|
typedef void (*GMouseCalibrationSaveRoutine)(uint16_t instance, const uint8_t *calbuf, size_t sz); // Save calibration data
|
||||||
void ginputSetMouseCalibrationRoutines(uint16_t instance, GMouseCalibrationSaveRoutine fnsave, GMouseCalibrationLoadRoutine fnload, bool_t requireFree);
|
typedef const char * (*GMouseCalibrationLoadRoutine)(uint16_t instance); // Load calibration data (returns NULL if not data saved)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Test if a particular mouse/touch instance requires routines to save it's alibration data
|
* @brief Set the routines to store and restore calibration data
|
||||||
* @note Not implemented yet
|
*
|
||||||
*
|
* @details This function should be called before first calling ginputGetMouse() for a particular instance
|
||||||
* @param[in] instance The ID of the mouse input instance
|
* as the gdispGetMouse() routine may attempt to fetch calibration data and perform a startup calibration if there is no way to get it.
|
||||||
*
|
* If this is called after gdispGetMouse() has been called and the driver requires calibration storage, it will immediately save the
|
||||||
* @return TRUE if needed
|
* data is has already obtained.
|
||||||
*/
|
* The 'requireFree' parameter indicates if the fetch buffer must be free()'d to deallocate the buffer provided by the Fetch routine.
|
||||||
bool_t ginputRequireMouseCalibrationStorage(uint16_t instance);
|
*
|
||||||
|
* @param[in] instance The ID of the mouse input instance
|
||||||
#ifdef __cplusplus
|
* @param[in] fnsave The routine to save the data
|
||||||
}
|
* @param[in] fnload The routine to restore the data
|
||||||
#endif
|
* @param[in] requireFree ToDo
|
||||||
|
*/
|
||||||
#endif /* GINPUT_NEED_MOUSE */
|
void ginputSetMouseCalibrationRoutines(uint16_t instance, GMouseCalibrationSaveRoutine fnsave, GMouseCalibrationLoadRoutine fnload, bool_t requireFree);
|
||||||
|
|
||||||
#endif /* _GINPUT_MOUSE_H */
|
/**
|
||||||
/** @} */
|
* @brief Test if a particular mouse/touch instance requires routines to save it's alibration data
|
||||||
|
* @note Not implemented yet
|
||||||
|
*
|
||||||
|
* @param[in] instance The ID of the mouse input instance
|
||||||
|
*
|
||||||
|
* @return TRUE if needed
|
||||||
|
*/
|
||||||
|
bool_t ginputRequireMouseCalibrationStorage(uint16_t instance);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* GINPUT_NEED_MOUSE */
|
||||||
|
|
||||||
|
#endif /* _GINPUT_MOUSE_H */
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -4,81 +4,97 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GINPUT_TOGGLE_H
|
/**
|
||||||
#define _GINPUT_TOGGLE_H
|
* @file include/ginput/toggle.h
|
||||||
|
* @brief GINPUT GFX User Input subsystem header file.
|
||||||
#if GINPUT_NEED_TOGGLE || defined(__DOXYGEN__)
|
*
|
||||||
|
* @defgroup Toggle Toggle
|
||||||
/*===========================================================================*/
|
* @ingroup GINPUT
|
||||||
/* Low Level Driver details and error checks. */
|
*
|
||||||
/*===========================================================================*/
|
* @details GINPUT allows it to interface toggle buttons easily to your
|
||||||
|
* application.
|
||||||
// Get the hardware definitions - Number of instances etc.
|
*
|
||||||
#include "ginput_lld_toggle_config.h"
|
* @pre GFX_USE_GINPUT must be set to TRUE in your gfxconf.h
|
||||||
|
* @pre GINPUT_NEED_TOGGLE must be set to TRUE in your gfxconf.h
|
||||||
#ifndef GINPUT_TOGGLE_POLL_PERIOD
|
*
|
||||||
#define GINPUT_TOGGLE_POLL_PERIOD 200
|
* @{
|
||||||
#endif
|
*/
|
||||||
|
|
||||||
/*===========================================================================*/
|
#ifndef _GINPUT_TOGGLE_H
|
||||||
/* Type definitions */
|
#define _GINPUT_TOGGLE_H
|
||||||
/*===========================================================================*/
|
|
||||||
|
#if GINPUT_NEED_TOGGLE || defined(__DOXYGEN__)
|
||||||
// Event types for various ginput sources
|
|
||||||
#define GEVENT_TOGGLE (GEVENT_GINPUT_FIRST+3)
|
/*===========================================================================*/
|
||||||
|
/* Low Level Driver details and error checks. */
|
||||||
typedef struct GEventToggle_t {
|
/*===========================================================================*/
|
||||||
GEventType type; // The type of this event (GEVENT_TOGGLE)
|
|
||||||
uint16_t instance; // The toggle instance
|
// Get the hardware definitions - Number of instances etc.
|
||||||
bool_t on; // True if the toggle/button is on
|
#include "ginput_lld_toggle_config.h"
|
||||||
} GEventToggle;
|
|
||||||
|
#ifndef GINPUT_TOGGLE_POLL_PERIOD
|
||||||
// Toggle Listen Flags - passed to geventAddSourceToListener()
|
#define GINPUT_TOGGLE_POLL_PERIOD 200
|
||||||
#define GLISTEN_TOGGLE_ON 0x0001 // Return an event when the toggle turns on
|
#endif
|
||||||
#define GLISTEN_TOGGLE_OFF 0x0002 // Return an event when the toggle turns off
|
|
||||||
|
/*===========================================================================*/
|
||||||
/*===========================================================================*/
|
/* Type definitions */
|
||||||
/* External declarations. */
|
/*===========================================================================*/
|
||||||
/*===========================================================================*/
|
|
||||||
|
// Event types for various ginput sources
|
||||||
#ifdef __cplusplus
|
#define GEVENT_TOGGLE (GEVENT_GINPUT_FIRST+3)
|
||||||
extern "C" {
|
|
||||||
#endif
|
typedef struct GEventToggle_t {
|
||||||
|
GEventType type; // The type of this event (GEVENT_TOGGLE)
|
||||||
/**
|
uint16_t instance; // The toggle instance
|
||||||
* @brief Create a toggle input instance
|
bool_t on; // True if the toggle/button is on
|
||||||
*
|
} GEventToggle;
|
||||||
* @param[in] instance The ID of the toggle input instance (from 0 to 9999)
|
|
||||||
*
|
// Toggle Listen Flags - passed to geventAddSourceToListener()
|
||||||
* @return The source handle of the created instance
|
#define GLISTEN_TOGGLE_ON 0x0001 // Return an event when the toggle turns on
|
||||||
*/
|
#define GLISTEN_TOGGLE_OFF 0x0002 // Return an event when the toggle turns off
|
||||||
GSourceHandle ginputGetToggle(uint16_t instance);
|
|
||||||
|
/*===========================================================================*/
|
||||||
/**
|
/* External declarations. */
|
||||||
* @brief Can be used to invert the sense of a toggle
|
/*===========================================================================*/
|
||||||
*
|
|
||||||
* @param[in] instance The ID of the toggle input instance
|
#ifdef __cplusplus
|
||||||
* @param[in] invert If TRUE, will be inverted
|
extern "C" {
|
||||||
*/
|
#endif
|
||||||
void ginputInvertToggle(uint16_t instance, bool_t invert);
|
|
||||||
|
/**
|
||||||
/**
|
* @brief Create a toggle input instance
|
||||||
* @brief Get the current toggle status
|
*
|
||||||
*
|
* @param[in] instance The ID of the toggle input instance (from 0 to 9999)
|
||||||
* @param[in] instance The ID of the toggle input instance
|
*
|
||||||
* @param[in] ptoggle The toggle event struct
|
* @return The source handle of the created instance
|
||||||
*
|
*/
|
||||||
* @return Returns FALSE on an error (eg invalid instance)
|
GSourceHandle ginputGetToggle(uint16_t instance);
|
||||||
*/
|
|
||||||
bool_t ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle);
|
/**
|
||||||
|
* @brief Can be used to invert the sense of a toggle
|
||||||
#ifdef __cplusplus
|
*
|
||||||
}
|
* @param[in] instance The ID of the toggle input instance
|
||||||
#endif
|
* @param[in] invert If TRUE, will be inverted
|
||||||
|
*/
|
||||||
#endif /* GINPUT_NEED_TOGGLE */
|
void ginputInvertToggle(uint16_t instance, bool_t invert);
|
||||||
|
|
||||||
#endif /* _GINPUT_TOGGLE_H */
|
/**
|
||||||
/** @} */
|
* @brief Get the current toggle status
|
||||||
|
*
|
||||||
|
* @param[in] instance The ID of the toggle input instance
|
||||||
|
* @param[in] ptoggle The toggle event struct
|
||||||
|
*
|
||||||
|
* @return Returns FALSE on an error (eg invalid instance)
|
||||||
|
*/
|
||||||
|
bool_t ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* GINPUT_NEED_TOGGLE */
|
||||||
|
|
||||||
|
#endif /* _GINPUT_TOGGLE_H */
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,15 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/gmisc/gmisc.h
|
||||||
|
* @brief GMISC - Miscellaneous Routines header file.
|
||||||
|
*
|
||||||
|
* @addtogroup GAUDIN
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _GMISC_H
|
#ifndef _GMISC_H
|
||||||
#define _GMISC_H
|
#define _GMISC_H
|
||||||
|
|
||||||
|
|
|
@ -4,147 +4,167 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GTIMER_H
|
/**
|
||||||
#define _GTIMER_H
|
* @file include/gtimer/gtimer.h
|
||||||
|
* @brief GTIMER GFX User Timer subsystem header file.
|
||||||
#include "gfx.h"
|
*
|
||||||
|
* @addtogroup GTIMER
|
||||||
#if GFX_USE_GTIMER || defined(__DOXYGEN__)
|
*
|
||||||
|
* @details The reason why ChibiOS/GFX has it's own timer abstraction is because
|
||||||
/*===========================================================================*/
|
* virtual timers provided by ChibiOS/RT are interrupt context only.
|
||||||
/* Type definitions */
|
* While great for what they are designed for, they make coding of the input
|
||||||
/*===========================================================================*/
|
* drivers much more complex.
|
||||||
|
* For non-performance critical drivers like these input drivers, it would also
|
||||||
/* Data part of a static GTimer initialiser */
|
* hog an in-ordinate amount of critical (interrupt locked) system time.
|
||||||
#define _GTIMER_DATA() {0,0,0,0,0,0,0}
|
* This contrary to the goals of a real-time operating system. So a user-land
|
||||||
|
* (thread based) timer mechanism is also required.
|
||||||
/* Static GTimer initialiser */
|
*
|
||||||
#define GTIMER_DECL(name) GTimer name = _GTIMER_DATA()
|
* @pre GFX_USE_GTIMER must be set to TRUE in your gfxconf.h
|
||||||
|
*
|
||||||
/* A callback function (executed in a thread context) */
|
* @{
|
||||||
typedef void (*GTimerFunction)(void *param);
|
*/
|
||||||
|
|
||||||
/**
|
#ifndef _GTIMER_H
|
||||||
* @brief A GTimer structure
|
#define _GTIMER_H
|
||||||
*/
|
|
||||||
typedef struct GTimer_t {
|
#include "gfx.h"
|
||||||
GTimerFunction fn;
|
|
||||||
void *param;
|
#if GFX_USE_GTIMER || defined(__DOXYGEN__)
|
||||||
systime_t when;
|
|
||||||
systime_t period;
|
/*===========================================================================*/
|
||||||
uint16_t flags;
|
/* Type definitions */
|
||||||
struct GTimer_t *next;
|
/*===========================================================================*/
|
||||||
struct GTimer_t *prev;
|
|
||||||
} GTimer;
|
/* Data part of a static GTimer initialiser */
|
||||||
|
#define _GTIMER_DATA() {0,0,0,0,0,0,0}
|
||||||
/*===========================================================================*/
|
|
||||||
/* External declarations. */
|
/* Static GTimer initialiser */
|
||||||
/*===========================================================================*/
|
#define GTIMER_DECL(name) GTimer name = _GTIMER_DATA()
|
||||||
|
|
||||||
#ifdef __cplusplus
|
/* A callback function (executed in a thread context) */
|
||||||
extern "C" {
|
typedef void (*GTimerFunction)(void *param);
|
||||||
#endif
|
|
||||||
|
/**
|
||||||
/**
|
* @brief A GTimer structure
|
||||||
* @brief Initialise a timer.
|
*/
|
||||||
*
|
typedef struct GTimer_t {
|
||||||
* @param[in] pt pointer to a GTimer structure
|
GTimerFunction fn;
|
||||||
*
|
void *param;
|
||||||
* @api
|
systime_t when;
|
||||||
*/
|
systime_t period;
|
||||||
void gtimerInit(GTimer *pt);
|
uint16_t flags;
|
||||||
|
struct GTimer_t *next;
|
||||||
/**
|
struct GTimer_t *prev;
|
||||||
* @brief Set a timer going or alter its properties if it is already going.
|
} GTimer;
|
||||||
*
|
|
||||||
* @param[in] pt Pointer to a GTimer structure
|
/*===========================================================================*/
|
||||||
* @param[in] fn The callback function
|
/* External declarations. */
|
||||||
* @param[in] param The parameter to pass to the callback function
|
/*===========================================================================*/
|
||||||
* @param[in] periodic Is the timer a periodic timer? FALSE is a once-only timer.
|
|
||||||
* @param[in] millisec The timer period. The following special values are allowed:
|
#ifdef __cplusplus
|
||||||
* TIME_IMMEDIATE causes the callback function to be called asap.
|
extern "C" {
|
||||||
* A periodic timer with this value will fire once only.
|
#endif
|
||||||
* TIME_INFINITE never timeout (unless triggered by gtimerJab or gtimerJabI)
|
|
||||||
*
|
/**
|
||||||
* @note If the timer is already active its properties are updated with the new parameters.
|
* @brief Initialise a timer.
|
||||||
* The current period will be immediately canceled (without the callback function being
|
*
|
||||||
* called) and the timer will be restart with the new timer properties.
|
* @param[in] pt pointer to a GTimer structure
|
||||||
* @note The callback function should be careful not to over-run the thread stack.
|
*
|
||||||
* Define a new value for the macro GTIME_THREAD_STACK_SIZE if you want to
|
* @api
|
||||||
* change the default size.
|
*/
|
||||||
* @note The callback function should return as quickly as possible as all
|
void gtimerInit(GTimer *pt);
|
||||||
* timer callbacks are performed by a single thread. If a callback function
|
|
||||||
* takes too long it could affect the timer response for other timers.
|
/**
|
||||||
* @note A timer callback function is not a replacement for a dedicated thread if the
|
* @brief Set a timer going or alter its properties if it is already going.
|
||||||
* function wants to perform computationally expensive stuff.
|
*
|
||||||
* @note As the callback function is called on GTIMER's thread, the function must make sure it uses
|
* @param[in] pt Pointer to a GTimer structure
|
||||||
* appropriate synchronisation controls such as semaphores or mutexes around any data
|
* @param[in] fn The callback function
|
||||||
* structures it shares with other threads such as the main application thread.
|
* @param[in] param The parameter to pass to the callback function
|
||||||
*
|
* @param[in] periodic Is the timer a periodic timer? FALSE is a once-only timer.
|
||||||
* @api
|
* @param[in] millisec The timer period. The following special values are allowed:
|
||||||
*/
|
* TIME_IMMEDIATE causes the callback function to be called asap.
|
||||||
void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, bool_t periodic, systime_t millisec);
|
* A periodic timer with this value will fire once only.
|
||||||
|
* TIME_INFINITE never timeout (unless triggered by gtimerJab or gtimerJabI)
|
||||||
/**
|
*
|
||||||
* @brief Stop a timer (periodic or otherwise)
|
* @note If the timer is already active its properties are updated with the new parameters.
|
||||||
*
|
* The current period will be immediately canceled (without the callback function being
|
||||||
* @param[in] pt Pointer to a GTimer structure
|
* called) and the timer will be restart with the new timer properties.
|
||||||
*
|
* @note The callback function should be careful not to over-run the thread stack.
|
||||||
* @note If the timer is not active this does nothing.
|
* Define a new value for the macro GTIME_THREAD_STACK_SIZE if you want to
|
||||||
*
|
* change the default size.
|
||||||
* @api
|
* @note The callback function should return as quickly as possible as all
|
||||||
*/
|
* timer callbacks are performed by a single thread. If a callback function
|
||||||
void gtimerStop(GTimer *pt);
|
* takes too long it could affect the timer response for other timers.
|
||||||
|
* @note A timer callback function is not a replacement for a dedicated thread if the
|
||||||
/**
|
* function wants to perform computationally expensive stuff.
|
||||||
* @brief Test if a timer is currently active
|
* @note As the callback function is called on GTIMER's thread, the function must make sure it uses
|
||||||
*
|
* appropriate synchronisation controls such as semaphores or mutexes around any data
|
||||||
* @param[in] pt Pointer to a GTimer structure
|
* structures it shares with other threads such as the main application thread.
|
||||||
*
|
*
|
||||||
* @return TRUE if active, FALSE otherwise
|
* @api
|
||||||
*
|
*/
|
||||||
* @api
|
void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, bool_t periodic, systime_t millisec);
|
||||||
*/
|
|
||||||
bool_t gtimerIsActive(GTimer *pt);
|
/**
|
||||||
|
* @brief Stop a timer (periodic or otherwise)
|
||||||
/**
|
*
|
||||||
* @brief Jab a timer causing the current period to immediate expire
|
* @param[in] pt Pointer to a GTimer structure
|
||||||
* @details The callback function will be called as soon as possible.
|
*
|
||||||
*
|
* @note If the timer is not active this does nothing.
|
||||||
* @pre Use from a normal thread context.
|
*
|
||||||
*
|
* @api
|
||||||
* @param[in] pt Pointer to a GTimer structure
|
*/
|
||||||
*
|
void gtimerStop(GTimer *pt);
|
||||||
* @note If the timer is not active this does nothing.
|
|
||||||
* @note Repeated Jabs before the callback function actually happens are ignored.
|
/**
|
||||||
*
|
* @brief Test if a timer is currently active
|
||||||
* @api
|
*
|
||||||
*/
|
* @param[in] pt Pointer to a GTimer structure
|
||||||
void gtimerJab(GTimer *pt);
|
*
|
||||||
|
* @return TRUE if active, FALSE otherwise
|
||||||
/**
|
*
|
||||||
* @brief Jab a timer causing the current period to immediate expire
|
* @api
|
||||||
* @details The callback function will be called as soon as possible.
|
*/
|
||||||
*
|
bool_t gtimerIsActive(GTimer *pt);
|
||||||
* @pre Use from an interrupt routine context.
|
|
||||||
*
|
/**
|
||||||
* @param[in] pt Pointer to a GTimer structure
|
* @brief Jab a timer causing the current period to immediate expire
|
||||||
*
|
* @details The callback function will be called as soon as possible.
|
||||||
* @note If the timer is not active this does nothing.
|
*
|
||||||
* @note Repeated Jabs before the callback function actually happens are ignored.
|
* @pre Use from a normal thread context.
|
||||||
*
|
*
|
||||||
* @iclass
|
* @param[in] pt Pointer to a GTimer structure
|
||||||
* @api
|
*
|
||||||
*/
|
* @note If the timer is not active this does nothing.
|
||||||
void gtimerJabI(GTimer *pt);
|
* @note Repeated Jabs before the callback function actually happens are ignored.
|
||||||
|
*
|
||||||
#ifdef __cplusplus
|
* @api
|
||||||
}
|
*/
|
||||||
#endif
|
void gtimerJab(GTimer *pt);
|
||||||
|
|
||||||
#endif /* GFX_USE_GTIMER */
|
/**
|
||||||
|
* @brief Jab a timer causing the current period to immediate expire
|
||||||
#endif /* _GTIMER_H */
|
* @details The callback function will be called as soon as possible.
|
||||||
/** @} */
|
*
|
||||||
|
* @pre Use from an interrupt routine context.
|
||||||
|
*
|
||||||
|
* @param[in] pt Pointer to a GTimer structure
|
||||||
|
*
|
||||||
|
* @note If the timer is not active this does nothing.
|
||||||
|
* @note Repeated Jabs before the callback function actually happens are ignored.
|
||||||
|
*
|
||||||
|
* @iclass
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
void gtimerJabI(GTimer *pt);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* GFX_USE_GTIMER */
|
||||||
|
|
||||||
|
#endif /* _GTIMER_H */
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,22 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/gwin/button.h
|
||||||
|
* @brief GWIN Graphic window subsystem header file.
|
||||||
|
*
|
||||||
|
* @defgroup Button Button
|
||||||
|
* @ingroup GWIN
|
||||||
|
*
|
||||||
|
* @details GWIN allows it to easily create buttons with different styles
|
||||||
|
* and check for different meta states such as: PRESSED, CLICKED,
|
||||||
|
* RELEASED etc.
|
||||||
|
*
|
||||||
|
* @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h
|
||||||
|
* @pre GWIN_NEED_BUTTON must be set to TRUE in your gfxconf.h
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _GWIN_BUTTON_H
|
#ifndef _GWIN_BUTTON_H
|
||||||
#define _GWIN_BUTTON_H
|
#define _GWIN_BUTTON_H
|
||||||
|
|
||||||
|
|
|
@ -4,113 +4,129 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GWIN_CONSOLE_H
|
/**
|
||||||
#define _GWIN_CONSOLE_H
|
* @file include/gwin/console.h
|
||||||
|
* @brief GWIN Graphic window subsystem header file.
|
||||||
#if GWIN_NEED_CONSOLE || defined(__DOXYGEN__)
|
*
|
||||||
|
* @defgroup Console Console
|
||||||
/*===========================================================================*/
|
* @ingroup GWIN
|
||||||
/* Driver constants. */
|
*
|
||||||
/*===========================================================================*/
|
* @details GWIN allows it to create a console/terminal like window.
|
||||||
|
* You can simply use chprintf() to print to the terminal.
|
||||||
#define GW_CONSOLE 0x0001
|
*
|
||||||
|
* @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h
|
||||||
/*===========================================================================*/
|
* @pre GWIN_NEED_CONSOLE must be set to TRUE in your gfxconf.h
|
||||||
/* Type definitions */
|
*
|
||||||
/*===========================================================================*/
|
* @{
|
||||||
|
*/
|
||||||
// A console window. Supports wrapped text writing and a cursor.
|
|
||||||
typedef struct GConsoleObject_t {
|
#ifndef _GWIN_CONSOLE_H
|
||||||
GWindowObject gwin;
|
#define _GWIN_CONSOLE_H
|
||||||
|
|
||||||
struct GConsoleWindowStream_t {
|
#if GWIN_NEED_CONSOLE || defined(__DOXYGEN__)
|
||||||
const struct GConsoleWindowVMT_t *vmt;
|
|
||||||
_base_asynchronous_channel_data
|
/*===========================================================================*/
|
||||||
} stream;
|
/* Driver constants. */
|
||||||
|
/*===========================================================================*/
|
||||||
coord_t cx,cy; // Cursor position
|
|
||||||
uint8_t fy; // Current font height
|
#define GW_CONSOLE 0x0001
|
||||||
uint8_t fp; // Current font inter-character spacing
|
|
||||||
} GConsoleObject;
|
/*===========================================================================*/
|
||||||
|
/* Type definitions */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* External declarations. */
|
|
||||||
/*===========================================================================*/
|
// A console window. Supports wrapped text writing and a cursor.
|
||||||
|
typedef struct GConsoleObject_t {
|
||||||
#ifdef __cplusplus
|
GWindowObject gwin;
|
||||||
extern "C" {
|
|
||||||
#endif
|
struct GConsoleWindowStream_t {
|
||||||
|
const struct GConsoleWindowVMT_t *vmt;
|
||||||
/**
|
_base_asynchronous_channel_data
|
||||||
* @brief Create a console window.
|
} stream;
|
||||||
* @details A console window allows text to be written using chprintf() (and the console functions defined here).
|
|
||||||
* @brief Text in a console window supports newlines and will wrap text as required.
|
coord_t cx,cy; // Cursor position
|
||||||
* @return NULL if there is no resultant drawing area, otherwise a window handle.
|
uint8_t fy; // Current font height
|
||||||
*
|
uint8_t fp; // Current font inter-character spacing
|
||||||
* @param[in] gc The GConsoleObject structure to initialise. If this is NULL the structure is dynamically allocated.
|
} GConsoleObject;
|
||||||
* @param[in] x,y The screen co-ordinates for the bottom left corner of the window
|
|
||||||
* @param[in] width The width of the window
|
/*===========================================================================*/
|
||||||
* @param[in] height The height of the window
|
/* External declarations. */
|
||||||
* @param[in] font The font to use
|
/*===========================================================================*/
|
||||||
* @note The console is not automatically cleared on creation. You must do that by calling gwinClear() (possibly after changing your background color)
|
|
||||||
* @note If the dispay does not support scrolling, the window will be cleared when the bottom line is reached.
|
#ifdef __cplusplus
|
||||||
* @note The default drawing color gets set to White and the background drawing color to Black.
|
extern "C" {
|
||||||
* @note The dimensions and position may be changed to fit on the real screen.
|
#endif
|
||||||
*
|
|
||||||
* @api
|
/**
|
||||||
*/
|
* @brief Create a console window.
|
||||||
GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height, font_t font);
|
* @details A console window allows text to be written using chprintf() (and the console functions defined here).
|
||||||
|
* @brief Text in a console window supports newlines and will wrap text as required.
|
||||||
/**
|
* @return NULL if there is no resultant drawing area, otherwise a window handle.
|
||||||
* @brief Get a stream from a console window suitable for use with chprintf().
|
*
|
||||||
* @return The stream handle or NULL if this is not a console window.
|
* @param[in] gc The GConsoleObject structure to initialise. If this is NULL the structure is dynamically allocated.
|
||||||
*
|
* @param[in] x,y The screen co-ordinates for the bottom left corner of the window
|
||||||
* @param[in] gh The window handle (must be a console window)
|
* @param[in] width The width of the window
|
||||||
*
|
* @param[in] height The height of the window
|
||||||
* @api
|
* @param[in] font The font to use
|
||||||
*/
|
* @note The console is not automatically cleared on creation. You must do that by calling gwinClear() (possibly after changing your background color)
|
||||||
BaseSequentialStream *gwinGetConsoleStream(GHandle gh);
|
* @note If the dispay does not support scrolling, the window will be cleared when the bottom line is reached.
|
||||||
|
* @note The default drawing color gets set to White and the background drawing color to Black.
|
||||||
/**
|
* @note The dimensions and position may be changed to fit on the real screen.
|
||||||
* @brief Put a character at the cursor position in the window.
|
*
|
||||||
* @note Uses the current foreground color to draw the character and fills the background using the background drawing color
|
* @api
|
||||||
*
|
*/
|
||||||
* @param[in] gh The window handle (must be a console window)
|
GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height, font_t font);
|
||||||
* @param[in] c The character to draw
|
|
||||||
*
|
/**
|
||||||
* @api
|
* @brief Get a stream from a console window suitable for use with chprintf().
|
||||||
*/
|
* @return The stream handle or NULL if this is not a console window.
|
||||||
void gwinPutChar(GHandle gh, char c);
|
*
|
||||||
|
* @param[in] gh The window handle (must be a console window)
|
||||||
/**
|
*
|
||||||
* @brief Put a string at the cursor position in the window. It will wrap lines as required.
|
* @api
|
||||||
* @note Uses the current foreground color to draw the string and fills the background using the background drawing color
|
*/
|
||||||
*
|
BaseSequentialStream *gwinGetConsoleStream(GHandle gh);
|
||||||
* @param[in] gh The window handle (must be a console window)
|
|
||||||
* @param[in] str The string to draw
|
/**
|
||||||
*
|
* @brief Put a character at the cursor position in the window.
|
||||||
* @api
|
* @note Uses the current foreground color to draw the character and fills the background using the background drawing color
|
||||||
*/
|
*
|
||||||
void gwinPutString(GHandle gh, const char *str);
|
* @param[in] gh The window handle (must be a console window)
|
||||||
|
* @param[in] c The character to draw
|
||||||
/**
|
*
|
||||||
* @brief Put the character array at the cursor position in the window. It will wrap lines as required.
|
* @api
|
||||||
* @note Uses the current foreground color to draw the string and fills the background using the background drawing color
|
*/
|
||||||
*
|
void gwinPutChar(GHandle gh, char c);
|
||||||
* @param[in] gh The window handle (must be a console window)
|
|
||||||
* @param[in] str The string to draw
|
/**
|
||||||
* @param[in] n The number of characters to draw
|
* @brief Put a string at the cursor position in the window. It will wrap lines as required.
|
||||||
*
|
* @note Uses the current foreground color to draw the string and fills the background using the background drawing color
|
||||||
* @api
|
*
|
||||||
*/
|
* @param[in] gh The window handle (must be a console window)
|
||||||
void gwinPutCharArray(GHandle gh, const char *str, size_t n);
|
* @param[in] str The string to draw
|
||||||
|
*
|
||||||
#ifdef __cplusplus
|
* @api
|
||||||
}
|
*/
|
||||||
#endif
|
void gwinPutString(GHandle gh, const char *str);
|
||||||
|
|
||||||
#endif /* GWIN_NEED_CONSOLE */
|
/**
|
||||||
|
* @brief Put the character array at the cursor position in the window. It will wrap lines as required.
|
||||||
#endif /* _GWIN_CONSOLE_H */
|
* @note Uses the current foreground color to draw the string and fills the background using the background drawing color
|
||||||
/** @} */
|
*
|
||||||
|
* @param[in] gh The window handle (must be a console window)
|
||||||
|
* @param[in] str The string to draw
|
||||||
|
* @param[in] n The number of characters to draw
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
void gwinPutCharArray(GHandle gh, const char *str, size_t n);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* GWIN_NEED_CONSOLE */
|
||||||
|
|
||||||
|
#endif /* _GWIN_CONSOLE_H */
|
||||||
|
/** @} */
|
||||||
|
|
|
@ -5,6 +5,24 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/gwin/gwin.h
|
||||||
|
* @brief GWIN Graphic window subsystem header file.
|
||||||
|
*
|
||||||
|
* @defgroup Window Window
|
||||||
|
* @ingroup GWIN
|
||||||
|
*
|
||||||
|
* @details GWIN provides a basic window manager which allows it to easily
|
||||||
|
* create and destroy different windows on runtime. Each window
|
||||||
|
* will have it's own properties such as colors, brushes as well as
|
||||||
|
* it's own drawing origin.
|
||||||
|
* Moving the windows around is not supported yet.
|
||||||
|
*
|
||||||
|
* @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _GWIN_H
|
#ifndef _GWIN_H
|
||||||
#define _GWIN_H
|
#define _GWIN_H
|
||||||
|
|
||||||
|
|
|
@ -4,30 +4,38 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
#ifndef _GWIN_INTERNAL_H
|
|
||||||
#define _GWIN_INTERNAL_H
|
/**
|
||||||
|
* @file include/gwin/internal.h
|
||||||
#if GFX_USE_GWIN || defined(__DOXYGEN__)
|
* @brief GWIN Graphic window subsystem header file.
|
||||||
|
*
|
||||||
/*===========================================================================*/
|
* @addtogroup GWIN
|
||||||
/* Sub-system constants. */
|
* @{
|
||||||
/*===========================================================================*/
|
*/
|
||||||
|
#ifndef _GWIN_INTERNAL_H
|
||||||
#define GWIN_FLG_DYNAMIC 0x0001
|
#define _GWIN_INTERNAL_H
|
||||||
#define GBTN_FLG_ALLOCTXT 0x0002
|
|
||||||
#define GWIN_FIRST_CONTROL_FLAG 0x0004
|
#if GFX_USE_GWIN || defined(__DOXYGEN__)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
/*===========================================================================*/
|
||||||
extern "C" {
|
/* Sub-system constants. */
|
||||||
#endif
|
/*===========================================================================*/
|
||||||
|
|
||||||
GHandle _gwinInit(GWindowObject *gw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size);
|
#define GWIN_FLG_DYNAMIC 0x0001
|
||||||
|
#define GBTN_FLG_ALLOCTXT 0x0002
|
||||||
#ifdef __cplusplus
|
#define GWIN_FIRST_CONTROL_FLAG 0x0004
|
||||||
}
|
|
||||||
#endif
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
#endif /* GFX_USE_GWIN */
|
#endif
|
||||||
|
|
||||||
#endif /* _GWIN_INTERNAL_H */
|
GHandle _gwinInit(GWindowObject *gw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size);
|
||||||
/** @} */
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* GFX_USE_GWIN */
|
||||||
|
|
||||||
|
#endif /* _GWIN_INTERNAL_H */
|
||||||
|
/** @} */
|
||||||
|
|
|
@ -5,6 +5,20 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/gwin/slider.h
|
||||||
|
* @brief GWIN Graphic window subsystem header file.
|
||||||
|
*
|
||||||
|
* @defgroup Slider Slider
|
||||||
|
* @ingroup GWIN
|
||||||
|
*
|
||||||
|
* @details Create sliders with different styles
|
||||||
|
*
|
||||||
|
* @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h
|
||||||
|
* @pre GWIN_NEED_SLIDER must be set to TRUE in your gfxconf.h
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _GWIN_SLIDER_H
|
#ifndef _GWIN_SLIDER_H
|
||||||
#define _GWIN_SLIDER_H
|
#define _GWIN_SLIDER_H
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,16 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file src/gwin/button.c
|
||||||
|
* @brief GWIN sub-system button code.
|
||||||
|
*
|
||||||
|
* @defgroup Button Button
|
||||||
|
* @ingroup GWIN
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include "gfx.h"
|
#include "gfx.h"
|
||||||
|
|
|
@ -4,133 +4,143 @@
|
||||||
*
|
*
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ch.h"
|
/**
|
||||||
#include "hal.h"
|
* @file src/gwin/console.c
|
||||||
#include "gfx.h"
|
* @brief GWIN sub-system console code.
|
||||||
|
*
|
||||||
#if (GFX_USE_GWIN && GWIN_NEED_CONSOLE) || defined(__DOXYGEN__)
|
* @defgroup Console Console
|
||||||
|
* @ingroup GWIN
|
||||||
#include <string.h>
|
*
|
||||||
|
* @{
|
||||||
#include "gwin/internal.h"
|
*/
|
||||||
|
|
||||||
#define GWIN_CONSOLE_USE_CLEAR_LINES TRUE
|
#include "ch.h"
|
||||||
#define GWIN_CONSOLE_USE_FILLED_CHARS FALSE
|
#include "hal.h"
|
||||||
|
#include "gfx.h"
|
||||||
/*
|
|
||||||
* Stream interface implementation. The interface is write only
|
#if (GFX_USE_GWIN && GWIN_NEED_CONSOLE) || defined(__DOXYGEN__)
|
||||||
*/
|
|
||||||
|
#include <string.h>
|
||||||
#define Stream2GWindow(ip) ((GHandle)(((char *)(ip)) - (size_t)(&(((GConsoleObject *)0)->stream))))
|
|
||||||
|
#include "gwin/internal.h"
|
||||||
static size_t GWinStreamWrite(void *ip, const uint8_t *bp, size_t n) { gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return RDY_OK; }
|
|
||||||
static size_t GWinStreamRead(void *ip, uint8_t *bp, size_t n) { (void)ip; (void)bp; (void)n; return 0; }
|
#define GWIN_CONSOLE_USE_CLEAR_LINES TRUE
|
||||||
static msg_t GWinStreamPut(void *ip, uint8_t b) { gwinPutChar(Stream2GWindow(ip), (char)b); return RDY_OK; }
|
#define GWIN_CONSOLE_USE_FILLED_CHARS FALSE
|
||||||
static msg_t GWinStreamGet(void *ip) {(void)ip; return RDY_OK; }
|
|
||||||
static msg_t GWinStreamPutTimed(void *ip, uint8_t b, systime_t time) { (void)time; gwinPutChar(Stream2GWindow(ip), (char)b); return RDY_OK; }
|
/*
|
||||||
static msg_t GWinStreamGetTimed(void *ip, systime_t timeout) { (void)ip; (void)timeout; return RDY_OK; }
|
* Stream interface implementation. The interface is write only
|
||||||
static size_t GWinStreamWriteTimed(void *ip, const uint8_t *bp, size_t n, systime_t time) { (void)time; gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return RDY_OK; }
|
*/
|
||||||
static size_t GWinStreamReadTimed(void *ip, uint8_t *bp, size_t n, systime_t time) { (void)ip; (void)bp; (void)n; (void)time; return 0; }
|
|
||||||
|
#define Stream2GWindow(ip) ((GHandle)(((char *)(ip)) - (size_t)(&(((GConsoleObject *)0)->stream))))
|
||||||
struct GConsoleWindowVMT_t {
|
|
||||||
_base_asynchronous_channel_methods
|
static size_t GWinStreamWrite(void *ip, const uint8_t *bp, size_t n) { gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return RDY_OK; }
|
||||||
};
|
static size_t GWinStreamRead(void *ip, uint8_t *bp, size_t n) { (void)ip; (void)bp; (void)n; return 0; }
|
||||||
|
static msg_t GWinStreamPut(void *ip, uint8_t b) { gwinPutChar(Stream2GWindow(ip), (char)b); return RDY_OK; }
|
||||||
static const struct GConsoleWindowVMT_t GWindowConsoleVMT = {
|
static msg_t GWinStreamGet(void *ip) {(void)ip; return RDY_OK; }
|
||||||
GWinStreamWrite,
|
static msg_t GWinStreamPutTimed(void *ip, uint8_t b, systime_t time) { (void)time; gwinPutChar(Stream2GWindow(ip), (char)b); return RDY_OK; }
|
||||||
GWinStreamRead,
|
static msg_t GWinStreamGetTimed(void *ip, systime_t timeout) { (void)ip; (void)timeout; return RDY_OK; }
|
||||||
GWinStreamPut,
|
static size_t GWinStreamWriteTimed(void *ip, const uint8_t *bp, size_t n, systime_t time) { (void)time; gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return RDY_OK; }
|
||||||
GWinStreamGet,
|
static size_t GWinStreamReadTimed(void *ip, uint8_t *bp, size_t n, systime_t time) { (void)ip; (void)bp; (void)n; (void)time; return 0; }
|
||||||
GWinStreamPutTimed,
|
|
||||||
GWinStreamGetTimed,
|
struct GConsoleWindowVMT_t {
|
||||||
GWinStreamWriteTimed,
|
_base_asynchronous_channel_methods
|
||||||
GWinStreamReadTimed
|
};
|
||||||
};
|
|
||||||
|
static const struct GConsoleWindowVMT_t GWindowConsoleVMT = {
|
||||||
GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height, font_t font) {
|
GWinStreamWrite,
|
||||||
if (!(gc = (GConsoleObject *)_gwinInit((GWindowObject *)gc, x, y, width, height, sizeof(GConsoleObject))))
|
GWinStreamRead,
|
||||||
return 0;
|
GWinStreamPut,
|
||||||
gc->gwin.type = GW_CONSOLE;
|
GWinStreamGet,
|
||||||
gwinSetFont(&gc->gwin, font);
|
GWinStreamPutTimed,
|
||||||
gc->stream.vmt = &GWindowConsoleVMT;
|
GWinStreamGetTimed,
|
||||||
gc->cx = 0;
|
GWinStreamWriteTimed,
|
||||||
gc->cy = 0;
|
GWinStreamReadTimed
|
||||||
return (GHandle)gc;
|
};
|
||||||
}
|
|
||||||
|
GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height, font_t font) {
|
||||||
BaseSequentialStream *gwinGetConsoleStream(GHandle gh) {
|
if (!(gc = (GConsoleObject *)_gwinInit((GWindowObject *)gc, x, y, width, height, sizeof(GConsoleObject))))
|
||||||
if (gh->type != GW_CONSOLE)
|
return 0;
|
||||||
return 0;
|
gc->gwin.type = GW_CONSOLE;
|
||||||
return (BaseSequentialStream *)&(((GConsoleObject *)(gh))->stream);
|
gwinSetFont(&gc->gwin, font);
|
||||||
}
|
gc->stream.vmt = &GWindowConsoleVMT;
|
||||||
|
gc->cx = 0;
|
||||||
void gwinPutChar(GHandle gh, char c) {
|
gc->cy = 0;
|
||||||
uint8_t width;
|
return (GHandle)gc;
|
||||||
#define gcw ((GConsoleObject *)gh)
|
}
|
||||||
|
|
||||||
if (gh->type != GW_CONSOLE || !gh->font) return;
|
BaseSequentialStream *gwinGetConsoleStream(GHandle gh) {
|
||||||
|
if (gh->type != GW_CONSOLE)
|
||||||
#if GDISP_NEED_CLIP
|
return 0;
|
||||||
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
|
return (BaseSequentialStream *)&(((GConsoleObject *)(gh))->stream);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
if (c == '\n') {
|
void gwinPutChar(GHandle gh, char c) {
|
||||||
gcw->cx = 0;
|
uint8_t width;
|
||||||
gcw->cy += gcw->fy;
|
#define gcw ((GConsoleObject *)gh)
|
||||||
// We use lazy scrolling here and only scroll when the next char arrives
|
|
||||||
} else if (c == '\r') {
|
if (gh->type != GW_CONSOLE || !gh->font) return;
|
||||||
// gcw->cx = 0;
|
|
||||||
} else {
|
#if GDISP_NEED_CLIP
|
||||||
width = gdispGetCharWidth(c, gh->font) + gcw->fp;
|
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
|
||||||
if (gcw->cx + width >= gh->width) {
|
#endif
|
||||||
gcw->cx = 0;
|
|
||||||
gcw->cy += gcw->fy;
|
if (c == '\n') {
|
||||||
}
|
gcw->cx = 0;
|
||||||
|
gcw->cy += gcw->fy;
|
||||||
if (gcw->cy + gcw->fy > gh->height) {
|
// We use lazy scrolling here and only scroll when the next char arrives
|
||||||
#if GDISP_NEED_SCROLL
|
} else if (c == '\r') {
|
||||||
/* scroll the console */
|
// gcw->cx = 0;
|
||||||
gdispVerticalScroll(gh->x, gh->y, gh->width, gh->height, gcw->fy, gh->bgcolor);
|
} else {
|
||||||
/* reset the cursor to the start of the last line */
|
width = gdispGetCharWidth(c, gh->font) + gcw->fp;
|
||||||
gcw->cx = 0;
|
if (gcw->cx + width >= gh->width) {
|
||||||
gcw->cy = (((coord_t)(gh->height/gcw->fy))-1)*gcw->fy;
|
gcw->cx = 0;
|
||||||
#else
|
gcw->cy += gcw->fy;
|
||||||
/* clear the console */
|
}
|
||||||
gdispFillArea(gh->x, gh->y, gh->width, gh->height, gh->bgcolor);
|
|
||||||
/* reset the cursor to the top of the window */
|
if (gcw->cy + gcw->fy > gh->height) {
|
||||||
gcw->cx = 0;
|
#if GDISP_NEED_SCROLL
|
||||||
gcw->cy = 0;
|
/* scroll the console */
|
||||||
#endif
|
gdispVerticalScroll(gh->x, gh->y, gh->width, gh->height, gcw->fy, gh->bgcolor);
|
||||||
}
|
/* reset the cursor to the start of the last line */
|
||||||
|
gcw->cx = 0;
|
||||||
#if GWIN_CONSOLE_USE_CLEAR_LINES
|
gcw->cy = (((coord_t)(gh->height/gcw->fy))-1)*gcw->fy;
|
||||||
/* clear to the end of the line */
|
#else
|
||||||
if (gcw->cx == 0)
|
/* clear the console */
|
||||||
gdispFillArea(gh->x, gh->y + gcw->cy, gh->width, gcw->fy, gh->bgcolor);
|
gdispFillArea(gh->x, gh->y, gh->width, gh->height, gh->bgcolor);
|
||||||
#endif
|
/* reset the cursor to the top of the window */
|
||||||
#if GWIN_CONSOLE_USE_FILLED_CHARS
|
gcw->cx = 0;
|
||||||
gdispFillChar(gh->x + gcw->cx, gh->y + gcw->cy, c, gh->font, gh->color, gh->bgcolor);
|
gcw->cy = 0;
|
||||||
#else
|
#endif
|
||||||
gdispDrawChar(gh->x + gcw->cx, gh->y + gcw->cy, c, gh->font, gh->color);
|
}
|
||||||
#endif
|
|
||||||
|
#if GWIN_CONSOLE_USE_CLEAR_LINES
|
||||||
/* update cursor */
|
/* clear to the end of the line */
|
||||||
gcw->cx += width;
|
if (gcw->cx == 0)
|
||||||
}
|
gdispFillArea(gh->x, gh->y + gcw->cy, gh->width, gcw->fy, gh->bgcolor);
|
||||||
#undef gcw
|
#endif
|
||||||
}
|
#if GWIN_CONSOLE_USE_FILLED_CHARS
|
||||||
|
gdispFillChar(gh->x + gcw->cx, gh->y + gcw->cy, c, gh->font, gh->color, gh->bgcolor);
|
||||||
void gwinPutString(GHandle gh, const char *str) {
|
#else
|
||||||
while(*str)
|
gdispDrawChar(gh->x + gcw->cx, gh->y + gcw->cy, c, gh->font, gh->color);
|
||||||
gwinPutChar(gh, *str++);
|
#endif
|
||||||
}
|
|
||||||
|
/* update cursor */
|
||||||
void gwinPutCharArray(GHandle gh, const char *str, size_t n) {
|
gcw->cx += width;
|
||||||
while(n--)
|
}
|
||||||
gwinPutChar(gh, *str++);
|
#undef gcw
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* GFX_USE_GWIN && GWIN_NEED_CONSOLE */
|
void gwinPutString(GHandle gh, const char *str) {
|
||||||
/** @} */
|
while(*str)
|
||||||
|
gwinPutChar(gh, *str++);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gwinPutCharArray(GHandle gh, const char *str, size_t n) {
|
||||||
|
while(n--)
|
||||||
|
gwinPutChar(gh, *str++);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* GFX_USE_GWIN && GWIN_NEED_CONSOLE */
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,16 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file src/gwin/graph.c
|
||||||
|
* @brief GWIN sub-system button code.
|
||||||
|
*
|
||||||
|
* @defgroup Graph Graph
|
||||||
|
* @ingroup GWIN
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include "gfx.h"
|
#include "gfx.h"
|
||||||
|
|
|
@ -5,6 +5,16 @@
|
||||||
* http://chibios-gfx.com/license.html
|
* http://chibios-gfx.com/license.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file src/gwin/slider.c
|
||||||
|
* @brief GWIN sub-system slider code.
|
||||||
|
*
|
||||||
|
* @defgroup Slider Slider
|
||||||
|
* @ingroup GWIN
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include "gfx.h"
|
#include "gfx.h"
|
||||||
|
|
Loading…
Add table
Reference in a new issue