|
A lot of this is untested and very rough. For some reason I still can't get the
Spybot to send out RC messages to a Manas unit. Sending an RCX message (opcode
0xF7) is quite simple - either using the ROM subroutine SendRCXMessage or by
using the SendSerial command along with the SetTx stuff below.
#define Stack(n) @(0x120000 + (n))
__nolist void Push(const int v) { asm { 0xe3, v }; }
__nolist void Pop(const int n) { asm { 0x01, n }; }
__nolist void SetStack(const int i, const int &v) { Set(Stack(i), v); }
#define TIMER_RUNNING 1
#define TIMER_STOPPED 0
#define TimerState(n) @(0x130000 + (n))
__nolist void SetTimerState(const int n, const int s) { Set(TimerState(n), s);
}
#define EEPROM(n) @(0x140000 + (n))
__nolist void SetEEPROM(const int i, const int &d) { Set(EEPROM(i), d); }
#define CurrentTaskID() @(0x200000)
#define TxBufferData(n) @(0x210000 + (n)) // data for SendSerial
__nolist void SetTxBufferData(const int n, const int &v) { Set(TxBufferData(n),
v); }
#define TX_TYPE_SPYBOT 0
#define TX_TYPE_RCX 1
#define TX_TYPE_RC 2
#define TX_TYPE_USER 3
#define TxType() @(0x210010)
__nolist void SetTxType(const int &t) { Set(TxType(), t); }
#define TX_BAUD_2400 0
#define TX_BAUD_4800 1
#define TX_BAUD_9600 3
#define TxBaud() @(0x210011)
__nolist void SetTxBaud(const int &b) { Set(TxBaud(), b); }
#define TX_DIRECTION_FRONT_LEFT 0
#define TX_DIRECTION_FRONT_RIGHT 1
#define TX_DIRECTION_BACK 2
#define TX_DIRECTION_HIGH_POWER 3
#define TX_DIRECTION_PC 4
#define TxDirection() @(0x210012)
__nolist void SetTxDirection(const int &d) { Set(TxDirection(), d); }
#define TxUserPreamblePos() @(0x210013)
__nolist void SetTxUserPreamblePos(const int p) { Set(TxUserPreamblePos(), p);
}
#define TxUserPreambleLen() @(0x210014)
__nolist void SetTxUserPreambleLen(const int l) { Set(TxUserPreambleLen(), l);
}
#define TX_USER_NO_CHECKSUM 0
#define TX_USER_SUM_CHECKSUM 0x04
#define TX_USER_ZERO_SUM_CHECKSUM 0x08
#define TxUserChecksum() @(0x210015)
__nolist void SetTxUserChecksum(const int n) { Set(TxUserChecksum(), n); }
#define TX_USER_NO_BIPHASE 0
#define TX_USER_BIPHASE 1
#define TxUserBiPhase() @(0x210016)
__nolist void SetTxUserBiPhase(const int n) { Set(TxUserBiPhase(), n); }
#define MESSAGE_UNLOCK 0
#define MESSAGE_LOCK_IR 1
#define MESSAGE_LOCK_PC 2
#define MessageLock() @(0x210017)
__nolist void SetMessageLock(const int &l) { Set(MessageLock(), l); }
#define RxBufferIndex() @(0x210018)
#define MSG_RX_CHANNEL_IR 1
#define MSG_RX_CHANNEL_PC 2
#define MessageRxChannel() @(0x210019)
#define RxBufferIRId() @(0x21001a)
#define RxBufferPCId() @(0x21001b)
#define MSG_INDEX 0
#define MSG_COMMAND 1
#define MSG_HI_BYTE 2
#define MSG_LO_BYTE 3
#define COMMAND_CONTROLLER 0x40
#define RxIRMessage(n) @(0x21001c + (n)) // 4 bytes
#define RxPCMessage(n) @(0x210020 + (n)) // 4 bytes
__nolist void SendSerial(const int first, const int count) { asm { 0xc2, first,
count }; }
#define PingControl(n) @(0x330000 + (n)) // 51
#define PingData() PingControl(0)
__nolist void SetPingData(const int &d) { Set(PingData(), d); }
#define PingInterval() PingControl(1)
__nolist void SetPingInterval(const int &i) { Set(PingInterval(), i); }
#define PingID() PingControl(2)
#define BeaconControl(n) @(0x340000 + (n)) // 52
#define RC_CHANNEL_BROADCAST 0
#define RC_CHANNEL_1 1
#define RC_CHANNEL_2 2
#define RC_CHANNEL_3 3
#define RC_CHANNEL_DISABLED 4
#define RCRxChannel() @(0x340001)
__nolist void SetRCRxChannel(const int c) { Set(RCRxChannel(), c); }
#define RCTxChannel() @(0x340002)
__nolist void SetRCTxChannel(const int c) { Set(RCTxChannel(), c); }
#define RCTXMODE_SINGLE_SHOT 0
#define RCTXMODE_CONTINUOUS 1
#define RCTxMode() @(0x340001)
__nolist void SetRCTxMode(const int m) { Set(RCTxMode(), m); }
#define IndirectEEProm() @(0x360000) // 54 ????
// __nolist void Find(int &v, const int f,
__nolist void StartTask(const int t) { asm { 0x71, t}; }
#define CONTROLLER_BUTTON1 0x0100
#define CONTROLLER_BUTTON2 0x0200
#define CONTROLLER_BUTTON3 0x0001
#define CONTROLLER_BUTTON4 0x0101
#define CONTROLLER_BUTTON5 0x0201
|
|
Message has 1 Reply:
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|