#include "items.h" #include "menu.h" #include "screen.h" #include "tasks.h" #include "scheduler.h" #include "shooter.h" #include "rotary.h" #include "formatter.h" #include "starter.h" #include "digital_input.h" #include "digital_output.h" #include "test_screen.h" #include "camera.h" //#include // let the dumb Arduino IDE know we need EEPROM.h :( #include LiquidCrystal lcd(LCD_RS, LCD_ENABLE, LCD_D4, LCD_D5, LCD_D6, LCD_D7); DigitalOutput backlight(BACKLIGHT_PIN); DigitalInput sensor(BEAM_SENSOR_PIN, true); DigitalOutput laser(BEAM_LASER_PIN); Camera camera(FOCUS_PIN, SHUTTER_PIN, FLASH_PIN); Formatter formatter; TestScreen test_screen; Count flash_delay(15, // minimum delay -> 11 mm drop 320, // maximum delay -> 502 mm drop 1, // step value 200, // default delay "Intervalle", // screen title "ms", // value unit 3, // width of formatted value &formatter); Count flash_duration(1, // minimum delay 100, // maximum delay 1, // step value 50, // default delay "Impulsion flash", // screen title "ms", // value unit 3, // width of formatted value &formatter); const char * no_yes_labels[] = { "Non", "Oui" }; Option focus_option(no_yes_labels, NB_ELEMENTS(no_yes_labels), 1, // default index in focus_options[] "Mise au point", 3); const char * shutter_option_labels[] = { "Jamais", "Avant", "A temps" }; Option shutter_option(shutter_option_labels, NB_ELEMENTS(shutter_option_labels), 1, // default index in focus_options[] "Obturat. ouvert", 7 ); // Screens that are disabled while shooting Screen * disable_screens[] = { &test_screen, &flash_delay, &flash_duration, &focus_option, &shutter_option }; Starter starter(disable_screens, NB_ELEMENTS(disable_screens)); Screen * menu_items[] = {&starter, &test_screen, &flash_delay, &flash_duration, &focus_option, &shutter_option}; Menu menu(menu_items, NB_ELEMENTS(menu_items)); Shooter shooter(&starter); RotaryEncoder knob(&menu, ENCODER_PINA, ENCODER_PINB, BUTTON_PIN); Task * tasks[] = {&shooter, &knob, &sensor}; TaskScheduler scheduler(tasks, NB_ELEMENTS(tasks)); void setup() { Serial.begin(57600); lcd.begin(20, 4); backlight.high(); //interval.read_eeprom(); // Needed here if we want to Serial.print() //count.read_eeprom(); // in those functions menu.refresh(); } void loop() { scheduler.run(); // infinite loop }