Example #1
0
// main function
int main(void) { //const int argc, const char** argv) {
  u8 run = 1; 
  
  //  net_init(&ctlnet);
  net_init();
  ui_init();
  pages_init();
  preset_init();
  scene_init();

  // TEST:
  // create some dummy parameters
  /* net_add_param(0, "unit", 0.0, 1.0, 0); */
  /* net_add_param(1, "big", 0.0, 10000.0, 0); */
  /* net_add_param(2, "bipolar", -1.0, 1.0, 0); */

  while (run != 0) {
    run = ui_loop();
  }

  scene_deinit();
  preset_deinit();
  pages_deinit();
  ui_deinit();
  net_deinit();

  return 0;
}
Example #2
0
// this is called from main event handler
u8 app_launch(u8 firstrun) {

  print_dbg("\r\n launching app with firstrun: ");
  print_dbg_ulong(firstrun);

  //  net_print();

  
  render_boot("BEES");
  render_boot(versionString);

  if(firstrun) {
    render_boot("launching app, first run");
    print_dbg("\r\n first run, writing nonvolatile data...");
    
    ///... write param scaler data
    // this is done at firstrun instead of being linked statically,
    // so that users can tune scaler data offline without recompiling
    render_boot("init param scaling data...");
    flash_init_scaler_data();

    print_dbg("\r\n first run, try and load default DSP");
    render_boot("launching default DSP...");

    files_load_dsp_name("aleph-waves.ldr");
    
    render_boot("waiting for DSP init...");
    bfin_wait_ready();

    //    print_dbg(" requesting param report...");
    render_boot("requesting DSP params");
    net_report_params();

    //    print_dbg("\r\n enable DSP audio...");
        render_boot("enabling audio");
    bfin_enable();

    render_boot("writing default dsp to flash...");
    //    files_store_default_dsp_name("aleph-waves.ldr");
    
  } else {

    app_pause();

    print_dbg("\r\n booting default ldr from flash... ");
    render_boot("booting DSP from flash");
    //    flash_read_ldr();

    bfin_load_buf();    
    print_dbg("\r\n DSP booted, waiting to query params...");
    render_boot("waiting for DSP init...");

    /// blackfin should clear ready pin ASAP on boot.
    /// but give it a moment to accomplish that.
    delay_ms(2);
    
    bfin_wait_ready();
    print_dbg(" requesting param report...");
    render_boot("requesting DSP params");
    net_report_params();

    print_dbg("\r\n enable DSP audio...");
    render_boot("enabling audio");
    bfin_enable();
    
    print_dbg("\r\n reading default scene... ");
    render_boot("reading default scene");
    scene_read_default();

    app_resume();
    
   }

  // init pages (fill graphics buffers)
  print_dbg("\r\n pages_init...");
  pages_init();

  print_dbg("\r\n play_init...");
  play_init();

  // enable timers
  print_dbg("\r\n enable app timers...");
  render_boot("enabling app timers...");
  init_app_timers();

  // pull up power control pin, enabling soft-powerdown
  gpio_set_gpio_pin(POWER_CTL_PIN);

  // assign app event handlers
  print_dbg("\r\n assigning handlers ");
  render_boot("assigning UI handlers...");
  assign_bees_event_handlers();

  // update page rendering and handlers
  pages_reselect();

  // start in play mode 
  pages_toggle_play();

  return 1;
}
Example #3
0
// this is called from main event handler
u8 app_launch(u8 firstrun) {

  print_dbg("\r\n launching app with firstrun: ");
  print_dbg_ulong(firstrun);

  //  net_print();
  
  render_boot("BEES");
  render_boot(versionString);

  while (!sd_mmc_spi_mem_check()) {
    render_boot("waiting for SD card...");
  }

  if(firstrun) {
    render_boot("launching app, first run");
    print_dbg("\r\n first run, writing nonvolatile data...");
    
    ///... write param scaler data
    // this is done at firstrun instead of being linked statically,
    // so that users can tune scaler data offline without recompiling
    render_boot("init param scaling data...");
    flash_init_scaler_data();

    print_dbg("\r\n first run, try and load default DSP");
    render_boot("launching default DSP");

    //// startup using default DSP name
    files_load_dsp_name(DEFAULT_LDR);
    
    render_boot("waiting for DSP init...");
    bfin_wait_ready();

    //    print_dbg("\r\n enable DSP audio...");
    render_boot("enabling audio");
    bfin_enable();
    
  } else {

    app_pause();

    /// blackfin should clear ready pin ASAP on boot.
    /// but give it a moment to accomplish that.
    delay_ms(2);

    /// read the default scene from sd card
    /// this also attempts to load associated .ldr    
    render_boot("reading default scene");
    print_dbg("\r\n loading default scene. current module name from sceneData: ");
    print_dbg(sceneData->desc.moduleName);

    scene_read_default();

    delay_ms(2); 

    app_resume();
    
   }

  // init pages (fill graphics buffers)
  render_boot("initializing gfx");
  print_dbg("\r\n pages_init...");
  pages_init();

  print_dbg("\r\n play_init...");
  play_init();

  // enable timers
  print_dbg("\r\n enable app timers...");
  render_boot("enabling app timers");
  init_app_timers();

  // pull up power control pin, enabling soft-powerdown
  //  gpio_set_gpio_pin(POWER_CTL_PIN);

  // assign app event handlers
  print_dbg("\r\n assigning handlers... ");
  render_boot("assigning UI handlers");
  assign_bees_event_handlers();

  // update page rendering and handlers...
  pages_reselect();

  // start in play mode if not firstrun 
  if(!firstrun) pages_toggle_play();

  return 1;
}