const u8* op_midi_out_cc_unpickle(op_midi_out_cc_t* op, const u8* src) { src = unpickle_io(src, (u32*)&(op->chan)); src = unpickle_io(src, (u32*)&(op->num)); op->chan = op_to_int(op->chan); op->num = op_to_int(op->num); return src; }
const u8* op_adc_unpickle(op_adc_t* adc, const u8* src) { src = unpickle_io(src, &(adc->enable)); src = unpickle_io(src, &(adc->period)); if(adc->enable) { timers_set_adc(op_to_int(adc->period)); } return src; }
// input polling period void op_adc_in_period (op_adc_t* adc, const io_t v) { if((v) < OP_ONE) { adc->period = OP_ONE; } else { adc->period = v; } timers_set_adc_period(op_to_int(adc->period)); }
// timer manipulation static inline void op_metro_set_timer(op_metro_t* metro) { // timer_add(&(metro->timer), op_to_int(metro->period), &op_metro_callback, (void*)metro); /* timer_add(&(metro->timer), op_to_int(metro->period), &app_custom_event_callback, metro); */ timers_set_custom(&(metro->timer), op_to_int(metro->period), &(metro->op_poll) ); // print_dbg("\r\n op_metro add timer, return value: "); // print_dbg(ret ? "1" : "0"); }
// input polling period void op_metro_in_period (op_metro_t* metro, const io_t v) { if((v) < 5) { metro->period = 5; } else { metro->period = v; } metro->timer.ticks = op_to_int(metro->period); }
// input period void op_bignum_in_period(op_bignum_t* bignum, const io_t v) { if((v) < 5) { bignum->period = 5; } else { bignum->period = v; } bignum->timer.ticks = op_to_int(bignum->period); }
void op_delay_in_time (op_delay_t* delay, const io_t v) { if((v) < 1) { delay->ms = 1; } else { delay->ms = v; } delay->timer.ticks = op_to_int(delay->ms); }
// input period void op_screen_in_period(op_screen_t* screen, const io_t v) { if((v) < 5) { screen->period = 5; } else { screen->period = v; } screen->timer.ticks = op_to_int(screen->period); }
// input period void op_bars8_in_period(op_bars8_t* bars8, const io_t v) { if((v) < 5) { bars8->period = 5; } else { bars8->period = v; } bars8->timer.ticks = op_to_int(bars8->period); }
//--- network input functions static void op_midi_note_in_chan(op_midi_note_t* op, const io_t v) { op->chanIo = v; print_dbg("\r\n midi_note, setting channel from input: 0x"); print_dbg_hex((u32)v); // range is [-1, 16] in fix16... this is ugly, whatever // if(op->chanIo > 0x00100000) { op->chanIo = 0x00100000; } // if(op->chanIo < 0xffff0000) { op->chanIo = 0xffff0000; } op->chan = (s8)(op_to_int(op->chanIo)); if(op->chan < -1) { op->chan = -1; } if(op->chan > 15) { op->chan = 15; } print_dbg(" , channel: "); print_dbg_hex((u32)(op->chan)); }
// input enable / disable void op_adc_in_enable (op_adc_t* adc, const io_t v) { print_dbg("\r\n op_adc_in_enable: 0x"); print_dbg_hex((u32)(v)); if((v) > 0) { print_dbg(" (input value high) "); if(adc->enable == 0) { adc->enable = OP_ONE; timers_set_adc(op_to_int(adc->period)); } } else { print_dbg(" (input value low) "); if(adc->enable > 0) { adc->enable = 0; timers_unset_adc(); } } }
// timer manipulation static inline void op_bignum_set_timer(op_bignum_t* bignum) { timers_set_custom(&(bignum->timer), op_to_int(bignum->period), &(bignum->op_poll) ); }
// timer manipulation static inline void op_delay_set_timer(op_delay_t* delay) { print_dbg("\r\n op_delay set timer, start "); timers_set_custom(&(delay->timer), op_to_int(delay->ms), &(delay->op_poll) ); print_dbg("\r\n op_delay set timer, done"); }
const u8* op_midi_out_note_unpickle(op_midi_out_note_t* mout, const u8* src) { src = unpickle_io(src, (u32*)&(mout->chan)); mout->chan = op_to_int(mout->chan); return src; }
// timer manipulation static inline void op_screen_set_timer(op_screen_t* screen) { timers_set_custom(&(screen->timer), op_to_int(screen->period), &(screen->op_poll) ); }
// timer manipulation static inline void op_bars8_set_timer(op_bars8_t* bars8) { timers_set_custom(&(bars8->timer), op_to_int(bars8->period), &(bars8->op_poll) ); }