hmmm i seem to cant find the port_pin_set_output_level you are talking to. According to the examples which i think access the registers directly, whcih looks pretty straight forward:
to set a pin HIGH
REG_PORT_DIRSET1 = PORT_PB27; // set PB27 to output
REG_PORT_OUTSET1 = PORT_PB27; // set PB27 HIGH
to set a pin LOW
REG_PORT_DIRSET1 = PORT_PB27; // set PB00 to output
REG_PORT_OUTCLR1 = PORT_PB27; // set PB00 LOW
and to toggle
REG_PORT_DIRSET1 = PORT_PB27; // set PB27 to output
REG_PORT_OUTTGL1 = PORT_PB27; // toggle PB27
Am i right or im missing something here.
How i think i will do this in actual is maybe to macro the thing where if somebody calls lets say digitalwrite(x,y). replace it with a set the corresponding two line of code like above, that for now is a problem for another day, since i have no idea how to make advance macros yet.