123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #pragma once
- #include <pthread.h>
- #include <stdbool.h>
- #include <stdint.h>
- #include <ctime>
- #include "Serial.h"
- #include "Actuator.h"
- typedef enum
- {
- ARDUINOHUB_TYPE_PIEZO = 'P',
- ARDUINOHUB_TYPE_ERM = 'E',
- ARDUINOHUB_TYPE_EMS = 'M'
- } ArduinoHub_Type;
- typedef struct ArduinoHub
- {
- bool valid;
- pthread_mutex_t mutex;
- pthread_t thread;
- ArduinoHub_Type arduinoType;
- Serial* serial;
- Actuator* actuators;
- } ArduinoHub;
- ArduinoHub* ArduinoHub_new();
- void ArduinoHub_init(ArduinoHub* self, char* port, ArduinoHub_Type type);
- void ArduinoHub_clear(ArduinoHub* self);
- void ArduinoHub_delete(ArduinoHub* self);
- void ArduinoHub_vibrate(ArduinoHub* self, uint8_t tactor, float intensity, uint64_t duration);
- void ArduinoHub_startVibration(ArduinoHub* self, uint8_t tactor, float intensity);
- void ArduinoHub_stopVibration(ArduinoHub* self, uint8_t tactor);
- void ArduinoHub_setFrequency(ArduinoHub* self, uint8_t tactor, uint16_t frequency);
- void ArduinoHub_setIntensityRange(ArduinoHub* self, uint8_t tactor, float minIntensity, float maxIntensity);
|