Implementation of the Arduino API in RIOT. More...
Implementation of the Arduino API in RIOT.
Files | |
file | arduino.hpp |
Main interface definition of the Arduino API. | |
file | serialport.hpp |
Definition of the Arduino 'Serial' interface. | |
file | spiport.hpp |
Definition of the Arduino 'SPI' interface. | |
file | wireport.hpp |
Definition of the Arduino 'Wire Library' for TwoWire interfaces. | |
Macros | |
#define | ARDUINO_UART_DEV UART_DEV(0) |
UART device to use for Arduino serial. | |
#define | ARDUINO_PWM_MODE PWM_LEFT |
PWM default frequency. | |
#define | ARDUINO_PWM_STEPS (256U) |
PWM steps. | |
Typedefs | |
typedef bool | boolean |
Arduino boolean data type definion. | |
typedef uint8_t | byte |
Arduino byte data type definion. | |
Enumerations | |
enum | { INPUT , OUTPUT , INPUT_PULLUP } |
Possible pin configurations. More... | |
enum | { LOW = 0 , HIGH = 1 } |
Possible pin states. More... | |
Functions | |
unsigned long | millis () |
Returns the number of milliseconds since start. | |
void | pinMode (int pin, int mode) |
Configure a pin as either input or output. | |
void | digitalWrite (int pin, int state) |
Set the value for the given pin. | |
int | digitalRead (int pin) |
Read the current state of the given pin. | |
void | delay (unsigned long msec) |
Sleep for a given amount of time [milliseconds]. | |
void | delayMicroseconds (unsigned long usec) |
Sleep for a given amount of time [microseconds]. | |
unsigned long | micros () |
Returns the number of microseconds since start. | |
int | analogRead (int pin) |
Read the current value of the given analog pin. | |
void | analogWrite (int pin, int value) |
Write an analog value to a pin. | |
static void | interrupts (void) |
Enables interrupts. | |
static void | noInterrupts (void) |
Disables interrupts. | |
Variables | |
static SerialPort | Serial (ARDUINO_UART_DEV) |
Primary serial port (mapped to ARDUINO_UART_DEV) | |
#define ARDUINO_PWM_MODE PWM_LEFT |
PWM default frequency.
Can be overridden at board level in arduino_board.h.
See table from https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/ for reference values.
PWM mode
Definition at line 153 of file arduino.hpp.
#define ARDUINO_PWM_STEPS (256U) |
PWM steps.
Definition at line 158 of file arduino.hpp.
#define ARDUINO_UART_DEV UART_DEV(0) |
UART device to use for Arduino serial.
Definition at line 71 of file arduino.hpp.
typedef bool boolean |
Arduino boolean data type definion.
Definition at line 43 of file arduino.hpp.
typedef uint8_t byte |
Arduino byte data type definion.
Definition at line 48 of file arduino.hpp.
anonymous enum |
Possible pin configurations.
Enumerator | |
---|---|
INPUT | configure pin as input |
OUTPUT | configure pin as output |
INPUT_PULLUP | configure pin as input with pull-up resistor |
Definition at line 53 of file arduino.hpp.
anonymous enum |
Possible pin states.
Enumerator | |
---|---|
LOW | pin is cleared |
HIGH | pin is set |
Definition at line 62 of file arduino.hpp.
int analogRead | ( | int | pin | ) |
Read the current value of the given analog pin.
[in] | pin | pin to read |
void analogWrite | ( | int | pin, |
int | value | ||
) |
Write an analog value to a pin.
[in] | pin | pin to write |
[in] | value | duty cycle value, between 0 and 255 |
void delay | ( | unsigned long | msec | ) |
Sleep for a given amount of time [milliseconds].
[in] | msec | number of milliseconds to sleep |
void delayMicroseconds | ( | unsigned long | usec | ) |
Sleep for a given amount of time [microseconds].
[in] | usec | number of microseconds to sleep |
int digitalRead | ( | int | pin | ) |
Read the current state of the given pin.
[in] | pin | pin to read |
void digitalWrite | ( | int | pin, |
int | state | ||
) |
Set the value for the given pin.
[in] | pin | pin to set |
[in] | state | HIGH or LOW |
|
inlinestatic |
Enables interrupts.
Definition at line 172 of file arduino.hpp.
unsigned long micros | ( | ) |
Returns the number of microseconds since start.
unsigned long millis | ( | ) |
Returns the number of milliseconds since start.
|
inlinestatic |
Disables interrupts.
Definition at line 180 of file arduino.hpp.
void pinMode | ( | int | pin, |
int | mode | ||
) |
Configure a pin as either input or output.
[in] | pin | pin to configure |
[in] | mode | mode to set the pin to |