Implementation of ADP5589 Driver. More...
Functions | |
void | adp5589_set_register_value (struct adp5589_dev *dev, uint8_t register_address, uint8_t register_value) |
Writes data into a register. | |
uint8_t | adp5589_get_register_value (struct adp5589_dev *dev, uint8_t register_address) |
Reads the value of a register. | |
int8_t | adp5589_init (struct adp5589_dev **device, struct adp5589_init_param init_param) |
Initializes the communication peripheral and checks if the ADP5589 part is present. | |
int32_t | adp5589_remove (struct adp5589_dev *dev) |
Free the resources allocated by adp5589_init(). | |
void | adp5589_init_pwm (struct adp5589_dev *dev) |
Initializes the PWM generator in continuous mode. | |
void | adp5589_init_key (struct adp5589_dev *dev, uint8_t pmod_port) |
Initializes keyboard decoder. | |
void | adp5589_set_pwm (struct adp5589_dev *dev, uint16_t pwm_off_time, uint16_t pwm_on_time) |
Sets the PWM On and Off times. | |
void | adp5589_gpio_direction (struct adp5589_dev *dev, uint8_t reg, uint8_t val) |
Sets the direction of the pins. | |
uint8_t | adp5589_get_pin_state (struct adp5589_dev *dev, uint8_t reg) |
Reads the state of the pins. | |
void | adp5589_set_pin_state (struct adp5589_dev *dev, uint8_t reg, uint8_t state) |
Sets the state of the pins. | |
uint8_t | adp5589_key_decode (uint8_t reg, uint8_t event_type, uint8_t pmod_port) |
Decodes the key on the Pmod-KYPD. | |
void | adp5589_key_lock (struct adp5589_dev *dev, uint8_t first_event, uint8_t second_event, uint8_t pmod_port) |
Locks the ADP5589 and requests Password for unlock. | |
Implementation of ADP5589 Driver.
Copyright 2012(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.
uint8_t adp5589_get_pin_state | ( | struct adp5589_dev * | dev, |
uint8_t | reg ) |
Reads the state of the pins.
dev | - The device structure. |
reg | - The address of the status register to be read. |
uint8_t adp5589_get_register_value | ( | struct adp5589_dev * | dev, |
uint8_t | register_address ) |
Reads the value of a register.
dev | - The device structure. |
register_address | - Address of the register. |
void adp5589_gpio_direction | ( | struct adp5589_dev * | dev, |
uint8_t | reg, | ||
uint8_t | val ) |
Sets the direction of the pins.
dev | - The device structure. |
dev | - The device structure. |
reg | - The address of the direction register to be written. |
val | - The data to be written to the direction register. |
int8_t adp5589_init | ( | struct adp5589_dev ** | device, |
struct adp5589_init_param | init_param ) |
Initializes the communication peripheral and checks if the ADP5589 part is present.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
void adp5589_init_key | ( | struct adp5589_dev * | dev, |
uint8_t | pmod_port ) |
Initializes keyboard decoder.
dev | - The device structure. |
pmod_port | - J1 or J2 connector of PmodIOXP Example: PMOD_IOXP_J1 - J1 connector. PMOD_IOXP_J2 - J2 connector. |
void adp5589_init_pwm | ( | struct adp5589_dev * | dev | ) |
Initializes the PWM generator in continuous mode.
dev | - The device structure. |
uint8_t adp5589_key_decode | ( | uint8_t | reg, |
uint8_t | event_type, | ||
uint8_t | pmod_port ) |
Decodes the key on the Pmod-KYPD.
reg | - The value of the FIFO register |
pmod_port | - J1 or J2 connector of PmodIOXP Example: PMOD_IOXP_J1 - J1 connector. PMOD_IOXP_J2 - J2 connector. |
event_type | - Pressed or released. Example: ADP5589_EVENT_KEY_RELEASED ADP5589_EVENT_KEY_PRESSED |
void adp5589_key_lock | ( | struct adp5589_dev * | dev, |
uint8_t | first_event, | ||
uint8_t | second_event, | ||
uint8_t | pmod_port ) |
Locks the ADP5589 and requests Password for unlock.
dev | - The device structure. |
first_event | - First event occured. |
second_event | - Second event occured. |
pmod_port | - J1 or J2 connector of PmodIOXP Example: PMOD_IOXP_J1 - J1 connector. PMOD_IOXP_J2 - J2 connector. |
int32_t adp5589_remove | ( | struct adp5589_dev * | dev | ) |
Free the resources allocated by adp5589_init().
dev | - The device structure. |
void adp5589_set_pin_state | ( | struct adp5589_dev * | dev, |
uint8_t | reg, | ||
uint8_t | state ) |
Sets the state of the pins.
dev | - The device structure. |
reg | - The address of the status register to be read. |
state | - The value to be written to the pins. |
void adp5589_set_pwm | ( | struct adp5589_dev * | dev, |
uint16_t | pwm_off_time, | ||
uint16_t | pwm_on_time ) |
Sets the PWM On and Off times.
dev | - The device structure. |
pwm_off_time | - The amount of time in uS for which the PWM pulse is LOW. |
pwm_on_time | - The amount of time in uS for which the PWM pulse is HIGH. |
void adp5589_set_register_value | ( | struct adp5589_dev * | dev, |
uint8_t | register_address, | ||
uint8_t | register_value ) |
Writes data into a register.
dev | - The device structure. |
register_address | - Address of the register. |
register_value | - Data value to write. |