| ||||||
HiTechnic Sensor MUX Sensor
| #define __HTSMUX_SUPPORT__ |
Definition at line 38 of file hitechnic-sensormux.h.
| #define HTSMUX_AN_ENTRY_SIZE 0x02 |
Number of registers per analogue channel
Definition at line 71 of file hitechnic-sensormux.h.
| #define HTSMUX_ANALOG 0x36 |
Analogue upper 8 bits register
Definition at line 70 of file hitechnic-sensormux.h.
| #define HTSMUX_BF_ENTRY_SIZE 0x10 |
Number of registers per buffer
Definition at line 74 of file hitechnic-sensormux.h.
| #define HTSMUX_CH_ENTRY_SIZE 0x05 |
Number of registers per sensor channel
Definition at line 68 of file hitechnic-sensormux.h.
| #define HTSMUX_CH_OFFSET 0x22 |
Channel register offset
Definition at line 67 of file hitechnic-sensormux.h.
| #define HTSMUX_CHAN_9V 0x02 |
Enable 9v supply on analogue pin channel mode
Definition at line 93 of file hitechnic-sensormux.h.
| #define HTSMUX_CHAN_DIG0_HIGH 0x04 |
Drive pin 0 high channel mode
Definition at line 94 of file hitechnic-sensormux.h.
| #define HTSMUX_CHAN_DIG1_HIGH 0x08 |
Drive pin 1 high channel mode
Definition at line 95 of file hitechnic-sensormux.h.
| #define HTSMUX_CHAN_I2C 0x01 |
I2C channel present channel mode
Definition at line 92 of file hitechnic-sensormux.h.
| #define HTSMUX_CHAN_I2C_SLOW 0x10 |
Set slow I2C rate channel mode Sensor types as detected by SMUX
Definition at line 96 of file hitechnic-sensormux.h.
| #define HTSMUX_CHAN_NONE 0x00 |
Nothing configured - analogue sensor
Definition at line 91 of file hitechnic-sensormux.h.
| #define HTSMUX_CMD_AUTODETECT 0x01 |
Start auto-detect function command
Definition at line 79 of file hitechnic-sensormux.h.
| #define HTSMUX_CMD_HALT 0x00 |
Halt multiplexer command
Definition at line 78 of file hitechnic-sensormux.h.
| #define HTSMUX_CMD_RUN 0x02 |
Start normal multiplexer operation command
Definition at line 80 of file hitechnic-sensormux.h.
| #define HTSMUX_COMMAND 0x20 |
Command register
Definition at line 58 of file hitechnic-sensormux.h.
| #define HTSMUX_I2C_ADDR 0x10 |
HTSMUX I2C device address
Definition at line 57 of file hitechnic-sensormux.h.
| #define HTSMUX_I2C_BUF 0x40 |
I2C buffer register offset
Definition at line 73 of file hitechnic-sensormux.h.
| #define HTSMUX_I2C_COUNT 0x02 |
I2C byte count register
Definition at line 64 of file hitechnic-sensormux.h.
| #define HTSMUX_I2C_DADDR 0x03 |
I2C device address register
Definition at line 65 of file hitechnic-sensormux.h.
| #define HTSMUX_I2C_MADDR 0x04 |
I2C memory address register
Definition at line 66 of file hitechnic-sensormux.h.
| #define HTSMUX_MODE 0x00 |
Sensor mode register
Definition at line 62 of file hitechnic-sensormux.h.
| #define HTSMUX_STAT_BATT 0x01 |
No battery voltage detected status
Definition at line 84 of file hitechnic-sensormux.h.
| #define HTSMUX_STAT_BUSY 0x02 |
Auto-dected in progress status
Definition at line 85 of file hitechnic-sensormux.h.
| #define HTSMUX_STAT_ERROR 0x08 |
Command error detected status
Definition at line 87 of file hitechnic-sensormux.h.
| #define HTSMUX_STAT_HALT 0x04 |
Multiplexer is halted status
Definition at line 86 of file hitechnic-sensormux.h.
| #define HTSMUX_STAT_NORMAL 0x00 |
Nothing going on, everything's fine
Definition at line 83 of file hitechnic-sensormux.h.
| #define HTSMUX_STAT_NOTHING 0xFF |
Status hasn't really been set yet
Definition at line 88 of file hitechnic-sensormux.h.
| #define HTSMUX_STATUS 0x21 |
Status register
Definition at line 59 of file hitechnic-sensormux.h.
| #define HTSMUX_TYPE 0x01 |
Sensor type register
Definition at line 63 of file hitechnic-sensormux.h.
| #define MPORT | ( | X ) | (X % 4) |
Convert tMUXSensor to MUX port number
Definition at line 45 of file hitechnic-sensormux.h.
| #define SPORT | ( | X ) | (X / 4) |
Convert tMUXSensor to sensor port number
Definition at line 41 of file hitechnic-sensormux.h.
| typedef ubyte tConfigParams[4] |
Array to hold SMUX channel info
Definition at line 148 of file hitechnic-sensormux.h.
| enum HTSMUXSensorType |
| HTSMUXAnalogue | |
| HTSMUXLegoUS | |
| HTSMUXCompass | |
| HTSMUXColor | |
| HTSMUXAccel | |
| HTSMUXIRSeeker | |
| HTSMUXProto | |
| HTSMUXColorNew | |
| HTSMUXAngle | |
| HTSMUXIRSeekerNew | |
| HTSMUXSensorCustom | |
| HTSMUXSensorNone |
Definition at line 100 of file hitechnic-sensormux.h.
| enum tMUXSensor |
Definition at line 116 of file hitechnic-sensormux.h.
| bool HTSMUXconfigChannel | ( | tMUXSensor | muxsensor, |
| tConfigParams & | configparams | ||
| ) |
Configure the SMUX for a specific sensor.
The parameters are as follows:
| muxsensor | the SMUX sensor port number |
| configparams | parameters for the channel's configuration |
Definition at line 414 of file hitechnic-sensormux.h.
| int HTSMUXreadAnalogue | ( | tMUXSensor | muxsensor ) |
Read the value returned by the sensor attached the SMUX. This function is for analogue sensors.
| muxsensor | the SMUX sensor port number |
Definition at line 344 of file hitechnic-sensormux.h.
| bool HTSMUXreadPort | ( | tMUXSensor | muxsensor, |
| tByteArray & | result, | ||
| int | numbytes, | ||
| int | offset | ||
| ) |
Read the value returned by the sensor attached the SMUX. This function is for I2C sensors.
| muxsensor | the SMUX sensor port number |
| result | array to hold values returned from SMUX |
| numbytes | the size of the I2C reply |
| offset | the offset used to start reading from |
Definition at line 317 of file hitechnic-sensormux.h.
| bool HTSMUXreadPowerStatus | ( | tSensors | link ) |
Check if the battery is low
| link | the SMUX port number |
Definition at line 394 of file hitechnic-sensormux.h.
| HTSMUXSensorType HTSMUXreadSensorType | ( | tMUXSensor | muxsensor ) |
Get the sensor type attached to specified SMUX port
| muxsensor | the SMUX sensor port number |
Definition at line 196 of file hitechnic-sensormux.h.
| byte HTSMUXreadStatus | ( | tSensors | link ) |
Read the status of the SMUX
The status byte is made up of the following bits:
| D7 | D6 | D4 | D3 | D2 | D1 | D1 |
| link | the SMUX port number |
Definition at line 177 of file hitechnic-sensormux.h.
| bool HTSMUXsendCommand | ( | tSensors | link, |
| byte | command | ||
| ) |
Send a command to the SMUX.
command can be one of the following:
in progress.
| link | the SMUX port number |
| command | the command to be sent to the SMUX |
Definition at line 284 of file hitechnic-sensormux.h.
| void HTSMUXsensorTypeToString | ( | HTSMUXSensorType | muxsensor, |
| string & | sensorName | ||
| ) |
Return a string for the sensor type.
| muxsensor | the SMUX sensor port number |
| sensorName | the string to hold the name of the sensor. |
Definition at line 372 of file hitechnic-sensormux.h.
| bool HTSMUXsetAnalogueActive | ( | tMUXSensor | muxsensor ) |
Set the mode of an analogue channel to Active (turn the light on)
| muxsensor | the SMUX sensor port number |
Definition at line 244 of file hitechnic-sensormux.h.
| bool HTSMUXsetAnalogueInactive | ( | tMUXSensor | muxsensor ) |
Set the mode of an analogue channel to Inactive (turn the light off)
| muxsensor | the SMUX sensor port number |
Definition at line 260 of file hitechnic-sensormux.h.
| bool HTSMUXsetMode | ( | tMUXSensor | muxsensor, |
| byte | mode | ||
| ) |
Set the mode of a SMUX channel.
Mode can be one or more of the following:
| muxsensor | the SMUX sensor port number |
| mode | the mode to set the channel to |
Definition at line 214 of file hitechnic-sensormux.h.
| tConfigParams Analogue_config = {HTSMUX_CHAN_NONE, 0, 0, 0} |
Array to hold SMUX config data for sensor
Definition at line 150 of file hitechnic-sensormux.h.
Array to hold I2C reply data
Definition at line 146 of file hitechnic-sensormux.h.
Array to hold I2C command data
Definition at line 145 of file hitechnic-sensormux.h.
{HTSMUXSensorNone, HTSMUXSensorNone, HTSMUXSensorNone, HTSMUXSensorNone,
HTSMUXSensorNone, HTSMUXSensorNone, HTSMUXSensorNone, HTSMUXSensorNone,
HTSMUXSensorNone, HTSMUXSensorNone, HTSMUXSensorNone, HTSMUXSensorNone,
HTSMUXSensorNone, HTSMUXSensorNone, HTSMUXSensorNone, HTSMUXSensorNone}
Definition at line 140 of file hitechnic-sensormux.h.
| ubyte HTSMUXstatus[4] = {HTSMUX_STAT_NOTHING, HTSMUX_STAT_NOTHING, HTSMUX_STAT_NOTHING, HTSMUX_STAT_NOTHING} |
Array for holding sensor types
Definition at line 137 of file hitechnic-sensormux.h.
1.7.2