This is a example application for StarBoard Orange designed by @logic_star. This example can be drive a CHORO Q HYBRID.
Diff: mylib/ChoroQ.cpp
- Revision:
- 1:03c8bc666945
- Parent:
- 0:127b9ca59547
--- a/mylib/ChoroQ.cpp Tue Aug 24 11:58:09 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -#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; -}