SpenceKonde / megaTinyCore

Arduino core for the tinyAVR 0/1/2-series - Ones's digit 2,4,5,7 (pincount, 8,14,20,24), tens digit 0, 1, or 2 (featureset), preceded by flash in kb. Library maintainers: porting help available!
Other
544 stars 141 forks source link

CLKO PB5 enable #959

Closed moroz55555 closed 1 year ago

moroz55555 commented 1 year ago

Hello Tell me how to enable CLKO PB5 ?

SpenceKonde commented 1 year ago

Uh

uint8_t temp = CLKCTRLA.MCLKCTRLA;
temp |= 0x80;
__PROTECTED_WRITE(CLKCTRL_MCLKCTRLA,temp);

and then clock out will be enabled. if you know ytou're using internal osc, could even just

__PROTECTED_WRITE(CLKCTRL_MCLKCTRLA, 0x80);
moroz55555 commented 1 year ago

compiles only in this form without one underscore: _PROTECTED_WRITE(CLKCTRL_MCLKCTRLA, 0x80);

SpenceKonde commented 1 year ago

Sorry, I went to check how many underscores and got distracted implementing it.

SpenceKonde commented 1 year ago

This will be available as a feature of megaTinyCore.h (Though it is truly trivial to implement) from 2.6.8 onwards.