RTEMS 6.1-rc5
|
Support for eQEP for the BeagleBone Black. More...
#include <libcpu/am335x.h>
#include <stdio.h>
#include <stdlib.h>
#include <bsp/gpio.h>
#include <bsp/bbb-gpio.h>
#include <bsp.h>
#include <bsp/pwmss.h>
#include <bsp/qep.h>
#include <bsp/beagleboneblack.h>
Functions | |
rtems_status_code | beagle_qep_init (BBB_PWMSS pwmss_id) |
Initialises the eQEP module of the specified PWMSS unit. This configures the clocks, sets up the interrupt handler and unit timer, The module is configured in Quadrature decode mode using absolute position by default. | |
rtems_status_code | beagle_qep_enable (BBB_PWMSS pwmss_id) |
Enables the eQEP module of the specified PWMSS unit. | |
rtems_status_code | beagle_qep_disable (BBB_PWMSS pwmss_id) |
Disables the eQEP module of the specified PWMSS unit. | |
rtems_status_code | beagle_qep_pinmux_setup (bbb_qep_pin pin_no, BBB_PWMSS pwmss_id, bool pullup_enable) |
Configures a given pin for use with the eQEP function of the supplied PWMSS module. | |
int32_t | beagle_qep_get_position (BBB_PWMSS pwmss_id) |
Returns the current position value of the eQEP function for the specified PWMSS module. | |
rtems_status_code | beagle_qep_set_position (BBB_PWMSS pwmss_id, uint32_t position) |
Sets the initial position value of the eQEP function for the specified PWMSS module. | |
rtems_status_code | beagle_qep_set_count_mode (BBB_PWMSS pwmss_id, BBB_QEP_COUNT_MODE mode) |
Sets the count mode for the eQEP module. | |
BBB_QEP_COUNT_MODE | beagle_qep_get_count_mode (BBB_PWMSS pwmss_id) |
Gets the currently configured count mode for the eQEP module. | |
rtems_status_code | beagle_qep_set_quadrature_mode (BBB_PWMSS pwmss_id, BBB_QEP_QUADRATURE_MODE mode) |
Sets the quadrature mode to either absolute or relative. | |
BBB_QEP_QUADRATURE_MODE | beagle_qep_get_quadrature_mode (BBB_PWMSS pwmss_id) |
Returns the currently configured quadrature mode - either absolute, or relative. | |
uint32_t | beagle_eqep_get_timer_period (BBB_PWMSS pwmss_id) |
Returns the the currently configured unit timer period. | |
rtems_status_code | beagle_eqep_set_timer_period (BBB_PWMSS pwmss_id, uint64_t period, bbb_eqep_timer_callback timer_callback, void *user) |
Sets the unit timer period for the eQEP module. 0 = off, greater than zero sets the period. | |
Support for eQEP for the BeagleBone Black.
uint32_t beagle_eqep_get_timer_period | ( | BBB_PWMSS | pwmss_id | ) |
Returns the the currently configured unit timer period.
pwmss_id | Identifies which PWMSS module to get the eQEP timer value for |
rtems_status_code beagle_eqep_set_timer_period | ( | BBB_PWMSS | pwmss_id, |
uint64_t | period, | ||
bbb_eqep_timer_callback | timer_callback, | ||
void * | user | ||
) |
Sets the unit timer period for the eQEP module. 0 = off, greater than zero sets the period.
pwmss_id | Identifies which PWMSS module to set the eQEP unit timer for. |
period | The value in nanoseconds to set the unit timer period to. |
timer_callback | This is the user provided callback function that will be called by the interrupt event handler on expiry of the unit timer. The user can provide NULL if they don't require a call back. |
user | This is a pointer to a user provided data structure that will be handed back as an argument to the timer callback. The driver does not touch this value. |
rtems_status_code beagle_qep_disable | ( | BBB_PWMSS | pwmss_id | ) |
Disables the eQEP module of the specified PWMSS unit.
pwmss_id | The PWMSS module which will have the eQEP function disabled. |
rtems_status_code beagle_qep_enable | ( | BBB_PWMSS | pwmss_id | ) |
Enables the eQEP module of the specified PWMSS unit.
pwmss_id | The PWMSS module which will have the eQEP function enabled. |
BBB_QEP_COUNT_MODE beagle_qep_get_count_mode | ( | BBB_PWMSS | pwmss_id | ) |
Gets the currently configured count mode for the eQEP module.
pwmss_id | Identifies which PWMSS module to set the eQEP count mode for. |
int32_t beagle_qep_get_position | ( | BBB_PWMSS | pwmss_id | ) |
Returns the current position value of the eQEP function for the specified PWMSS module.
pwmss_id | Identifies which PWMSS module to return the eQEP position for |
BBB_QEP_QUADRATURE_MODE beagle_qep_get_quadrature_mode | ( | BBB_PWMSS | pwmss_id | ) |
Returns the currently configured quadrature mode - either absolute, or relative.
pwmss_id | Identifies which PWMSS module to get the eQEP quadrature mode for. |
rtems_status_code beagle_qep_init | ( | BBB_PWMSS | pwmss_id | ) |
Initialises the eQEP module of the specified PWMSS unit. This configures the clocks, sets up the interrupt handler and unit timer, The module is configured in Quadrature decode mode using absolute position by default.
pwmss_id | The PWMSS module to configure the eQEP for. |
rtems_status_code beagle_qep_pinmux_setup | ( | bbb_qep_pin | pin_no, |
BBB_PWMSS | pwmss_id, | ||
bool | pullup_enable | ||
) |
Configures a given pin for use with the eQEP function of the supplied PWMSS module.
pin_no | The P9 or P8 header pin to be configured for the eQEP function. |
pwmss_id | The PWMSS module which will have the eQEP function enabled. |
pullup_enable | If true then the internal pull up resistor on the specified pin will be enabled, if false the pull down will be enabled. |
rtems_status_code beagle_qep_set_count_mode | ( | BBB_PWMSS | pwmss_id, |
BBB_QEP_COUNT_MODE | mode | ||
) |
Sets the count mode for the eQEP module.
pwmss_id | Identifies which PWMSS module to set the eQEP count mode for. |
mode | One of the above modes to configure the eQEP module for. |
rtems_status_code beagle_qep_set_position | ( | BBB_PWMSS | pwmss_id, |
uint32_t | position | ||
) |
Sets the initial position value of the eQEP function for the specified PWMSS module.
pwmss_id | Identifies which PWMSS module to set the eQEP position for |
position | The value to initialise the position register with. |
rtems_status_code beagle_qep_set_quadrature_mode | ( | BBB_PWMSS | pwmss_id, |
BBB_QEP_QUADRATURE_MODE | mode | ||
) |
Sets the quadrature mode to either absolute or relative.
pwmss_id | Identifies which PWMSS module to set the eQEP quadrature mode for. |
mode | BBB_QEP_QUADRATURE_MODE Set the mode of the eQEP to either absolute or relative. |