Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrewsclapp/5807423aec867583ce975de8ed9caa1f to your computer and use it in GitHub Desktop.
Save andrewsclapp/5807423aec867583ce975de8ed9caa1f to your computer and use it in GitHub Desktop.
\res MCU: STM8S103
\res export PA_ODR PA_DDR PA_CR1
#require WIPE
#require ]B!
\ #require 'IDLE
NVM
: INIT
[ 1 PA_DDR 3 ]B! \ set up pin for OUPUT - our output pin
[ 1 PA_CR1 3 ]B! \ set up pin for P-P
;
: LED! ( b -- )
PA_ODR 3 B!
;
VARIABLE timer
: tSet TIM 300 + timer ! ;
: tTest TIM timer @ - 0 < ;
: delay
1 LED!
tSet
begin
tTest
NOT until
0 LED!
tSet
begin
tTest
NOT until
;
: startup
INIT
[ ' delay ] LITERAL BG ! \ lights LED and locks up
\ [ ' delay ] LITERAL 'IDLE ! \ works, but sucks the console bad
;
' startup 'BOOT !
RAM
WIPE
#require PERSIST
PERSIST
RESET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment