arduino - How to use pwm.h -


how can use esp8266 library pwm.h? if include library in arduino project, error: undefined reference pwm_init

i need 40khz sine wave ultrasonic sensor , analogwrite works bad @ high frequencies.

sorry, if answer obvious, have been googling problem few hours , can't find useful.

edit

i think correct pwm.c file. have put it? tried adding file project doesn't work. guess has dependencies other files in library. how add c library arduino project? , why not included in esp8266 core library if there header pwm.h?

the libpwm.a part of esp8266 sdk, if installed esp8266 addon arduino boards manager, library should in :

.arduino15/packages/esp8266/hardware/esp8266/<sdk version>/tools/sdk/lib/libpwm.a 

in order use pwm, should include in sketch pwm.h forcing c mangling :

extern "c" {   #include "pwm.h"  } 

then in order link libpwm.a should customize link command creating custom plateform configuration file .arduino15/packages/esp8266/hardware/esp8266/<sdk version>/platform.local.txt, adding

compiler.c.elf.extra_flags=-lpwm 

you can add line in plateform configuration file .arduino15/packages/esp8266/hardware/esp8266/<sdk version>/platform.txt


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -