arduino.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Freie Universit├Ąt Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef ARDUINO_HPP
22 #define ARDUINO_HPP
23 
24 extern "C" {
25 #include <stdint.h>
26 #include "periph/gpio.h"
27 #include "arduino_board.h"
28 }
29 
30 #include "serialport.hpp"
31 
35 typedef bool boolean;
36 
40 typedef uint8_t byte;
41 
45 enum {
49 };
50 
54 enum {
55  LOW = 0,
56  HIGH = 1
57 };
58 
59 #ifndef ARDUINO_UART_DEV
60 
63 #define ARDUINO_UART_DEV UART_DEV(0)
64 #endif
65 
70 
77 void pinMode(int pin, int mode);
78 
85 void digitalWrite(int pin, int state);
86 
94 int digitalRead(int pin);
95 
101 void delay(unsigned long msec);
102 
108 void delayMicroseconds(unsigned long usec);
109 
115 unsigned long micros();
116 
122 unsigned long millis();
123 
124 #if MODULE_PERIPH_ADC || DOXYGEN
125 
133 int analogRead(int pin);
134 #endif
135 
136 #if MODULE_PERIPH_PWM || DOXYGEN
137 
145 #ifndef ARDUINO_PWM_FREQU
146 #define ARDUINO_PWM_FREQU (1000U)
147 #endif
148 
152 #define ARDUINO_PWM_MODE PWM_LEFT
153 
157 #define ARDUINO_PWM_STEPS (256U)
158 
165 void analogWrite(int pin, int value);
166 #endif
167 
168 #endif /* ARDUINO_HPP */
169 
#define ARDUINO_UART_DEV
UART device to use for Arduino serial.
Definition: arduino.hpp:63
bool boolean
Arduino boolean data type definion.
Definition: arduino.hpp:35
Low-level GPIO peripheral driver interface definitions.
Definition of the Arduino &#39;Serial&#39; interface.
uint8_t byte
Arduino byte data type definion.
Definition: arduino.hpp:40
int analogRead(int pin)
Read the current value of the given analog pin.
static SerialPort Serial(ARDUINO_UART_DEV)
Primary serial port (mapped to ARDUINO_UART_DEV)
unsigned long millis()
Returns the number of milliseconds since start.
void delay(unsigned long msec)
Sleep for a given amount of time [milliseconds].
pin is cleared
Definition: arduino.hpp:55
void pinMode(int pin, int mode)
Configure a pin as either input or output.
pin is set
Definition: arduino.hpp:56
void digitalWrite(int pin, int state)
Set the value for the given pin.
unsigned long micros()
Returns the number of microseconds since start.
void delayMicroseconds(unsigned long usec)
Sleep for a given amount of time [microseconds].
int digitalRead(int pin)
Read the current state of the given pin.
void analogWrite(int pin, int value)
Write an analog value to a pin.
configure pin as input with pull-up resistor
Definition: arduino.hpp:48
configure pin as input
Definition: arduino.hpp:46
Arduino Serial Interface.
Definition: serialport.hpp:45
configure pin as output
Definition: arduino.hpp:47