package josx.platform.rcx; /** * LCD routines. */ public class LCD { private LCD() { } /** * Shows an unsigned number on the LCD. * No need to refresh. * * @param aValue An unsigned number in [0, 9999]. */ public static void showNumber (int aValue) { setNumber (0x301f, aValue, 0x3002); refresh(); } /** * Shows an digit in the Program section of the LCD. * No need to refresh. * * @param aValue A number in [0, 9]. */ public static void showProgramNumber (int aValue) { setNumber (0x3017, aValue, 0); refresh(); } /** * Sets a number to be displayed in the LCD. * It does not show up until refresh() is called. * @param aCode SIGNED=0x3001, PROGRAM=0x3017, UNSIGNED=0x301f * @param aValue The value to be displayed. * @param aPoint 0x3002 - 0x3005, indicating decimal point location. */ public static void setNumber (int aCode, int aValue, int aPoint) { ROM.call ((short) 0x1ff2, (short) aCode, (short) aValue, (short) aPoint); } /** * Refreshes LCD. Has to be called for certain LCD methods * to take effect. */ public static void refresh() { ROM.call ((short) 0x27c8); } /** * Sets an LCD segment. Requires refresh. * @param aCode One of the following numbers:

* STANDING 0x3006
* WALKING 0x3007
* SENSOR_0_VIEW 0x3008
* SENSOR_0_ACTIVE 0x3009
* SENSOR_1_VIEW 0x300a
* SENSOR_1_ACTIVE 0x300b
* SENSOR_2_VIEW 0x300c
* SENSOR_2_ACTIVE 0x300d
* MOTOR_0_VIEW 0x300e
* MOTOR_0_REV 0x300f
* MOTOR_0_FWD 0x3010
* MOTOR_1_VIEW 0x3011
* MOTOR_1_REV 0x3012
* MOTOR_1_FWD 0x3013
* MOTOR_2_VIEW 0x3014
* MOTOR_2_REV 0x3015
* MOTOR_2_FWD 0x3016
* DATALOG 0x3018
* DOWNLOAD 0x3019
* UPLOAD 0x301a
* BATTERY 0x301b
* RANGE_SHORT 0x301c
* RANGE_LONG 0x301d
* ALL 0x3020
* * @see josx.platform.rcx.LCD#clearSegment */ public static void setSegment (int aCode) { ROM.call ((short) 0x1b62, (short) aCode); } /** * Clears an LCD segment. Requires refresh. * @see josx.platform.rcx.LCD#setSegment */ public static void clearSegment (int aCode) { ROM.call ((short) 0x1e4a, (short) aCode); } /** * Clears the display. Requires refresh. */ public static void clear() { ROM.call ((short) 0x27ac); } }