roneos
Operating System for the r-one robot
 All Data Structures Files Functions Variables Typedefs Groups
system.h
Go to the documentation of this file.
1 
8 #ifndef SYSTEM_H_
9 #define SYSTEM_H_
10 
11 /******** Defines ********/
12 
13 #define SYSCTL_CLOCK_FREQ 50000000
14 
15 /* Size of the stack allocated to the uIP task. */
16 #define BASIC_TASK_STACK_SIZE (configMINIMAL_STACK_SIZE * 3)
17 #define SYSTEM_INTERRUPT_PRIORITY (configMAX_SYSCALL_INTERRUPT_PRIORITY + ( ( unsigned char ) 2 << ( unsigned char ) 5 ))
18 //#define SYSTEM_INTERRUPT_PRIORITY (configMAX_SYSCALL_INTERRUPT_PRIORITY + 1)
19 #define SYSTEM_INTERRUPT_PRIORITY_IR (configMAX_SYSCALL_INTERRUPT_PRIORITY + ( ( unsigned char ) 1 << ( unsigned char ) 5 ))
20 
21 /* Task priorities. */
22 #define SERIALIO_TASK_PRIORITY ( tskIDLE_PRIORITY + 6 )
23 #define RADIOCOMMAND_TASK_PRIORITY ( tskIDLE_PRIORITY + 6 )
24 #define HEARTBEAT_TASK_PRIORITY ( tskIDLE_PRIORITY + 5 )
25 #define RPRINTFTERMINAL_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 )
26 #define MIDI_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 )
27 #define NEIGHBORS_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
28 #define BACKGROUND_TASK_PRIORITY ( tskIDLE_PRIORITY)
29 
30 // MSP430 SPI States
31 #define MSP430_SPI_NORMAL_OPERATION 0
32 #define MSP430_SPI_BOOT_LOADER_MODE 1
33 
34 /******** Functions ********/
35 
36 /* TODO: QUILLAN: Look into storing the error messages into something so that you can plug the robot into a computer, send 'er' through the serial port and it will spew the last error messages. */
37 
38 #define systemPrintStartup() _systemPrintStartup(__FILE__)
39 #define error(errMsg) _error(__FILE__, __LINE__, errMsg)
40 //#define warning(warningMessage) _warning(__FILE__, __LINE__, warningMessage)
41 
42 
48 void _systemPrintStartup(char* fileName);
49 
50 
61 void _error(char* fileName, int lineNumber, char* errMsg);
62 
63 
64 //void _warning(char *fileName, int lineNumber, char *errMsg);
65 
66 
67 //Static Varible of roneID
68 extern uint8 roneID;
69 
70 
81 void systemInit(void);
82 
83 
91 void systemHeartbeatTask(void* parameters);
92 
93 
102 void systemShutdown(void);
103 
104 
110 void systemBootloader(void);
111 
112 
118 void systemPrintMemUsage(void);
119 
120 
131 uint32 systemUSBConnected(void);
132 
133 
142 void systemIDInit(void);
143 
144 
150 void systemDelay(uint32 delay);
151 
152 
158 void setMSP430SPIOperationState(uint8 state);
159 
160 
161 
162 // RONE_V9+ functions. Will not work on v6
163 /*
164  * @brief Initialize the system IO
165  * Systems includes battery voltage, usb voltage, powerbutton, mspversion and prevVal .RONE_V9+ functions. Will not work on v6
166  * @return void
167  */
168 void systemIOInit(void);
169 
170 
177 void systemBatteryVoltageUpdate(uint8 val);
178 
179 
185 float systemBatteryVoltageGet(void);
186 
187 
195 void systemBatteryVoltageGet2(uint8* onesPtr, uint8* tenthsPtr);
196 
197 
204 void systemUSBVoltageUpdate(uint8 val);
205 
206 
212 uint8 systemUSBVoltageGet(void);
213 
214 
221 void systemPowerButtonUpdate(uint8 val);
222 
223 
229 uint8 systemPowerButtonGet(void);
230 
231 
237 void systemMSPVersionUpdate(uint8 val);
238 
239 
245 uint8 systemMSPVersionGet(void);
246 
247 
256 void systemShutdown(void);
257 
258 #endif /* SYSTEM_H_ */