![]() |
Ultibo API
C/C++ API for Ultibo Core
|
Go to the source code of this file.
Data Structures | |
| struct | _PWM_PROPERTIES |
| struct | _PWM_DEVICE |
Macros | |
| #define | PWM_NAME_PREFIX "PWM" |
| Name prefix for PWM Devices. | |
| #define | PWM_TYPE_NONE 0 |
| #define | PWM_TYPE_MAX 0 |
| #define | PWM_STATE_DISABLED 0 |
| #define | PWM_STATE_ENABLED 1 |
| #define | PWM_STATE_MAX 1 |
| #define | PWM_FLAG_NONE 0x00000000 |
| #define | PWM_FLAG_GPIO 0x00000001 |
| Device supports Get/Set GPIO. | |
| #define | PWM_FLAG_MODE 0x00000002 |
| Device supports Get/Set Mode. | |
| #define | PWM_FLAG_RANGE 0x00000004 |
| Device supports Get/Set Range. | |
| #define | PWM_FLAG_FREQUENCY 0x00000008 |
| Device supports Get/Set Frequency. | |
| #define | PWM_FLAG_POLARITY 0x00000010 |
| Device supports Get/Set Polarity. | |
| #define | PWM_MODE_MARKSPACE 0 |
| Standard PWM Mark / Space mode. | |
| #define | PWM_MODE_BALANCED 1 |
| Balanced mode (Device specific). | |
| #define | PWM_MODE_SERIALIZED 2 |
| Serialized mode (Device specific). | |
| #define | PWM_MODE_MAX 2 |
| #define | PWM_POLARITY_NORMAL 0 |
| #define | PWM_POLARITY_INVERSE 1 |
| #define | PWM_POLARITY_MAX 1 |
Functions | |
| uint32_t STDCALL | pwm_device_start (PWM_DEVICE *pwm) |
| Start the specified PWM device. | |
| uint32_t STDCALL | pwm_device_stop (PWM_DEVICE *pwm) |
| Stop the specified PWM device. | |
| uint32_t STDCALL | pwm_device_write (PWM_DEVICE *pwm, uint32_t value) |
| Write a value to the specified PWM device. | |
| uint32_t STDCALL | pwm_device_get_gpio (PWM_DEVICE *pwm) |
| Get the GPIO pin used by the specified PWM device. | |
| uint32_t STDCALL | pwm_device_set_gpio (PWM_DEVICE *pwm, uint32_t gpio) |
| Set the GPIO pin used by the specified PWM device. | |
| uint32_t STDCALL | pwm_device_get_mode (PWM_DEVICE *pwm) |
| Get the current mode of the specified PWM device. | |
| uint32_t STDCALL | pwm_device_set_mode (PWM_DEVICE *pwm, uint32_t mode) |
| Set the current mode for the specified PWM device. | |
| uint32_t STDCALL | pwm_device_get_range (PWM_DEVICE *pwm) |
| Get the current range of the specified PWM device. | |
| uint32_t STDCALL | pwm_device_set_range (PWM_DEVICE *pwm, uint32_t range) |
| Set the current range for the specified PWM device. | |
| uint32_t STDCALL | pwm_device_get_frequency (PWM_DEVICE *pwm) |
| Get the clock frequency of the specified PWM device. | |
| uint32_t STDCALL | pwm_device_set_frequency (PWM_DEVICE *pwm, uint32_t frequency) |
| Set the clock frequency for the specified PWM device. | |
| uint32_t STDCALL | pwm_device_get_polarity (PWM_DEVICE *pwm) |
| Get the current polarity of the specified PWM device. | |
| uint32_t STDCALL | pwm_device_set_polarity (PWM_DEVICE *pwm, uint32_t polarity) |
| Set the current polarity for the specified PWM device. | |
| uint32_t STDCALL | pwm_device_configure (PWM_DEVICE *pwm, uint32_t dutyns, uint32_t periodns) |
| Set the configuration of the specified PWM device. | |
| uint32_t STDCALL | pwm_device_properties (PWM_DEVICE *pwm, PWM_PROPERTIES *properties) |
| Get the properties for the specified PWM device. | |
| uint32_t STDCALL | pwm_device_get_properties (PWM_DEVICE *pwm, PWM_PROPERTIES *properties) |
| Get the properties for the specified PWM device. | |
| PWM_DEVICE *STDCALL | pwm_device_create (void) |
| Create a new PWM entry. | |
| PWM_DEVICE *STDCALL | pwm_device_create_ex (uint32_t size) |
| Create a new PWM entry. | |
| uint32_t STDCALL | pwm_device_destroy (PWM_DEVICE *pwm) |
| Destroy an existing PWM entry. | |
| uint32_t STDCALL | pwm_device_register (PWM_DEVICE *pwm) |
| Register a new PWM in the PWM table. | |
| uint32_t STDCALL | pwm_device_deregister (PWM_DEVICE *pwm) |
| Deregister a PWM from the PWM table. | |
| PWM_DEVICE *STDCALL | pwm_device_find (uint32_t pwmid) |
| PWM_DEVICE *STDCALL | pwm_device_find_by_name (const char *name) |
| PWM_DEVICE *STDCALL | pwm_device_find_by_description (const char *description) |
| uint32_t STDCALL | pwm_device_enumerate (pwm_enumerate_cb callback, void *data) |
| uint32_t STDCALL | pwm_device_notification (PWM_DEVICE *pwm, pwm_notification_cb callback, void *data, uint32_t notification, uint32_t flags) |
| uint32_t STDCALL | pwm_get_count (void) |
| Get the current PWM count. | |
| PWM_DEVICE *STDCALL | pwm_device_get_default (void) |
| Get the current default PWM device. | |
| uint32_t STDCALL | pwm_device_set_default (PWM_DEVICE *pwm) |
| Set the current default PWM device. | |
| PWM_DEVICE *STDCALL | pwm_device_check (PWM_DEVICE *pwm) |
| Check if the supplied PWM is in the PWM table. | |
| uint32_t STDCALL | pwm_type_to_string (uint32_t pwmtype, char *string, uint32_t len) |
| Convert a PWM type value to a string. | |
| uint32_t STDCALL | pwm_state_to_string (uint32_t pwmstate, char *string, uint32_t len) |
| Convert a PWM state value to a string. | |
| uint32_t STDCALL | pwm_mode_to_string (uint32_t pwmmode, char *string, uint32_t len) |
| Convert a PWM mode value to a string. | |
| uint32_t STDCALL | pwm_polarity_to_string (uint32_t pwmpolarity, char *string, uint32_t len) |
| Convert a PWM polarity value to a string. | |
| #define PWM_NAME_PREFIX "PWM" |
Name prefix for PWM Devices.
PWM specific constants
| #define PWM_TYPE_NONE 0 |
PWM Device Types
| #define PWM_TYPE_MAX 0 |
| #define PWM_STATE_DISABLED 0 |
PWM Device States
| #define PWM_STATE_ENABLED 1 |
| #define PWM_STATE_MAX 1 |
| #define PWM_FLAG_NONE 0x00000000 |
PWM Device Flags
| #define PWM_FLAG_GPIO 0x00000001 |
Device supports Get/Set GPIO.
| #define PWM_FLAG_MODE 0x00000002 |
Device supports Get/Set Mode.
| #define PWM_FLAG_RANGE 0x00000004 |
Device supports Get/Set Range.
| #define PWM_FLAG_FREQUENCY 0x00000008 |
Device supports Get/Set Frequency.
| #define PWM_FLAG_POLARITY 0x00000010 |
Device supports Get/Set Polarity.
| #define PWM_MODE_MARKSPACE 0 |
Standard PWM Mark / Space mode.
PWM Mode Values
| #define PWM_MODE_BALANCED 1 |
Balanced mode (Device specific).
| #define PWM_MODE_SERIALIZED 2 |
Serialized mode (Device specific).
| #define PWM_MODE_MAX 2 |
| #define PWM_POLARITY_NORMAL 0 |
PWM Polarity Values
| #define PWM_POLARITY_INVERSE 1 |
| #define PWM_POLARITY_MAX 1 |
| typedef struct _PWM_PROPERTIES PWM_PROPERTIES |
PWM specific types PWM Properties
| typedef struct _PWM_DEVICE PWM_DEVICE |
PWM Device
| typedef uint32_t STDCALL(* pwm_enumerate_cb) (PWM_DEVICE *pwm, void *data) |
PWM Enumeration Callback
PWM Notification Callback
| typedef uint32_t STDCALL(* pwm_device_start_proc) (PWM_DEVICE *pwm) |
PWM Device Methods
| typedef uint32_t STDCALL(* pwm_device_stop_proc) (PWM_DEVICE *pwm) |
| typedef uint32_t STDCALL(* pwm_device_write_proc) (PWM_DEVICE *pwm, uint32_t value) |
| typedef uint32_t STDCALL(* pwm_device_get_gpio_proc) (PWM_DEVICE *pwm) |
| typedef uint32_t STDCALL(* pwm_device_set_gpio_proc) (PWM_DEVICE *pwm, uint32_t gpio) |
| typedef uint32_t STDCALL(* pwm_device_get_mode_proc) (PWM_DEVICE *pwm) |
| typedef uint32_t STDCALL(* pwm_device_set_mode_proc) (PWM_DEVICE *pwm, uint32_t mode) |
| typedef uint32_t STDCALL(* pwm_device_get_range_proc) (PWM_DEVICE *pwm) |
| typedef uint32_t STDCALL(* pwm_device_set_range_proc) (PWM_DEVICE *pwm, uint32_t range) |
| typedef uint32_t STDCALL(* pwm_device_get_frequency_proc) (PWM_DEVICE *pwm) |
| typedef uint32_t STDCALL(* pwm_device_set_frequency_proc) (PWM_DEVICE *pwm, uint32_t frequency) |
| typedef uint32_t STDCALL(* pwm_device_get_polarity_proc) (PWM_DEVICE *pwm) |
| typedef uint32_t STDCALL(* pwm_device_set_polarity_proc) (PWM_DEVICE *pwm, uint32_t polarity) |
| typedef uint32_t STDCALL(* pwm_device_configure_proc) (PWM_DEVICE *pwm, uint32_t dutyns, uint32_t periodns) |
| typedef uint32_t STDCALL(* pwm_device_get_properties_proc) (PWM_DEVICE *pwm, PWM_PROPERTIES *properties) |
| uint32_t STDCALL pwm_device_start | ( | PWM_DEVICE * | pwm | ) |
Start the specified PWM device.
PWM Functions
| PWM | The PWM device to start |
| uint32_t STDCALL pwm_device_stop | ( | PWM_DEVICE * | pwm | ) |
Stop the specified PWM device.
| PWM | The PWM device to stop |
| uint32_t STDCALL pwm_device_write | ( | PWM_DEVICE * | pwm, |
| uint32_t | value ) |
Write a value to the specified PWM device.
| PWM | The PWM device to write to |
| Value | The value to write |
| uint32_t STDCALL pwm_device_get_gpio | ( | PWM_DEVICE * | pwm | ) |
Get the GPIO pin used by the specified PWM device.
| PWM | The PWM device to get the GPIO pin from |
| uint32_t STDCALL pwm_device_set_gpio | ( | PWM_DEVICE * | pwm, |
| uint32_t | gpio ) |
Set the GPIO pin used by the specified PWM device.
| PWM | The PWM device to set the GPIO pin for |
| GPIO | The GPIO pin to set (eg GPIO_PIN_12) |
| uint32_t STDCALL pwm_device_get_mode | ( | PWM_DEVICE * | pwm | ) |
Get the current mode of the specified PWM device.
| PWM | The PWM device to get the mode from |
| uint32_t STDCALL pwm_device_set_mode | ( | PWM_DEVICE * | pwm, |
| uint32_t | mode ) |
Set the current mode for the specified PWM device.
| PWM | The PWM device to set the mode for |
| Mode | The mode value to set (eg PWM_MODE_MARKSPACE) |
| uint32_t STDCALL pwm_device_get_range | ( | PWM_DEVICE * | pwm | ) |
Get the current range of the specified PWM device.
| PWM | The PWM device to get the range from |
| uint32_t STDCALL pwm_device_set_range | ( | PWM_DEVICE * | pwm, |
| uint32_t | range ) |
Set the current range for the specified PWM device.
| PWM | The PWM device to set the clock rate for |
| Range | The range value to set |
| uint32_t STDCALL pwm_device_get_frequency | ( | PWM_DEVICE * | pwm | ) |
Get the clock frequency of the specified PWM device.
| PWM | The PWM device to get the clock frequency from |
| uint32_t STDCALL pwm_device_set_frequency | ( | PWM_DEVICE * | pwm, |
| uint32_t | frequency ) |
Set the clock frequency for the specified PWM device.
| PWM | The PWM device to set the clock frequency for |
| Frequency | The clock frequency to set in Hz |
| uint32_t STDCALL pwm_device_get_polarity | ( | PWM_DEVICE * | pwm | ) |
Get the current polarity of the specified PWM device.
| PWM | The PWM device to get the polarity from |
| uint32_t STDCALL pwm_device_set_polarity | ( | PWM_DEVICE * | pwm, |
| uint32_t | polarity ) |
Set the current polarity for the specified PWM device.
| PWM | The PWM device to set the polarity for |
| Polarity | The polarity value to set (eg PWM_POLARITY_NORMAL) |
| uint32_t STDCALL pwm_device_configure | ( | PWM_DEVICE * | pwm, |
| uint32_t | dutyns, | ||
| uint32_t | periodns ) |
Set the configuration of the specified PWM device.
| PWM | The PWM device to set the configuration for |
| DutyNS | The "on" time part of the cycle (Nanoseconds) |
| PeriodNS | The duration of one full cycle (Nanoseconds) |
| uint32_t STDCALL pwm_device_properties | ( | PWM_DEVICE * | pwm, |
| PWM_PROPERTIES * | properties ) |
Get the properties for the specified PWM device.
| PWM | The PWM device to get properties from |
| Properties | Pointer to a TPWMProperties structure to fill in |
| uint32_t STDCALL pwm_device_get_properties | ( | PWM_DEVICE * | pwm, |
| PWM_PROPERTIES * | properties ) |
Get the properties for the specified PWM device.
| PWM | The PWM device to get properties from |
| Properties | Pointer to a TPWMProperties structure to fill in |
| PWM_DEVICE *STDCALL pwm_device_create | ( | void | ) |
Create a new PWM entry.
| PWM_DEVICE *STDCALL pwm_device_create_ex | ( | uint32_t | size | ) |
Create a new PWM entry.
| Size | Size in bytes to allocate for new PWM (Including the PWM entry) |
| uint32_t STDCALL pwm_device_destroy | ( | PWM_DEVICE * | pwm | ) |
Destroy an existing PWM entry.
| uint32_t STDCALL pwm_device_register | ( | PWM_DEVICE * | pwm | ) |
Register a new PWM in the PWM table.
| uint32_t STDCALL pwm_device_deregister | ( | PWM_DEVICE * | pwm | ) |
Deregister a PWM from the PWM table.
| PWM_DEVICE *STDCALL pwm_device_find | ( | uint32_t | pwmid | ) |
| PWM_DEVICE *STDCALL pwm_device_find_by_name | ( | const char * | name | ) |
| PWM_DEVICE *STDCALL pwm_device_find_by_description | ( | const char * | description | ) |
| uint32_t STDCALL pwm_device_enumerate | ( | pwm_enumerate_cb | callback, |
| void * | data ) |
| uint32_t STDCALL pwm_device_notification | ( | PWM_DEVICE * | pwm, |
| pwm_notification_cb | callback, | ||
| void * | data, | ||
| uint32_t | notification, | ||
| uint32_t | flags ) |
| uint32_t STDCALL pwm_get_count | ( | void | ) |
Get the current PWM count.
PWM Helper Functions
| PWM_DEVICE *STDCALL pwm_device_get_default | ( | void | ) |
Get the current default PWM device.
| uint32_t STDCALL pwm_device_set_default | ( | PWM_DEVICE * | pwm | ) |
Set the current default PWM device.
| PWM_DEVICE *STDCALL pwm_device_check | ( | PWM_DEVICE * | pwm | ) |
Check if the supplied PWM is in the PWM table.
| uint32_t STDCALL pwm_type_to_string | ( | uint32_t | pwmtype, |
| char * | string, | ||
| uint32_t | len ) |
Convert a PWM type value to a string.
| uint32_t STDCALL pwm_state_to_string | ( | uint32_t | pwmstate, |
| char * | string, | ||
| uint32_t | len ) |
Convert a PWM state value to a string.
| uint32_t STDCALL pwm_mode_to_string | ( | uint32_t | pwmmode, |
| char * | string, | ||
| uint32_t | len ) |
Convert a PWM mode value to a string.
| uint32_t STDCALL pwm_polarity_to_string | ( | uint32_t | pwmpolarity, |
| char * | string, | ||
| uint32_t | len ) |
Convert a PWM polarity value to a string.