Mindsensor PSPNx (http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=61) class. More...
#include <PSPNx.h>
Public Types | |
| enum | eButtons { SELECT = 1, LJ = 2, RJ = 4, START = 8, UP = 16, RIGHT = 32, DOWN = 64, LEFT = 128, L2 = 256, R2 = 512, L1 = 1024, R1 = 2048, TRIANGLE = 4096, CIRCLE = 8192, CROSS = 16384, SQUARE = 32768 } |
PSPNx buttons status mask. More... | |
Public Member Functions | |
| PSPNx (ePortS port, U8 address=PSPNx_DEFAULT_ADDRESS) | |
| Constructor (activate I2C). | |
| void | setAnalog (void) |
| Set the analog pad mode (analog/digital is mutually exclusive). | |
| void | setDigital (void) |
| Set the digital pad mode (analog/digital is mutually exclusive). | |
| void | setEnergize (bool enable) |
| Set the energize mode. | |
| void | setADPA (bool enable) |
| Set the ADPA mode. | |
| void | update (void) |
| Call regularly to poll the status of the PSPNx. | |
| bool | pressed (eButtons mask) const |
| Check the buttons pressed . | |
| bool | held (eButtons mask) const |
| Check the buttons held. | |
| bool | released (eButtons mask) const |
| Check the buttons released. | |
| VectorT< S8 > | getLeftStick (void) const |
| Get the left stick inputs. | |
| VectorT< S8 > | getRightStick (void) const |
| Get the reft stick inputs. | |
| void | get (U8 data[DATA_BUFFER_BYTE_SIZE]) const |
| Get raw I2C data from PSPNx. | |
Static Public Attributes | |
| static const U8 | PSPNx_DEFAULT_ADDRESS = 0x02 |
| PSPNx default address. | |
| static const U8 | DATA_BUFFER_BYTE_SIZE = 6 |
| Size of raw I2C data. | |
Mindsensor PSPNx (http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=61) class.
[ How to use with TOPPERS/ATK1(OSEK) ]
I2C (derived/compositted) class and Clock class internally use RTOS features. Thus, user needs to implement a C function and RTOS provided events.
+ Invoke SleeperMonitor function in user_1msec_isr_type2 hook.
void user_1ms_isr_type2(void)
{
SleeperMonitor(); // needed for I2C devices and Clock class
}
+ Define EventSleepI2C and EventSleep Events in user oil file.
EVENT EventSleepI2C
{
MASK = AUTO;
};
EVENT EventSleep
{
MASK = AUTO;
};
TASK TaskMain
{
AUTOSTART = TRUE
{
APPMODE = appmode1;
};
PRIORITY = 1;
ACTIVATION = 1;
SCHEDULE = FULL;
STACKSIZE = 512;
EVENT = EventSleepI2C; <- Here it is
EVENT = EventSleep; <- Here it is
};
[ How to use with TOPPERS/JSP(ITRON) ]
In case of using this class with TOPPERS/JSP(ITRON), RTOS specific definitions for the class are not needed.
PSPNx buttons status mask.
| ecrobot::PSPNx::PSPNx | ( | ePortS | port, | |
| U8 | address = PSPNx_DEFAULT_ADDRESS | |||
| ) | [explicit] |
Constructor (activate I2C).
Note:
This class must be constructed as a global object. Otherwise, a device assertion will be displayed
in the LCD when the object is constructed as a non global object.
When the object is destructed while the system is shut down, the device is de-activated automatically.
| void ecrobot::PSPNx::get | ( | U8 | data[DATA_BUFFER_BYTE_SIZE] | ) | const |
Get raw I2C data from PSPNx.
| data |
| VectorT<S8> ecrobot::PSPNx::getLeftStick | ( | void | ) | const |
Get the left stick inputs.
| - |
| VectorT<S8> ecrobot::PSPNx::getRightStick | ( | void | ) | const |
Get the reft stick inputs.
| - |
| bool ecrobot::PSPNx::held | ( | eButtons | mask | ) | const |
| bool ecrobot::PSPNx::pressed | ( | eButtons | mask | ) | const |
Check the buttons pressed
.
| mask | PSPNx buttons status mask |
| bool ecrobot::PSPNx::released | ( | eButtons | mask | ) | const |
Check the buttons released.
| mask | PSPNx buttons status mask |
| void ecrobot::PSPNx::setADPA | ( | bool | enable | ) |
Set the ADPA mode.
| enable | true:enable/false:disable ADPA mode |
| void ecrobot::PSPNx::setAnalog | ( | void | ) |
Set the analog pad mode (analog/digital is mutually exclusive).
| - |
| void ecrobot::PSPNx::setDigital | ( | void | ) |
Set the digital pad mode (analog/digital is mutually exclusive).
| - |
| void ecrobot::PSPNx::setEnergize | ( | bool | enable | ) |
Set the energize mode.
| enable | true:enable/false:disable energize mode |
| void ecrobot::PSPNx::update | ( | void | ) |
1.6.1