Implementation of ADP5589 Driver.
More...
#include <stdlib.h>
#include "adp5589.h"
#include "no_os_alloc.h"
|
| 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.
- Author
- Mihai Bancisor (Mihai.nosp@m..Ban.nosp@m.cisor.nosp@m.@ana.nosp@m.log.c.nosp@m.om)
Copyright 2012(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
◆ adp5589_get_pin_state()
| uint8_t adp5589_get_pin_state |
( |
struct adp5589_dev * | dev, |
|
|
uint8_t | reg ) |
Reads the state of the pins.
- Parameters
-
| dev | - The device structure. |
| reg | - The address of the status register to be read. |
- Returns
- val - The value of the register.
◆ adp5589_get_register_value()
| uint8_t adp5589_get_register_value |
( |
struct adp5589_dev * | dev, |
|
|
uint8_t | register_address ) |
Reads the value of a register.
- Parameters
-
| dev | - The device structure. |
| register_address | - Address of the register. |
- Returns
- register_value - Value of the register.
◆ adp5589_gpio_direction()
| void adp5589_gpio_direction |
( |
struct adp5589_dev * | dev, |
|
|
uint8_t | reg, |
|
|
uint8_t | val ) |
Sets the direction of the pins.
- Parameters
-
| 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. |
◆ adp5589_init()
Initializes the communication peripheral and checks if the ADP5589 part is present.
- Parameters
-
| device | - The device structure. |
| init_param | - The structure that contains the device initial parameters. |
- Returns
- status - Result of the initialization procedure. Example: -1 - I2C peripheral was not initialized or ADP5589 part is not present. 0 - I2C peripheral is initialized and ADP5589 part is present.
◆ adp5589_init_key()
| void adp5589_init_key |
( |
struct adp5589_dev * | dev, |
|
|
uint8_t | pmod_port ) |
Initializes keyboard decoder.
- Parameters
-
| dev | - The device structure. |
| pmod_port | - J1 or J2 connector of PmodIOXP Example: PMOD_IOXP_J1 - J1 connector. PMOD_IOXP_J2 - J2 connector. |
◆ adp5589_init_pwm()
Initializes the PWM generator in continuous mode.
- Parameters
-
| dev | - The device structure. |
◆ adp5589_key_decode()
| uint8_t adp5589_key_decode |
( |
uint8_t | reg, |
|
|
uint8_t | event_type, |
|
|
uint8_t | pmod_port ) |
Decodes the key on the Pmod-KYPD.
- Parameters
-
| 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 |
- Returns
- key - Actual Key on the Pmod-KYPD.
◆ adp5589_key_lock()
| 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.
- Parameters
-
| 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. |
◆ adp5589_remove()
Free the resources allocated by adp5589_init().
- Parameters
-
| dev | - The device structure. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ adp5589_set_pin_state()
| void adp5589_set_pin_state |
( |
struct adp5589_dev * | dev, |
|
|
uint8_t | reg, |
|
|
uint8_t | state ) |
Sets the state of the pins.
- Parameters
-
| dev | - The device structure. |
| reg | - The address of the status register to be read. |
| state | - The value to be written to the pins. |
◆ adp5589_set_pwm()
| 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.
- Parameters
-
| 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. |
◆ adp5589_set_register_value()
| void adp5589_set_register_value |
( |
struct adp5589_dev * | dev, |
|
|
uint8_t | register_address, |
|
|
uint8_t | register_value ) |
Writes data into a register.
- Parameters
-
| dev | - The device structure. |
| register_address | - Address of the register. |
| register_value | - Data value to write. |