Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Custom c module
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Custom c module

by smccamy1 on Tue Sep 15, 2020 12:20 am

Hello,

I am trying to add a custom c module and wanted to see if anyone has any updated information on doing this. I am following the guide linked below but it mentions it may be dated. The last section on editing mpconfigport.h does not appear to match what is in later versions. I am also not sure if any of the previous steps are still relevant or not, but they do line up as far as directories and references within the files.

Any assistance is appreciated. I am building for a samd21 if that matters.


https://learn.adafruit.com/extending-ci ... al-machine

mpconfigport.h
There are two places in this file that need an addition.

First we need to add our new module. Look for a comment very similar to

// extra built in modules to add to the list of known ones

Add a line to the list immediately following it, similar to the rest. The difference in what you add will be that it mentions your new module:

extern const struct _mp_obj_module_t mymodule_module;

The second thing to do is add your module to the EXTRA_BUILTIN_MODULES macro, with a line like the others there:

{ MP_OBJ_NEW_QSTR(MP_QSTR_mymodule), (mp_obj_t)&mymodule_module }, \

Don't forget that reverse slash at the end of the line.

smccamy1
 
Posts: 21
Joined: Tue May 17, 2016 8:57 pm

Re: Custom c module

by tannewt on Tue Sep 15, 2020 1:44 pm

Hi! This section has been centralized here: https://github.com/adafruit/circuitpyth ... mpconfig.h

The changes should be similar to before. There are also two .mk files there that may contain similar changes.

tannewt
 
Posts: 1784
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.