74 result.value = (uint8_t *)malloc(
sizeof(uint8_t));
75 result.value[0] = read_val;
109 result.value = (uint8_t *)malloc(
sizeof(uint8_t) * 2);
110 result.value[0] = highByte(read_val);
111 result.value[1] = lowByte(read_val);
130 result.value = (uint8_t *)malloc(
sizeof(uint8_t));
132 if (pin >= 0 && pin <= 13 &&
servo_count < MAX_SERVOS) {
133 result.value[0] =
servos[pin].attach(pin);
152 result.value = (uint8_t *)malloc(
sizeof(uint8_t));
154 if (pin >= 0 && pin <= 13) {
176 result.value = (uint8_t *)malloc(
sizeof(uint8_t));
178 if (pin >= 0 && pin <= 13) {
198 if (pin >= 0 && pin <= 13) {
200 result.value = (uint8_t *)malloc(
sizeof(uint8_t));
201 result.value[0] =
servos[pin].read();
242 uint32_t clockspeed =
makeDWord(argv[0], argv[1], argv[2], argv[3]);
243 Wire.setClock(clockspeed);
259 uint8_t addr = argv[0];
260 uint8_t reg = argv[1];
262 Wire.beginTransmission(addr);
264 for(
int i = 2; i < argc; i++) {
267 Wire.endTransmission();
285 uint8_t addr = argv[0];
286 uint8_t reg = argv[1];
287 uint8_t num_bytes = argv[2];
288 result.
value = (uint8_t *)calloc(num_bytes,
sizeof(uint8_t));
290 Wire.beginTransmission(addr);
292 Wire.endTransmission();
294 Wire.requestFrom(addr, num_bytes);
295 if(Wire.available() == num_bytes) {
296 result.count = num_bytes;
297 for(
int i = 0; i < num_bytes; i++) {
298 result.value[i] = Wire.read();
333 uint32_t clockspeed =
makeDWord(argv[0], argv[1], argv[2], argv[3]);
357 uint8_t CS_pin = argv[0];
359 result.
count = argc - 1;
360 result.value = (uint8_t *)malloc(
sizeof(uint8_t) * result.count);
364 for(
int i = 1; i < argc; i++) {
365 result.value[i-1] = SPI.transfer(argv[i]);
368 SPI.endTransaction();
struct registers pinMode(uint8_t argc, uint8_t *argv)
Change the settings of the Arduino I/O pins.
struct registers spiSettings(uint8_t argc, uint8_t *argv)
Change the settings of the SPI connection.
struct registers wireSetClock(uint8_t argc, uint8_t *argv)
Change the clock speed settings of the I2C connection.
struct registers wireRead(uint8_t argc, uint8_t *argv)
Read data from the connected I2C peripheral.
struct registers servoRead(uint8_t argc, uint8_t *argv)
Read a value from the connected servo.
struct registers wireWrite(uint8_t argc, uint8_t *argv)
Write data to the connected I2C peripheral.
struct registers wireEnd(uint8_t argc, uint8_t *argv)
End an I2C connection between the Arduino and a peripheral.
struct registers spiBegin(uint8_t argc, uint8_t *argv)
Begin a SPI connection between the Arduino and a peripheral.
struct registers analogWrite(uint8_t argc, uint8_t *argv)
Write an analog value (0-255) to the Arduino I/O pins.
struct spi_settings settings
Singleton to represent the current SPI connection settings.
struct registers servoWrite(uint8_t argc, uint8_t *argv)
Write a value to the connected servo.
struct registers servoDetach(uint8_t argc, uint8_t *argv)
Detach a servo from the the control interface.
struct registers servoAttach(uint8_t argc, uint8_t *argv)
Attach a connected servo to a control interface.
struct registers analogRead(uint8_t argc, uint8_t *argv)
Read an analog value (0-1023) from the Arduino I/O pins.
struct registers digitalRead(uint8_t argc, uint8_t *argv)
Read a digital value (HIGH/LOW) from the Arduino I/O pins.
const registers VOID_STRUCT
Helper struct that is returned directly when a callback function has no return values,...
int servo_count
Current number of attached servos.
struct registers spiTransferBuf(uint8_t argc, uint8_t *argv)
Exchange data over the SPI connection (Read + Write)
struct registers digitalWrite(uint8_t argc, uint8_t *argv)
Write a digital (HIGH/LOW) value to the Arduino I/O pins.
struct registers spiEnd(uint8_t argc, uint8_t *argv)
End a SPI connection between the Arduino and a peripheral.
struct registers wireBegin(uint8_t argc, uint8_t *argv)
Begin an I2C connection between the Arduino and a peripheral.
Servo servos[14]
Array to control attached servos.
Header file for 'Functions.cpp'.
#define makeDWord(i0, i1, i2, i3)
Combine four 8-bit integral types into one 32-bit integral type, or in simpler terms,...
A data structure to describe function arguments and return values.
A data structure to describe a SPI connection's configuration settings. Essentially the same as Ardui...