class pah8011 for mbed

pah8011/pah_drv_comm.h

Committer:
bell_huang
Date:
2019-01-23
Revision:
6:d196b612b14a

File content as of revision 6:d196b612b14a:

#pragma once


#include "pah_ret.h"
#include <stdint.h>


struct pah_drv_comm_s;

typedef enum {
    pah_drv_comm_i2c,
    pah_drv_comm_spi,
} pah_drv_comm_type_e;


typedef struct pah_drv_comm_s {

    void                    *user_data;
    pah_drv_comm_type_e     type;
    uint32_t                max_length;

    pah_ret (*write)(struct pah_drv_comm_s *comm, uint8_t addr, uint8_t data);
    pah_ret (*write_delay)(struct pah_drv_comm_s *comm, uint8_t addr, uint8_t data, uint32_t delay_ms);
    pah_ret (*read)(struct pah_drv_comm_s *comm, uint8_t addr, uint8_t *data);
    pah_ret (*burst_read)(struct pah_drv_comm_s *comm, uint8_t addr, uint8_t *data, uint32_t rx_size);

} pah_drv_comm_s;