HiTechnic IR Link Sensor driver.
More...
#include "common.h"
Go to the source code of this file.
Defines |
#define | BUF_HEADSIZE 3 |
#define | BUF_DATASIZE 11 |
#define | BUF_TAILSIZE 3 |
#define | START_HEAD 0 |
#define | START_DATA 3 |
#define | START_TAIL 15 |
#define | PFSPORT(X) X / 8 |
#define | PFCHAN(X) (X % 8) / 2 |
#define | PFMOT(X) X % 2 |
Enumerations |
enum | tPFmotor {
pfmotor_S1_C1_A = 0,
pfmotor_S1_C1_B,
pfmotor_S1_C2_A,
pfmotor_S1_C2_B,
pfmotor_S1_C3_A,
pfmotor_S1_C3_B,
pfmotor_S1_C4_A,
pfmotor_S1_C4_B,
pfmotor_S2_C1_A,
pfmotor_S2_C1_B,
pfmotor_S2_C2_A,
pfmotor_S2_C2_B,
pfmotor_S2_C3_A,
pfmotor_S2_C3_B,
pfmotor_S2_C4_A,
pfmotor_S2_C4_B,
pfmotor_S3_C1_A,
pfmotor_S3_C1_B,
pfmotor_S3_C2_A,
pfmotor_S3_C2_B,
pfmotor_S3_C3_A,
pfmotor_S3_C3_B,
pfmotor_S3_C4_A,
pfmotor_S3_C4_B,
pfmotor_S4_C1_A,
pfmotor_S4_C1_B,
pfmotor_S4_C2_A,
pfmotor_S4_C2_B,
pfmotor_S4_C3_A,
pfmotor_S4_C3_B,
pfmotor_S4_C4_A,
pfmotor_S4_C4_B
} |
enum | ePWMMotorCommand {
MOTOR_FLOAT = 0,
MOTOR_FWD_PWM_1 = 1,
MOTOR_FWD_PWM_2 = 2,
MOTOR_FWD_PWM_3 = 3,
MOTOR_FWD_PWM_4 = 4,
MOTOR_FWD_PWM_5 = 5,
MOTOR_FWD_PWM_6 = 6,
MOTOR_FWD_PWM_7 = 7,
MOTOR_BRAKE = 8,
MOTOR_REV_PWM_7 = 9,
MOTOR_REV_PWM_6 = 10,
MOTOR_REV_PWM_5 = 11,
MOTOR_REV_PWM_4 = 12,
MOTOR_REV_PWM_3 = 13,
MOTOR_REV_PWM_2 = 14,
MOTOR_REV_PWM_1 = 15
} |
enum | eCDMMotorCommand { CDM_MOTOR_FLOAT = 0,
CDM_MOTOR_FWD = 1,
CDM_MOTOR_BAK = 2,
CDM_MOTOR_BRAKE = 3
} |
Functions |
void | PFcomboDirectMode (tSensors link, int channel, eCDMMotorCommand _motorB, eCDMMotorCommand _motorA) |
void | PFcomboPwmMode (tSensors link, int channel, ePWMMotorCommand _motorB, ePWMMotorCommand _motorA) |
void | encodeBuffer (tByteArray &iBuffer, tByteArray &oBuffer) |
void | transmitIR (tSensors link, tByteArray &oBuffer, int channel) |
void | decToBin (int number, int length, string &output) |
void | debugIR (tByteArray &data) |
void | PFsinglePinOutputMode (tSensors link, ubyte channel, ubyte _motor, ePWMMotorCommand _motorCmd) |
void | PFMotor (tPFmotor pfmotor, ePWMMotorCommand _motorCmd) |
Variables |
byte | toggle [4] = {0, 0, 0, 0} |
Detailed Description
HiTechnic IR Link Sensor driver.
hitechnic-irlink.h provides an API for the HiTechnic IR Link Sensor.
Changelog:
- 1.0: Initial release
- 1.1: Minor changes
- 1.2: Rewrite to make use of the new common.h API
- 1.3: Clarified port numbering
- 1.4: Removed inline functions
- 1.5: Added PFsinglePinOutputMode() functionality to control motors without a timeout
Added PFmotor() as a wrapper for PFsinglePinOutputMode()
eCPMMotorCommand has been replaced with more generic ePWMMotorCommand
transmitIR() now works according to the specs
Credits:
- Big thanks to HiTechnic for providing me with the hardware necessary to write and test this.
License: You may use this code as you wish, provided you give credit where its due.
THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER.
- Author:
- Xander Soldaat (xander_at_botbench.com)
- Date:
- 25 May 2010
- Version:
- 1.4
Definition in file hitechnic-irlink.h.