Subversion Repositories svn.mios32

Rev

Rev 1919 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1008 tk 1
// $Id: app.cpp 1920 2014-01-08 19:29:35Z tk $
2
/*
3
 * MIOS32 Application Template
4
 *
5
 * ==========================================================================
6
 *
7
 *  Copyright (C) <year> <your name> (<your email address>)
8
 *  Licensed for personal non-commercial use only.
9
 *  All other rights reserved.
10
 *
11
 * ==========================================================================
12
 */
13
 
14
/////////////////////////////////////////////////////////////////////////////
15
// Include files
16
/////////////////////////////////////////////////////////////////////////////
17
 
18
#include <mios32.h>
19
#include "app.h"
20
 
21
 
22
/////////////////////////////////////////////////////////////////////////////
23
// This hook is called after startup to initialize the application
24
// It's delcared as "extern C" so that the MIOS32 programming model can
25
// access this function - you can safely write your own functions in C++
26
// In other words: there is no need to add "extern C" to your own functions!
27
/////////////////////////////////////////////////////////////////////////////
28
extern "C" void APP_Init(void)
29
{
30
  // initialize all LEDs
31
  MIOS32_BOARD_LED_Init(0xffffffff);
32
}
33
 
34
 
35
/////////////////////////////////////////////////////////////////////////////
36
// This task is running endless in background
37
/////////////////////////////////////////////////////////////////////////////
38
extern "C" void APP_Background(void)
39
{
1919 tk 40
}
1008 tk 41
 
1919 tk 42
 
43
/////////////////////////////////////////////////////////////////////////////
44
// This hook is called each mS from the main task which also handles DIN, ENC
45
// and AIN events. You could add more jobs here, but they shouldn't consume
46
// more than 300 uS to ensure the responsiveness of buttons, encoders, pots.
47
// Alternatively you could create a dedicated task for application specific
48
// jobs as explained in $MIOS32_PATH/apps/tutorials/006_rtos_tasks
49
/////////////////////////////////////////////////////////////////////////////
50
extern "C" void APP_Tick(void)
51
{
1920 tk 52
  // PWM modulate the status LED (this is a sign of life)
53
  u32 timestamp = MIOS32_TIMESTAMP_Get();
54
  MIOS32_BOARD_LED_Set(1, (timestamp % 20) <= ((timestamp / 100) % 10));
1008 tk 55
}
56
 
57
 
58
/////////////////////////////////////////////////////////////////////////////
1919 tk 59
// This hook is called each mS from the MIDI task which checks for incoming
60
// MIDI events. You could add more MIDI related jobs here, but they shouldn't
61
// consume more than 300 uS to ensure the responsiveness of incoming MIDI.
62
/////////////////////////////////////////////////////////////////////////////
63
extern "C" void APP_MIDI_Tick(void)
64
{
65
}
66
 
67
 
68
/////////////////////////////////////////////////////////////////////////////
1008 tk 69
// This hook is called when a MIDI package has been received
70
/////////////////////////////////////////////////////////////////////////////
71
extern "C" void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package)
72
{
73
}
74
 
75
 
76
/////////////////////////////////////////////////////////////////////////////
77
// This hook is called before the shift register chain is scanned
78
/////////////////////////////////////////////////////////////////////////////
79
extern "C" void APP_SRIO_ServicePrepare(void)
80
{
81
}
82
 
83
 
84
/////////////////////////////////////////////////////////////////////////////
85
// This hook is called after the shift register chain has been scanned
86
/////////////////////////////////////////////////////////////////////////////
87
extern "C" void APP_SRIO_ServiceFinish(void)
88
{
89
}
90
 
91
 
92
/////////////////////////////////////////////////////////////////////////////
93
// This hook is called when a button has been toggled
94
// pin_value is 1 when button released, and 0 when button pressed
95
/////////////////////////////////////////////////////////////////////////////
96
extern "C" void APP_DIN_NotifyToggle(u32 pin, u32 pin_value)
97
{
98
}
99
 
100
 
101
/////////////////////////////////////////////////////////////////////////////
102
// This hook is called when an encoder has been moved
103
// incrementer is positive when encoder has been turned clockwise, else
104
// it is negative
105
/////////////////////////////////////////////////////////////////////////////
106
extern "C" void APP_ENC_NotifyChange(u32 encoder, s32 incrementer)
107
{
108
}
109
 
110
 
111
/////////////////////////////////////////////////////////////////////////////
112
// This hook is called when a pot has been moved
113
/////////////////////////////////////////////////////////////////////////////
114
extern "C" void APP_AIN_NotifyChange(u32 pin, u32 pin_value)
115
{
116
}