Private
Public Access
2
0

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:
Noel Eck
2017-04-17 11:55:02 -07:00
parent 3e19a58710
commit 87fda62759

View File

@@ -44,7 +44,7 @@ int pwm_dev_count = 0;
static mraa_pwm_context
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) {
APwm_delete(dev->bpwm);
return NULL;