peripheralman.c: Allocate pwm context for spi
Updated the mraa_pman_pwm_init_replace method to allocate heap space for the mraa_pwm_context (returned by this method. Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
@@ -44,7 +44,7 @@ int pwm_dev_count = 0;
|
|||||||
static mraa_pwm_context
|
static mraa_pwm_context
|
||||||
mraa_pman_pwm_init_replace(int pin)
|
mraa_pman_pwm_init_replace(int pin)
|
||||||
{
|
{
|
||||||
mraa_pwm_context dev;
|
mraa_pwm_context dev = (mraa_pwm_context) calloc(1, sizeof(struct _pwm));
|
||||||
if (APeripheralManagerClient_openPwm(client, pwm_devices[pin], &dev->bpwm) != 0) {
|
if (APeripheralManagerClient_openPwm(client, pwm_devices[pin], &dev->bpwm) != 0) {
|
||||||
APwm_delete(dev->bpwm);
|
APwm_delete(dev->bpwm);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user