Something went wrong on our end
hw_iface.h 1.46 KiB
#ifndef HW_IFACE_H
#define HW_IFACE_H
struct I2CDriver {
void *state;
int (*reset)(struct I2CDriver *self);
int (*write)(struct I2CDriver *self,
unsigned short device_addr,
unsigned char *data,
unsigned int length);
int (*read)(struct I2CDriver *self,
unsigned short device_addr,
unsigned char *buff,
unsigned int length);
};
struct PWMOutputDriver {
void *state;
int (*reset)(struct PWMOutputDriver *self);
int (*write)(struct PWMOutputDriver *self, unsigned int channel, unsigned long pulse_width_us);
};
struct PWMInputDriver {
void *state;
int (*reset)(struct PWMInputDriver *self);
int (*read)(struct PWMInputDriver *self, unsigned int channel, unsigned long *pulse_width_us);
};
struct UARTDriver {
void *state;
int (*reset)(struct UARTDriver *self);
int (*write)(struct UARTDriver *self, unsigned char c);
int (*read)(struct UARTDriver *self, unsigned char *c);
};
struct TimerDriver {
void *state;
int (*reset)(struct TimerDriver *self);
int (*restart)(struct TimerDriver *self);
int (*read)(struct TimerDriver *self, unsigned long long *us);
};
struct LEDDriver {
void *state;
int (*reset)(struct LEDDriver *self);
int (*turn_on)(struct LEDDriver *self);
int (*turn_off)(struct LEDDriver *self);
};
struct SystemDriver {
void *state;
int (*reset)(struct SystemDriver *self);
int (*sleep)(struct SystemDriver *self, unsigned long us);
};
#endif