Smartcar Shield
ArduinoRuntime.hpp
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include "../Runtime.hpp"
10 
11 class ArduinoRuntime : public Runtime
12 {
13 public:
14  void setPinDirection(uint8_t pin, uint8_t direction) override;
15  void setPinState(uint8_t pin, uint8_t state) override;
16  int getPinState(uint8_t pin) override;
17  int getAnalogPinState(uint8_t pin) override;
18  void setPWM(uint8_t pin, int dutyCycle) override;
19  void i2cInit() override;
20  void i2cBeginTransmission(uint8_t address) override;
21  size_t i2cWrite(uint8_t value) override;
22  uint8_t i2cEndTransmission() override;
23  uint8_t i2cRequestFrom(uint8_t address, uint8_t numberOfBytes) override;
24  int i2cAvailable() override;
25  int i2cRead() override;
26  int8_t pinToInterrupt(uint8_t pin) override;
27  unsigned long currentTimeMillis() override;
28  unsigned long currentTimeMicros() override;
29  void delayMillis(unsigned long milliseconds) override;
30  void delayMicros(unsigned int microseconds) override;
31  unsigned long getPulseDuration(uint8_t pin, uint8_t state, unsigned long timeout) override;
32  void setInterrupt(uint8_t pin, InterruptCallback callback, int mode) override;
33  uint8_t getLowState() const override;
34  uint8_t getHighState() const override;
35  uint8_t getOutputState() const override;
36  uint8_t getInputState() const override;
37  int getRisingEdgeMode() const override;
38 };
ArduinoRuntime::pinToInterrupt
int8_t pinToInterrupt(uint8_t pin) override
Gets the interrupt number of the specified pin, equivalent of digitalPinToInterrupt in Arduino.
Definition: ArduinoRuntime.cpp:78
ArduinoRuntime::setPinState
void setPinState(uint8_t pin, uint8_t state) override
Set pin state, equivalent of digitalWrite in Arduino.
Definition: ArduinoRuntime.cpp:20
ArduinoRuntime::delayMicros
void delayMicros(unsigned int microseconds) override
Block the execution for the specified number of microseconds, equivalent of delayMicroseconds in Ardu...
Definition: ArduinoRuntime.cpp:98
ArduinoRuntime::getOutputState
uint8_t getOutputState() const override
Get the runtime-specific value representing an OUTPUT pin state.
Definition: ArduinoRuntime.cpp:123
ArduinoRuntime::setPWM
void setPWM(uint8_t pin, int dutyCycle) override
Set PWM state, equivalent of analogWrite in Arduino.
Definition: ArduinoRuntime.cpp:35
InterruptCallback
A callback to be invoked. Depending on the platform different callback types may be necessary.
ArduinoRuntime::i2cRequestFrom
uint8_t i2cRequestFrom(uint8_t address, uint8_t numberOfBytes) override
Request a number of bytes from the specified I2C slave, equivalent of Wire.requestFrom in Arduino.
Definition: ArduinoRuntime.cpp:63
ArduinoRuntime::getHighState
uint8_t getHighState() const override
Get the runtime-specific value representing a logical HIGH voltage state.
Definition: ArduinoRuntime.cpp:118
ArduinoRuntime::i2cBeginTransmission
void i2cBeginTransmission(uint8_t address) override
Initiate a transmission to the specified I2C slave device, equivalent of Wire.beginTransmission in Ar...
Definition: ArduinoRuntime.cpp:48
ArduinoRuntime::setPinDirection
void setPinDirection(uint8_t pin, uint8_t direction) override
Set pin direction, equivalent of pinMode in Arduino.
Definition: ArduinoRuntime.cpp:15
ArduinoRuntime::getPulseDuration
unsigned long getPulseDuration(uint8_t pin, uint8_t state, unsigned long timeout) override
Gets the incomming pulse length in microseconds starting from the nearest state, equivalent to pulseI...
Definition: ArduinoRuntime.cpp:103
Runtime
Definition: Runtime.hpp:35
ArduinoRuntime::i2cAvailable
int i2cAvailable() override
Gets the number of bytes available to be retrieved, equivalent of Wire.availableO in Arduino.
Definition: ArduinoRuntime.cpp:68
ArduinoRuntime::currentTimeMillis
unsigned long currentTimeMillis() override
Gets the amount of milliseconds since the microcontroller started running, equivalent of millis in Ar...
Definition: ArduinoRuntime.cpp:83
ArduinoRuntime::getAnalogPinState
int getAnalogPinState(uint8_t pin) override
Get pin's analog (ADC) reading, equivalent of analogRead in Arduino.
Definition: ArduinoRuntime.cpp:30
ArduinoRuntime::i2cEndTransmission
uint8_t i2cEndTransmission() override
Ends a transmission to an I2C device equivalent of Wire.endTransmission in Arduino.
Definition: ArduinoRuntime.cpp:58
ArduinoRuntime
Definition: ArduinoRuntime.hpp:11
ArduinoRuntime::i2cWrite
size_t i2cWrite(uint8_t value) override
Send the specified byte via i2c, equivalent of Wire.write in Arduino.
Definition: ArduinoRuntime.cpp:53
ArduinoRuntime::i2cRead
int i2cRead() override
Reads a byte from I2C bus, equivalent of Wire.read in Arduino.
Definition: ArduinoRuntime.cpp:73
ArduinoRuntime::i2cInit
void i2cInit() override
Initialize I2C bus as master, equivalent of Wire.begin in Arduino.
Definition: ArduinoRuntime.cpp:43
ArduinoRuntime::getInputState
uint8_t getInputState() const override
Get the runtime-specific value representing an INPUT pin state.
Definition: ArduinoRuntime.cpp:128
ArduinoRuntime::currentTimeMicros
unsigned long currentTimeMicros() override
Gets the amount of microseconds since the microcontroller started running, equivalent of micros in Ar...
Definition: ArduinoRuntime.cpp:88
ArduinoRuntime::getLowState
uint8_t getLowState() const override
Get the runtime-specific value representing a logical LOW voltage state.
Definition: ArduinoRuntime.cpp:113
ArduinoRuntime::getRisingEdgeMode
int getRisingEdgeMode() const override
Get the rising edge constant for setting an interrupt.
Definition: ArduinoRuntime.cpp:133
ArduinoRuntime::delayMillis
void delayMillis(unsigned long milliseconds) override
Block the execution for the specified number of milliseconds, equivalent of delay in Arduino.
Definition: ArduinoRuntime.cpp:93
ArduinoRuntime::setInterrupt
void setInterrupt(uint8_t pin, InterruptCallback callback, int mode) override
Enables an external hardware interrupt and provides a callback, equivalent to attachInterrupt in Ardu...
Definition: ArduinoRuntime.cpp:108
ArduinoRuntime::getPinState
int getPinState(uint8_t pin) override
Get the pin state, equivalent of digitalRead in Arduino.
Definition: ArduinoRuntime.cpp:25