![](/media/cache/profiles/1006ff12c465532f8c574aeaa4461b16.50x50_q85.jpg)
This is a example application for StarBoard Orange designed by @logic_star. This example can be drive a CHORO Q HYBRID.
mylib/ChoroQ.cpp
- Committer:
- shintamainjp
- Date:
- 2010-08-24
- Revision:
- 0:127b9ca59547
File content as of revision 0:127b9ca59547:
#include "ChoroQ.h" const ChoroQ::action_t ChoroQ::list[] = { {Undef, "\x00"}, {Up, "\x20"}, {Down, "\x10"}, {Left, "\x30"}, {Right, "\x08"}, {UpDash, "\x28"}, {UpLeft, "\x18"}, {UpRight, "\x38"}, {UpLeftDash, "\x04"}, {UpRightDash, "\x24"}, {DownLeft, "\x14"}, {DownRight, "\x34"}, {DownDash, "\x0C"}, {DownLeftDash, "\x2C"}, {DownRightDash, "\x1C"}, {Stop, "\x3C"} }; ChoroQ::ChoroQ(PinName pin, Channel ch) : irtx(pin) { switch (ch) { case ChA: channel = CH_A; break; case ChB: channel = CH_B; break; case ChC: channel = CH_C; break; case ChD: channel = CH_D; break; } } ChoroQ::~ChoroQ() { } void ChoroQ::execute(Action action) { uint8_t *command = getCommand(action); if (command != NULL) { uint8_t buf[1]; buf[0] = command[0] | channel; irtx.setData(RemoteIR::SONY, buf, 6); } } uint8_t *ChoroQ::getCommand(Action action) { const int n = sizeof(list) / sizeof(list[0]); for (int i = 0; i < n; i++) { const action_t *p = &list[i]; if (p->action == action) { return (uint8_t *)p->command; } } return NULL; }