forked from monome/aleph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandler.c
executable file
·67 lines (52 loc) · 1.3 KB
/
handler.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//handler.c
//aleph-prgm-avr32
//RENAME TO global.c
//asf
#include "print_funcs.h"
// avr32
#include "delay.h"
#include "bfin.h"
#include "control.h"
#include "ctl.h"
#include "app.h"
#include "app_timers.h"
#include "types.h"
#include "i2c.h"
//prgm
#include "handler.h"
#include "render.h"
#include "tracker.h"
#include "generator.h"
//static function declarations
static void handle_Adc0(s32 trig);
//static void handle_Adc1(s32 gate);
static void handle_switch_5(s32 data);
//static functions
void handle_Adc0(s32 trig) {
if(trig) bfin_set_clock_in();
}
/*
void handle_Adc1(s32 gate) {
if(gate) bfin_set_gate_out();
}
*/
void handle_switch_5(s32 data) {
// check if mode switch is held
if(gpio_get_pin_value(SW_MODE_PIN)) {
;;
} else {
// write current to flash can be done here...
;;
}
delay_ms(10);
render_boot("ghost in the machine...");
delay_ms(1);
// this pin is physically connected to the power system.
// bringing it low causes immediate shutdown
gpio_clr_gpio_pin(POWER_CTL_PIN);
}
void assign_prgm_event_handlers(void) {
app_event_handlers[ kEventAdc0 ] = &handle_Adc0 ; //trig
// app_event_handlers[ kEventAdc1 ] = &handle_Adc1 ; //gate
app_event_handlers[ kEventSwitch5 ] = &handle_switch_5 ; //power switch
}