-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathros_port.h
More file actions
54 lines (45 loc) · 1.06 KB
/
ros_port.h
File metadata and controls
54 lines (45 loc) · 1.06 KB
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
#ifndef __ROS_PORT_H__
#define __ROS_PORT_H__
// Uncomment when use ros as an arduino library
/*
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif // ARDUINO
*/
/**
* include with avr-libc for uintX_t and bool
*/
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/sleep.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Because the interrupt flag is stored in SREG, so we save the old SREG, then
* disable interrupt to do critical codes. After calling CRITICAL_END(), the
* interrupt flag restored either enable or diable.
*/
#define CRITICAL_STORE uint8_t sreg
#define CRITICAL_START() \
sreg = SREG; \
cli();
#define CRITICAL_END() SREG = sreg;
#ifndef F_CPU
// Atmega328p CPU frequency is 16MHZ
#define F_CPU 16000000UL
#endif
// System ticks pre-second, 100 means 1/100s(10ms) one tick
#define ROS_SYS_TICK 100
#define ROS_IDLE_STACK_SIZE 64
#define ROS_DEFAULT_STACK_SIZE 128
#define ROS_MIN_STACK_SIZE 32
#ifdef __cplusplus
}
#endif
#endif //__ROS_PORT_H__