Changeset 1573


Ignore:
Timestamp:
01/17/12 03:27:07 (16 months ago)
Author:
reyalp
Message:

update the ixus230 for the new USB remote functionality from waterwingz in http://chdk.setepontos.com/index.php?topic=650.msg80036#msg80036

Location:
trunk/platform/ixus230_elph310hs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/platform/ixus230_elph310hs/kbd.c

    r1567 r1573  
    2828} KeyMap; 
    2929 
    30 long kbd_new_state[3]; 
    31 static long kbd_prev_state[3]; 
    32 static long kbd_mod_state[3]; 
     30long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; 
     31static long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; 
     32static long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; 
    3333 
    3434static long last_kbd_key = 0; 
    3535static long alt_mode_key_mask = 0x00004000; // KEY_VIDEO 
    36 static int usb_power=0; 
    37 static int remote_key, remote_count; 
    38 static int shoot_counter=0; 
     36 
    3937extern void _GetKbdState(long*); 
    4038 
    41 #define DELAY_TIMEOUT 10000 
    4239 
    4340#define KEYS_MASK0 (0x00004000|0X00000004) 
     
    5047#define SD_READONLY_REG 2 
    5148 
    52 #define USB_REG 2 
     49 
    5350#define USB_MASK (0x04000000) 
     51#define USB_IDX  2 
     52 
     53extern void usb_remote_key( int ) ; 
     54int get_usb_bit()  
     55{ 
     56        long usb_physw[3]; 
     57        usb_physw[USB_IDX] = 0; 
     58        _kbd_read_keys_r2(usb_physw); 
     59        return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;  
     60} 
    5461 
    5562#ifndef MALLOCD_STACK 
     
    8289long __attribute__((naked)) wrap_kbd_p1_f() ; 
    8390 
    84 void wait_until_remote_button_is_released(void) 
    85 { 
    86 int count1; 
    87 int count2; 
    88 int tick,tick2,tick3; 
    89 int nSW; 
    90 int prev_usb_power,cur_usb_power; 
    91  // ------ add by Masuji SUTO (start) -------------- 
    92     static int nMode; 
    93  // ------ add by Masuji SUTO (end)   -------------- 
    94  
    95 asm volatile ("STMFD SP!, {R0-R11,LR}\n"); // store R0-R11 and LR in stack 
    96 debug_led(1); 
    97 tick = get_tick_count(); 
    98 tick2 = tick; 
    99 static long usb_physw[3]; 
    100 if (conf.synch_enable && conf.ricoh_ca1_mode && conf.remote_enable && (!shooting_get_drive_mode()|| ((shooting_get_drive_mode()==2) && state_shooting_progress != SHOOTING_PROGRESS_PROCESSING)))  // synch mode enable so wait for USB to disconnect 
    101   { 
    102 // ------ add by Masuji SUTO (start) -------------- 
    103         nMode=0; 
    104         usb_physw[2] = 0;                                             // makes sure USB bit is cleared. 
    105         _kbd_read_keys_r2(usb_physw); 
    106         if((usb_physw[2] & USB_MASK)==USB_MASK) nMode=1; 
    107 // ------ add by Masuji SUTO (end)   -------------- 
    108      if(conf.ricoh_ca1_mode && conf.remote_enable) 
    109      { 
    110         if(shooting_get_drive_mode()==1 && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING){                    //continuous-shooting mode 
    111                 if(conf.bracket_type>2){ 
    112                         if(shoot_counter<2) shutter_int=3; 
    113                         shoot_counter--; 
    114                         } 
    115                 else{ 
    116                         prev_usb_power=0; 
    117                         nSW = 0; 
    118                         do 
    119                                 { 
    120                                 usb_physw[2] = 0;                                             // makes sure USB bit is cleared. 
    121                                 _kbd_read_keys_r2(usb_physw); 
    122                                 cur_usb_power = (usb_physw[2] & USB_MASK)==USB_MASK; 
    123                                 if(cur_usb_power){ 
    124                                         if(!prev_usb_power){ 
    125                                                 tick2 = get_tick_count(); 
    126                                                 prev_usb_power=cur_usb_power; 
    127                                                 } 
    128                                         else{ 
    129                                                 if((int)get_tick_count()-tick2>1000) {debug_led(0);} 
    130                                                 } 
    131                                         } 
    132                                 else{ 
    133                                         if(prev_usb_power){ 
    134                                                 tick3 = (int)get_tick_count()-tick2; 
    135                                                 if(nSW==10) { 
    136                                                         if(tick3>50) shutter_int=1; 
    137                                                         nSW=20; 
    138                                                         } 
    139                                                 if(nSW==0 && tick3>0) { 
    140                                                         if(tick3<50) { 
    141                                                         nSW=10; 
    142                                                         } 
    143                                                 else{ 
    144                                                         if(tick3>1000) shutter_int=1; 
    145                                                                 nSW=20; 
    146                                                         } 
    147                                                 } 
    148                                                 prev_usb_power=cur_usb_power; 
    149                                                 } 
    150                                         } 
    151                                 if((int)get_tick_count()-tick >= DELAY_TIMEOUT) {nSW=20;shutter_int=2;} 
    152                                 } 
    153                          while(nSW<20); 
    154                          } 
    155                 }               //continuous-shooting mode 
    156                 else{           //nomal mode 
    157                         shoot_counter=0; 
    158                         if(conf.bracket_type>2){ 
    159                                 shoot_counter=(conf.bracket_type-2)*2; 
    160                                 } 
    161         do 
    162            { 
    163          //  _GetKbdState(x); 
    164            usb_physw[2] = 0; 
    165           _kbd_read_keys_r2(usb_physw); 
    166            } 
    167  
    168 // ------ modif by Masuji SUTO (start) -------------- 
    169     while(((((usb_physw[2] & USB_MASK)!=USB_MASK) && (nMode==0)) || (((usb_physw[2] & USB_MASK)==USB_MASK) && (nMode==1))) && ((int)get_tick_count()-tick < DELAY_TIMEOUT)); 
    170 // ------ modif by Masuji SUTO (end)   -------------- 
    171         } 
    172        } // ricoh ca-1 mode 
    173  
    174 else 
    175  
    176        { 
    177          do 
    178           { 
    179          //  _GetKbdState(x); 
    180            usb_physw[2] = 0; 
    181           _kbd_read_keys_r2(usb_physw); 
    182            } 
    183         while((usb_physw[2]&USB_MASK) &&  ((int)get_tick_count()-tick < DELAY_TIMEOUT)); 
    184  
    185         } 
    186  
    187   } // synch enable 
    188  
    189  
    190 if (conf.synch_delay_enable && conf.synch_delay_value>0)       // if delay is switched on and greater than 0 
    191   { 
    192     for (count1=0;count1<conf.synch_delay_value+(conf.synch_delay_coarse_value*1000);count1++) // wait delay_value * 0.1ms 
    193     { 
    194       for (count2=0;count2<1400;count2++)            // delay approx. 0.1ms 
    195         { 
    196         } 
    197      } 
    198   } 
    199  
    200 debug_led(0); 
    201  
    202 asm volatile ("LDMFD SP!, {R0-R11,LR}\n"); // restore R0-R11 and LR from stack 
    203 } 
    204  
    205  
    20691static void __attribute__((noinline)) mykbd_task_proceed() 
    20792{ 
     
    295180                 
    296181                 
    297         remote_key = (physw_status[2] & USB_MASK)==USB_MASK; 
    298         if (remote_key) { 
    299                 remote_count += 1; 
    300         } 
    301         else if (remote_count) { 
    302                 usb_power = remote_count; 
    303                 remote_count = 0; 
    304         } 
     182        usb_remote_key(physw_status[USB_IDX]) ; 
    305183 
    306184        if (conf.remote_enable) { 
    307                 physw_status[2] = physw_status[SD_READONLY_REG] & ~(SD_READONLY_FLAG | USB_MASK); 
     185                physw_status[USB_IDX] = physw_status[USB_IDX] & ~(SD_READONLY_FLAG | USB_MASK); 
    308186        } else { 
    309                 physw_status[2] = physw_status[SD_READONLY_REG] & ~SD_READONLY_FLAG; 
     187                physw_status[USB_IDX] = physw_status[USB_IDX] & ~SD_READONLY_FLAG; 
    310188        } 
    311189} 
     
    441319} 
    442320 
    443  
    444 int get_usb_power(int edge) 
    445 { 
    446         int x; 
    447  
    448         if (edge) return remote_key; 
    449         x = usb_power; 
    450         usb_power = 0; 
    451         return x; 
    452 } 
    453  
    454  
    455321long kbd_use_zoom_as_mf() { 
    456322        return 0; 
  • trunk/platform/ixus230_elph310hs/platform_camera.h

    r1567 r1573  
    113113#define CAM_USE_COLORED_ICONS           1       // Enable using the CHDK-DE colored icons. 
    114114 
     115#define REMOTE_SYNC_STATUS_LED  0xC0220130              // specifies an LED that turns on while camera waits for USB remote to sync 
    115116 
    116117 
Note: See TracChangeset for help on using the changeset viewer.