Skip to content

Library for an I2C command interface to the HapTouch BoosterPack.

License

Notifications You must be signed in to change notification settings

Andy4495/HapTouch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HapTouch BoosterPack Library

Arduino Compile Sketches Check Markdown Links

This library provides an I2C command interface to the HapTouch BoosterPack.

The HapTouch BoosterPack was produced and available through Element14/Newark/Farnell based on a reference design from Texas Instruments.

The HapTouch BoosterPacks are no longer supported. An SDK contained details on how to program the TCH5E controller on the BoosterPack and also how to interface with the factory-programmed code on the TCH5E controller with I2C. However, the SDK is no longer available.

This library provides an I2C interface to the BoosterPack based on still-available documentation and experimenting with the BoosterPack.

Usage

See the sketch included in the examples folder.

First, create a HapTouch object:

HapTouch myHapTouch;

Note that the above constructor has two default parameters: the I2C address of the HapTouch BoosterPack and the I2C module number for the Wire library. The default values are typically the correct values, so the constructor can be called without arguments, but the ability to change those values is available if needed.

Next, initialize the interface:

myHapTouch.begin();

This intitializes the I2C interface. It calls Wire.setModule() and Wire.begin(). If you want to initialize I2C separately in your sketch, the above method does not need to be called.

Then, call any of the HapTouch commands as needed for your sketch. These commands are explained in the HapTouch library designer's guide and in the BoosterPack user's guide:

uint8_t playEffect(uint8_t effect, int duration, uint8_t override);
uint8_t playSequence(uint8_t* effect_list, int effect_count,
                     uint8_t repeat_count, uint8_t override);
uint8_t stopPlayback();
void readbackPing(char* c);
void readbackButtonState(char* c);
void readbackButtonCounts(char* c);
uint8_t audioHapticsEnable(uint8_t en);
uint8_t audioHapticsConfig(uint8_t midpoint, uint8_t wakeupThreshold,
                           uint8_t inputMin, uint8_t inputMax,
                           uint8_t strengthAtFloor, uint8_t strengthMax);
uint16_t enterGameState();
uint8_t touchTune();

The following commands are available for experimentation or to access undocumented commands:

void readbackGeneric(uint8_t readback_index, char* c, uint8_t n);
uint8_t genericCommand(uint8_t command, uint8_t* params,
                       uint8_t param_length);
uint8_t getResponseCode();

Operational Notes

  • The HapTouch BoosterPack uses pins 14/15 for the I2C interface. These pins are typically defined as module 0 in the MSP board packages. The default HapTouch constructor sets I2C module 0.
  • Since the factory-programmed firmware is still running on the TCH5E controller on the BoosterPack, touching the cap-touch buttons will generate the factory-programmed haptic response. However, it is possible to disable the CapTouch buttons by scraping away some solder resist on the buttons and the surrounding ground plane and creating a solder bridge between the buttons and ground.
  • Some LaunchPads may not be able to supply enough power for the ERM haptic actuator. A symptom of this is the board resetting whenever a haptic effect is played. Therefore, it is recommended to set the BoosterPack switch to LRA mode when using LaunchPad power. When using the ERM actuator, use an external 3V3 power source that can supply at least 200 mA.
  • This library should work with any of the MSP430 LaunchPad variants. The form factors of the smaller boards (like the G2) make it difficult to use the LaunchPad buttons without affecting the CapTouch buttons on the BoosterPack. In those cases, it is recommended to disable the CapTouch buttons as mentioned above.
  • The BoosterPack includes a 2x3 "Host Connector" with power and I2C signals which can be used to interface with the board instead of using the standard BoosterPack 20/40 pin connector.

Future Enhancements

  • Currently, this library requires the use of the Wire library. A future iteration may include support for a software I2C library (like this one)

References

License

The software and other files in this repository are released under what is commonly called the MIT License. See the file LICENSE in this repository.