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 
delayMicroseconds
void delayMicroseconds(unsigned long usec)
Sleep for a given amount of time [microseconds].
boolean
bool boolean
Arduino boolean data type definion.
Definition: arduino.hpp:35
INPUT_PULLUP
@ INPUT_PULLUP
configure pin as input with pull-up resistor
Definition: arduino.hpp:48
Serial
static SerialPort Serial(ARDUINO_UART_DEV)
Primary serial port (mapped to ARDUINO_UART_DEV)
digitalRead
int digitalRead(int pin)
Read the current state of the given pin.
OUTPUT
@ OUTPUT
configure pin as output
Definition: arduino.hpp:47
LOW
@ LOW
pin is cleared
Definition: arduino.hpp:55
INPUT
@ INPUT
configure pin as input
Definition: arduino.hpp:46
analogRead
int analogRead(int pin)
Read the current value of the given analog pin.
ARDUINO_UART_DEV
#define ARDUINO_UART_DEV
UART device to use for Arduino serial.
Definition: arduino.hpp:63
HIGH
@ HIGH
pin is set
Definition: arduino.hpp:56
digitalWrite
void digitalWrite(int pin, int state)
Set the value for the given pin.
serialport.hpp
Definition of the Arduino 'Serial' interface.
SerialPort
Arduino Serial Interface.
Definition: serialport.hpp:45
delay
void delay(unsigned long msec)
Sleep for a given amount of time [milliseconds].
micros
unsigned long micros()
Returns the number of microseconds since start.
analogWrite
void analogWrite(int pin, int value)
Write an analog value to a pin.
pinMode
void pinMode(int pin, int mode)
Configure a pin as either input or output.
millis
unsigned long millis()
Returns the number of milliseconds since start.
gpio.h
Low-level GPIO peripheral driver interface definitions.
byte
uint8_t byte
Arduino byte data type definion.
Definition: arduino.hpp:40