Skip to content

Commit

Permalink
add KR.CUE support
Browse files Browse the repository at this point in the history
  • Loading branch information
csboling committed May 4, 2019
1 parent e01dd45 commit 3f801f7
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 4 deletions.
10 changes: 9 additions & 1 deletion docs/ops/ansible.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ short = "advance the clock for channel `x` (channel must have teletype clocking

["KR.PG"]
prototype = "KR.PG"
prototype = "KR.PG x"
prototype_set = "KR.PG x"
short = "get/set the active page"
description = """
Get or change the current parameter page. Numbering:
Expand All @@ -129,6 +129,14 @@ Get or change the current parameter page. Numbering:
- `9` = pattern
"""

["KR.CUE"]
prototype = "KR.CUE"
prototype_set = "KR.CUE x"
short = "get/set the cued pattern"
description = """
Get or change the cued pattern. Numbered from 0.
"""

["ME.PRE"]
prototype = "ME.PRE"
prototype_set = "ME.PRE x"
Expand Down
4 changes: 3 additions & 1 deletion module/help_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ const char* help11[HELP11_LENGTH] = { "11/13 TELEX OUTPUT",
"TO.CV.RESET X",
" RESET CV CALIB" };

#define HELP12_LENGTH 134
#define HELP12_LENGTH 136
const char* help12[HELP12_LENGTH] = { "12/13 ANSIBLE",
" ",
"ANS.G.LED X Y",
Expand Down Expand Up @@ -683,6 +683,8 @@ const char* help12[HELP12_LENGTH] = { "12/13 ANSIBLE",
" ADVANCE THE CLOCK",
" FOR CHANNEL X",
" (MUST BE ENABLED!)",
"KR.CUE / KR.CUE X",
" GET/SET CUED PATTERN X",
"KR.PG / KR.PG X",
" GET/SET ACTIVE PAGE",
"ME.PRE / ME.PRE X",
Expand Down
1 change: 1 addition & 0 deletions src/match_token.rl
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@
"KR.TMUTE" => { MATCH_OP(E_OP_KR_TMUTE); };
"KR.CLK" => { MATCH_OP(E_OP_KR_CLK); };
"KR.PG" => { MATCH_OP(E_OP_KR_PG); };
"KR.CUE" => { MATCH_OP(E_OP_KR_CUE); };
"ME.PRE" => { MATCH_OP(E_OP_ME_PRE); };
"ME.RES" => { MATCH_OP(E_OP_ME_RES); };
"ME.STOP" => { MATCH_OP(E_OP_ME_STOP); };
Expand Down
24 changes: 23 additions & 1 deletion src/ops/ansible.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ static void op_KR_PG_get(const void *data, scene_state_t *ss, exec_state_t *es,
command_state_t *cs);
static void op_KR_PG_set(const void *data, scene_state_t *ss, exec_state_t *es,
command_state_t *cs);

static void op_KR_CUE_get(const void *data, scene_state_t *ss, exec_state_t *es,
command_state_t *cs);
static void op_KR_CUE_set(const void *data, scene_state_t *ss, exec_state_t *es,
command_state_t *cs);
static void op_ME_PRE_get(const void *data, scene_state_t *ss, exec_state_t *es,
command_state_t *cs);
static void op_ME_PRE_set(const void *data, scene_state_t *ss, exec_state_t *es,
Expand Down Expand Up @@ -176,6 +179,7 @@ const tele_op_t op_KR_MUTE = MAKE_GET_SET_OP(KR.MUTE , op_KR_MUTE_get
const tele_op_t op_KR_TMUTE = MAKE_GET_OP (KR.TMUTE , op_KR_TMUTE_get , 1, false);
const tele_op_t op_KR_CLK = MAKE_GET_OP (KR.CLK , op_KR_CLK_get , 1, false);
const tele_op_t op_KR_PG = MAKE_GET_SET_OP(KR.PG , op_KR_PG_get , op_KR_PG_set , 0, true);
const tele_op_t op_KR_CUE = MAKE_GET_SET_OP(KR.CUE , op_KR_CUE_get , op_KR_CUE_set , 0, true);

const tele_op_t op_ME_PRE = MAKE_GET_SET_OP(ME.PRE , op_ME_PRE_get , op_ME_PRE_set , 0, true);
const tele_op_t op_ME_RES = MAKE_GET_OP (ME.RES , op_ME_RES_get , 1, false);
Expand Down Expand Up @@ -560,6 +564,24 @@ static void op_KR_PG_set(const void* NOTUSED(data), scene_state_t *NOTUSED(ss),
tele_ii_tx(II_KR_ADDR, d, 2);
}

static void op_KR_CUE_get(const void *NOTUSED(data), scene_state_t *NOTUSED(ss),
exec_state_t *NOTUSED(es), command_state_t *cs) {
uint8_t d[] = { II_KR_CUE | II_GET };
tele_ii_tx(II_KR_ADDR, d, 1);

d[0] = 0;
tele_ii_rx(II_KR_ADDR, d, 1);
cs_push(cs, (int8_t)d[0]);
}

static void op_KR_CUE_set(const void *NOTUSED(data), scene_state_t *NOTUSED(ss),
exec_state_t *NOTUSED(es), command_state_t *cs) {
uint8_t pat = cs_pop(cs);

uint8_t d[] = { II_KR_CUE, pat };
tele_ii_tx(II_KR_ADDR, d, 2);
}

static void op_ME_PRE_set(const void *NOTUSED(data), scene_state_t *NOTUSED(ss),
exec_state_t *NOTUSED(es), command_state_t *cs) {
int16_t a = cs_pop(cs);
Expand Down
1 change: 1 addition & 0 deletions src/ops/ansible.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extern const tele_op_t op_KR_MUTE;
extern const tele_op_t op_KR_TMUTE;
extern const tele_op_t op_KR_CLK;
extern const tele_op_t op_KR_PG;
extern const tele_op_t op_KR_CUE;

extern const tele_op_t op_ME_PRE;
extern const tele_op_t op_ME_RES;
Expand Down
2 changes: 1 addition & 1 deletion src/ops/op.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const tele_op_t *tele_ops[E_OP__LENGTH] = {
&op_ANS_APP,
&op_KR_PRE, &op_KR_PAT, &op_KR_SCALE, &op_KR_PERIOD, &op_KR_POS,
&op_KR_L_ST, &op_KR_L_LEN, &op_KR_RES, &op_KR_CV, &op_KR_MUTE, &op_KR_TMUTE,
&op_KR_CLK, &op_KR_PG,
&op_KR_CLK, &op_KR_PG, &op_KR_CUE,
&op_ME_PRE, &op_ME_RES, &op_ME_STOP, &op_ME_SCALE,
&op_ME_PERIOD, &op_ME_CV, &op_LV_PRE, &op_LV_RES, &op_LV_POS, &op_LV_L_ST,
&op_LV_L_LEN, &op_LV_L_DIR, &op_LV_CV, &op_CY_PRE, &op_CY_RES, &op_CY_POS,
Expand Down
1 change: 1 addition & 0 deletions src/ops/op_enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ typedef enum {
E_OP_KR_TMUTE,
E_OP_KR_CLK,
E_OP_KR_PG,
E_OP_KR_CUE,
E_OP_ME_PRE,
E_OP_ME_RES,
E_OP_ME_STOP,
Expand Down

0 comments on commit 3f801f7

Please sign in to comment.