no-OS
|
Implementation of MAX22516 Driver. More...
#include <stdlib.h>
#include "max22516.h"
#include "no_os_delay.h"
#include "no_os_error.h"
#include "no_os_alloc.h"
Functions | |
int | max22516_write (struct max22516_dev *dev, uint8_t reg_addr, uint8_t data) |
Writes data to max22516 over SPI. More... | |
int | max22516_read (struct max22516_dev *dev, uint8_t reg_addr, uint8_t *data) |
Reads data from max22516 over SPI. More... | |
int | max22516_update (struct max22516_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t data) |
Update MAX22516 register. More... | |
int | max22516_burst_write_register (struct max22516_dev *dev, uint8_t reg_addr, uint8_t count, uint8_t *data) |
MAX22516 burst write. More... | |
int | max22516_burst_read_register (struct max22516_dev *dev, uint8_t reg_addr, uint8_t count, uint8_t *data) |
MAX22516 burst read. More... | |
void | max22516_build_tcyc (int16_t t, uint8_t *tmr) |
MAX22516 build tcyc. More... | |
void | max22516_rebuild_min_cyct_to_us (int16_t t, uint8_t *tmr) |
MAX22516 rebuild min cyct to microseconds. More... | |
int | max22516_set_min_ctmr (struct max22516_dev *dev, uint16_t min_t) |
MAX22516 set min ctmr. More... | |
int | max22516_set_id (struct max22516_dev *dev, uint16_t vid, uint32_t id, uint16_t fid) |
MAX22516 set id. More... | |
void | max22516_decode_tcyc (uint8_t tmr, int16_t *t) |
MAX22516 decode tcyc. More... | |
int | max22516_get_mst_ctmr (struct max22516_dev *dev, uint16_t min_t, int16_t *c_tmr) |
MAX22516 get mst ctmr. More... | |
int | max22516_get_dl_mode (struct max22516_dev *dev, uint8_t *mode) |
MAX22516 get dl mode. More... | |
int | max22516_get_iol_err_cnt (struct max22516_dev *dev, uint8_t *cnt) |
MAX22516 get iol err cnt. More... | |
int | max22516_get_frm_err_cnt (struct max22516_dev *dev, uint8_t *cnt) |
MAX22516 get frm err cnt. More... | |
int | max22516_clr_iol_err_cnt (struct max22516_dev *dev) |
MAX22516 clr iol err cnt. More... | |
int | max22516_clr_frm_err_cnt (struct max22516_dev *dev) |
MAX22516 clr frm err cnt. More... | |
int | max22516_set_led1 (struct max22516_dev *dev, uint16_t ltmr) |
MAX22516 set led1. More... | |
int | max22516_set_led2 (struct max22516_dev *dev, uint16_t ltmr) |
MAX22516 set led2. More... | |
int | max22516_get_v24 (struct max22516_dev *dev, uint8_t *status3) |
MAX22516 get v24. More... | |
int | max22516_get_thd (struct max22516_dev *dev, uint8_t *status3) |
MAX22516 get THD. More... | |
int | max22516_setup_cq_dis (struct max22516_dev *dev) |
MAX22516 setup cq dis. More... | |
int | max22516_setup_cq_pp (struct max22516_dev *dev) |
MAX22516 setup cq pp. More... | |
int | max22516_setup_cq_pnp (struct max22516_dev *dev) |
MAX22516 setup cq pnp. More... | |
int | max22516_setup_cq_npn (struct max22516_dev *dev) |
MAX22516 setup cq npn. More... | |
int | max22516_tx_set (struct max22516_dev *dev, uint8_t low_high) |
MAX22516 tx set. More... | |
int | max22516_txen_set (struct max22516_dev *dev, uint8_t lvl) |
MAX22516 txen set. More... | |
int | max22516_set_cq (struct max22516_dev *dev, uint8_t lvl) |
MAX22516 set cq. More... | |
int | max22516_tx_get (struct max22516_dev *dev, uint8_t *low_high) |
MAX22516 tx get. More... | |
int | max22516_get_cq (struct max22516_dev *dev, uint8_t *cq) |
MAX22516 get cq. More... | |
int | max22516_get_cq_stat (struct max22516_dev *dev, uint8_t *status3) |
MAX22516 get cq stat. More... | |
int | max22516_setup_do_dis (struct max22516_dev *dev) |
MAX22516 setup do dis. More... | |
int | max22516_setup_do_pp (struct max22516_dev *dev) |
MAX22516 setup do pp. More... | |
int | max22516_setup_do_pnp (struct max22516_dev *dev) |
MAX22516 setup do pnp. More... | |
int | max22516_setup_do_npn (struct max22516_dev *dev) |
MAX22516 setup do npn. More... | |
int | max22516_do_set (struct max22516_dev *dev, uint8_t lvl) |
MAX22516 do set. More... | |
int | max22516_do_get (struct max22516_dev *dev, uint8_t *lvl) |
MAX22516 do get. More... | |
int | max22516_get_do_stat (struct max22516_dev *dev, uint8_t *status3) |
MAX22516 get do stat. More... | |
int | max22516_set_event (struct max22516_dev *dev, uint8_t ev_qual, uint16_t ev_code) |
MAX22516 set event. More... | |
int | max22516_setup_watchdog (struct max22516_dev *dev, uint8_t wd_timeout, uint8_t wd_clr, uint8_t wd_event_en, uint8_t wd_event_flag) |
MAX22516 setup watchdog. More... | |
int | max22516_init (struct max22516_dev **device, struct max22516_init_param *init_param) |
Initialize the MAX22516 device. More... | |
int | max22516_remove (struct max22516_dev *dev) |
Free resoulces allocated for MAX22516. More... | |
Implementation of MAX22516 Driver.
Copyright 2023(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
void max22516_build_tcyc | ( | int16_t | t, |
uint8_t * | tmr | ||
) |
MAX22516 build tcyc.
t | |
tmr |
int max22516_burst_read_register | ( | struct max22516_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | count, | ||
uint8_t * | data | ||
) |
MAX22516 burst read.
dev | - The device structure. |
reg_addr | - The register address. |
count | - Nr. of bytes to be read. |
data | - Data read from the device. |
int max22516_burst_write_register | ( | struct max22516_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | count, | ||
uint8_t * | data | ||
) |
MAX22516 burst write.
dev | - The device structure. |
reg_addr | - The register address. |
count | - Nr. of bytes to be written. |
data | - Data to be written. |
int max22516_clr_frm_err_cnt | ( | struct max22516_dev * | dev | ) |
MAX22516 clr frm err cnt.
dev | - The device structure. |
int max22516_clr_iol_err_cnt | ( | struct max22516_dev * | dev | ) |
MAX22516 clr iol err cnt.
dev | - The device structure. |
void max22516_decode_tcyc | ( | uint8_t | tmr, |
int16_t * | t | ||
) |
MAX22516 decode tcyc.
t | |
tmr |
int max22516_do_get | ( | struct max22516_dev * | dev, |
uint8_t * | lvl | ||
) |
MAX22516 do get.
dev | - The device structure. |
lvl |
int max22516_do_set | ( | struct max22516_dev * | dev, |
uint8_t | lvl | ||
) |
MAX22516 do set.
dev | - The device structure. |
lvl |
int max22516_get_cq | ( | struct max22516_dev * | dev, |
uint8_t * | cq | ||
) |
MAX22516 get cq.
dev | - The device structure. |
cq |
int max22516_get_cq_stat | ( | struct max22516_dev * | dev, |
uint8_t * | status3 | ||
) |
MAX22516 get cq stat.
dev | - The device structure. |
status3 |
int max22516_get_dl_mode | ( | struct max22516_dev * | dev, |
uint8_t * | mode | ||
) |
MAX22516 get dl mode.
dev | - The device structure. |
mode |
int max22516_get_do_stat | ( | struct max22516_dev * | dev, |
uint8_t * | status3 | ||
) |
MAX22516 get do stat.
dev | - The device structure. |
status3 |
int max22516_get_frm_err_cnt | ( | struct max22516_dev * | dev, |
uint8_t * | cnt | ||
) |
MAX22516 get frm err cnt.
dev | - The device structure. |
cnt |
int max22516_get_iol_err_cnt | ( | struct max22516_dev * | dev, |
uint8_t * | cnt | ||
) |
MAX22516 get iol err cnt.
dev | - The device structure. |
cnt |
int max22516_get_mst_ctmr | ( | struct max22516_dev * | dev, |
uint16_t | min_t, | ||
int16_t * | c_tmr | ||
) |
MAX22516 get mst ctmr.
dev | - The device structure. |
min_t | |
c_tmr |
int max22516_get_thd | ( | struct max22516_dev * | dev, |
uint8_t * | status3 | ||
) |
MAX22516 get THD.
dev | - The device structure. |
status3 |
int max22516_get_v24 | ( | struct max22516_dev * | dev, |
uint8_t * | status3 | ||
) |
MAX22516 get v24.
dev | - The device structure. |
status3 |
int max22516_init | ( | struct max22516_dev ** | device, |
struct max22516_init_param * | init_param | ||
) |
Initialize the MAX22516 device.
device | - The device structure. |
init_param | - The structure containing the device initial parameters. |
int max22516_read | ( | struct max22516_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | data | ||
) |
Reads data from max22516 over SPI.
dev | - The device structure. |
reg_addr | - The register address. |
data | - Data read from the device. |
void max22516_rebuild_min_cyct_to_us | ( | int16_t | t, |
uint8_t * | tmr | ||
) |
MAX22516 rebuild min cyct to microseconds.
t | |
tmr |
int max22516_remove | ( | struct max22516_dev * | dev | ) |
Free resoulces allocated for MAX22516.
dev | - The device structure. |
int max22516_set_cq | ( | struct max22516_dev * | dev, |
uint8_t | lvl | ||
) |
MAX22516 set cq.
dev | - The device structure. |
lvl |
int max22516_set_event | ( | struct max22516_dev * | dev, |
uint8_t | ev_qual, | ||
uint16_t | ev_code | ||
) |
MAX22516 set event.
dev | - The device structure. |
ev_qual | |
ev_code |
int max22516_set_id | ( | struct max22516_dev * | dev, |
uint16_t | vid, | ||
uint32_t | id, | ||
uint16_t | fid | ||
) |
MAX22516 set id.
dev | - The device structure. |
vid | |
id | |
fid |
int max22516_set_led1 | ( | struct max22516_dev * | dev, |
uint16_t | ltmr | ||
) |
MAX22516 set led1.
dev | - The device structure. |
ltmr |
int max22516_set_led2 | ( | struct max22516_dev * | dev, |
uint16_t | ltmr | ||
) |
MAX22516 set led2.
dev | - The device structure. |
ltmr |
int max22516_set_min_ctmr | ( | struct max22516_dev * | dev, |
uint16_t | min_t | ||
) |
MAX22516 set min ctmr.
dev | - The device structure. |
min_t |
int max22516_setup_cq_dis | ( | struct max22516_dev * | dev | ) |
MAX22516 setup cq dis.
dev | - The device structure. |
int max22516_setup_cq_npn | ( | struct max22516_dev * | dev | ) |
MAX22516 setup cq npn.
dev | - The device structure. |
int max22516_setup_cq_pnp | ( | struct max22516_dev * | dev | ) |
MAX22516 setup cq pnp.
dev | - The device structure. |
int max22516_setup_cq_pp | ( | struct max22516_dev * | dev | ) |
MAX22516 setup cq pp.
dev | - The device structure. |
int max22516_setup_do_dis | ( | struct max22516_dev * | dev | ) |
MAX22516 setup do dis.
dev | - The device structure. |
int max22516_setup_do_npn | ( | struct max22516_dev * | dev | ) |
MAX22516 setup do npn.
dev | - The device structure. |
int max22516_setup_do_pnp | ( | struct max22516_dev * | dev | ) |
MAX22516 setup do pnp.
dev | - The device structure. |
int max22516_setup_do_pp | ( | struct max22516_dev * | dev | ) |
MAX22516 setup do pp.
dev | - The device structure. |
int max22516_setup_watchdog | ( | struct max22516_dev * | dev, |
uint8_t | wd_timeout, | ||
uint8_t | wd_clr, | ||
uint8_t | wd_event_en, | ||
uint8_t | wd_event_flag | ||
) |
MAX22516 setup watchdog.
dev | - The device structure. |
wd_timeout | |
wd_clr | |
wd_event_en | |
wd_event_flag |
int max22516_tx_get | ( | struct max22516_dev * | dev, |
uint8_t * | low_high | ||
) |
MAX22516 tx get.
dev | - The device structure. |
low_high | - TX level |
int max22516_tx_set | ( | struct max22516_dev * | dev, |
uint8_t | low_high | ||
) |
MAX22516 tx set.
dev | - The device structure. |
low_high |
int max22516_txen_set | ( | struct max22516_dev * | dev, |
uint8_t | lvl | ||
) |
MAX22516 txen set.
dev | - The device structure. |
lvl |
int max22516_update | ( | struct max22516_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | mask, | ||
uint8_t | data | ||
) |
Update MAX22516 register.
dev | - The device structure. |
reg_addr | - The register address. |
mask | - Mask for specific register bits to be updated. |
data | - Data read from the device. |
int max22516_write | ( | struct max22516_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | data | ||
) |
Writes data to max22516 over SPI.
dev | - The device structure. |
reg_addr | - The register address. |
data | - Data value to write. |