This source file includes following definitions.
- shutdown
- led_on
- led_off
- debug_led
- get_flash_params_count
- set_led
- camera_set_led
1 #include "platform.h"
2 #include "lolevel.h"
3
4 void shutdown()
5 {
6 volatile long *p = (void*)0xc022002c;
7
8 asm(
9 "MRS R1, CPSR\n"
10 "AND R0, R1, #0x80\n"
11 "ORR R1, R1, #0x80\n"
12 "MSR CPSR_cf, R1\n"
13 :::"r1","r0");
14
15 *p = 0x46;
16
17 while(1);
18 }
19
20
21
22 #define LED_PR 0xc02200E4
23
24 #define LED_BRIGHTNESS 200
25 #define LED_GREEN 4
26 #define LED_YELLOW 5
27 #define LED_ORANGE 7
28 #define LED_BLUE 8
29 #define LED_AF_BEAM 9
30 #define LED_TIMER 10
31
32 static void led_on(const int led, const int brightness)
33 {
34 if (led < 4 || led > 10 || led == 6) return;
35 static void* addr;
36 addr = led_table + (led * 0x40);
37 _UniqueLedOn(addr,brightness);
38 }
39
40 static void led_off(const int led)
41 {
42 if (led < 4 || led > 10 || led == 6) return;
43 static void* addr;
44 addr = led_table + (led * 0x40);
45 _UniqueLedOff(addr);
46 }
47
48 void debug_led(int state)
49 {
50 if (state)
51 led_on(LED_BLUE, LED_BRIGHTNESS);
52 else
53 led_off(LED_BLUE);
54 }
55
56 int get_flash_params_count(void){
57 return 83;
58 }
59
60 void set_led(int led, int state)
61 {
62 if (state)
63 led_on(led, LED_BRIGHTNESS);
64 else
65 led_off(led);
66 }
67 void camera_set_led(int led, int state, int bright)
68 {
69 if (state) {
70 if (bright > LED_BRIGHTNESS) bright = LED_BRIGHTNESS;
71 if (led == 6) {
72 led_on(4, bright);
73 led_on(5, bright);
74 } else
75 led_on(led, bright);
76 }
77 else
78 if (led == 6) {
79 led_off(4);
80 led_off(5);
81 } else
82 led_off(led);
83 }