Exemple #1
0
void op_enc_sys_input(op_enc_t* enc, s8 v) {
  /* print_dbg("\r\n enc sys input, address: 0x"); */
  /* print_dbg_hex((u32)enc); */
  /* print_dbg(" , input value: 0x"); */
  /* print_dbg_hex((u32)v); */

  enc->val = op_add(enc->val, op_mul(enc->step, op_from_int(v)));
  op_enc_perform(enc);  
}
Exemple #2
0
void op_enc_sys_input(op_enc_t* enc, s8 v) {
  /* print_dbg("\r\n enc sys input, address: 0x"); */
  /* print_dbg_hex((u32)enc); */
  /* print_dbg(" , input value: 0x"); */
  /* print_dbg_hex((u32)v); */
  // use saturating add. have to explicitly check for "would-be overflow" in wrap mode with max val.
  //  enc->val = op_sadd(enc->val, op_mul(enc->step, op_from_int(v)));
  /// HACK: assuming the io_t is small enough t
  /// that we can void overflow by casting to 4 bytes.
  enc->val32 = (s32)(enc->val) + (s32)(op_mul(enc->step, op_from_int(v)));
  op_enc_perform(enc);  
}
Exemple #3
0
// max
static void op_enc_in_min(op_enc_t* enc, const io_t v) {
  /// fixme: for now, i am banning this kind of pathological shit:
  if(v >= enc->max) { enc->min = enc->max - 1; }
  else { enc->min = v; }
  op_enc_perform(enc);
}
Exemple #4
0
// max
static void op_enc_in_max(op_enc_t* enc, const io_t v) {
  if(v <= enc->min) { enc->max = enc->min + 1; }
  else { enc->max = v; }
  op_enc_perform(enc);
}
Exemple #5
0
// max
static void op_enc_in_min(op_enc_t* enc, const io_t v) {
  enc->min = v;
  op_enc_perform(enc);
}