Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
%DASHBOARD{ section="banner" | ||||||||
Line: 17 to 17 | ||||||||
Defaults: Digital port pins D0 to D7 are push pull outputs, D8 to D15 are inputs with pull-up resistors.
| ||||||||
Changed: | ||||||||
< < | led1! ( n -- ) sets LED1 (blue) led2! ( n -- ) sets LED2 (green) led3! ( n -- ) sets LED3 (red) led1@ ( -- n ) gets LED1 (blue) led2@ ( -- n ) gets LED2 (green) led3@ ( -- n ) gets LED3 (red) switch1? ( -- n ) gets switch1, closed=TRUE switch2? ( -- n ) gets switch2, closed=TRUE switch3? ( -- n ) gets switch3, closed=TRUE dport! ( n -- ) sets the digital output port (D0=bit0 .. D15=bit15). dport@ ( -- n ) gets the digital input/output port (D0=bit0 .. D15=bit15). dpin! ( n a -- ) sets the digital output port pin (D0=0 .. D15=15) dpin@ ( a -- n ) gets the digital input/output port pin dmod ( u a -- ) sets the pin mode: 0 in, 1 in pull-up, 2 in pull-down, 3 out push pull, 4 out open drain, | |||||||
> > | led1! ( ? -- ) set LED1 (blue) led2! ( ? -- ) set LED2 (green) led3! ( ? -- ) set LED3 (red) led1@ ( -- ? ) get LED1 (blue) led2@ ( -- ? ) get LED2 (green) led3@ ( -- ? ) get LED3 (red) switch1? ( -- ? ) get switch1, closed=TRUE switch2? ( -- ? ) get switch2, closed=TRUE switch3? ( -- ? ) get switch3, closed=TRUE dport! ( n -- ) set the digital output port (D0=bit0 .. D15=bit15). dport@ ( -- n ) get the digital input/output port (D0=bit0 .. D15=bit15). dpin! ( n a -- ) set the digital output port pin (D0=0 .. D15=15) dpin@ ( a -- n ) get the digital input/output port pin dmod ( u a -- ) set the pin mode: 0 in, 1 in pull-up, 2 in pull-down, 3 out push pull, 4 out open drain, | |||||||
5 out push pull PWM, 6 input capture, 7 output compare, 8 I2C | ||||||||
Changed: | ||||||||
< < | EXTImod ( u a -- ) Sets for pin a (D2, D4, D7, D10) the EXTI mode u: 0 rising, 1 falling, 2 both edges, 3 none EXTIwait ( u a -- ) Wait for EXTI interrupt on pin a (D2, D4, D7, D10), timeout u in [ms] | |||||||
> > | EXTImod ( u a -- ) set for pin a (D2, D4, D7, D10) the EXTI mode u: 0 rising, 1 falling, 2 both edges, 3 none EXTIwait ( u a -- ) wait for EXTI interrupt on pin a (D2, D4, D7, D10), timeout u in [ms] | |||||||
Changed: | ||||||||
< < | pwmpin! ( u a -- ) sets the digital output port pin a (D3=3, D6=6, D9=9) to a PWM value u (0..1000). Default frequency is 1 kHz, TIMER1 pwmprescale ( u -- ) Sets the PWM prescale for TIMER1. 32 kHz / prescale, default 32 -> PWM frequency 1 kHz | |||||||
> > | pwmpin! ( u a -- ) set the digital output port pin a (D3=3, D6=6, D9=9) to a PWM value u (0..1000). Default frequency is 1 kHz, TIMER1 pwmprescale ( u -- ) Set the PWM prescale for TIMER1. 32 kHz / prescale, default 32 -> PWM frequency 1 kHz | |||||||
Changed: | ||||||||
< < | ICOCprescale ( u -- ) Sets the input capture / output compare prescale for TIMER2. default 32 -> 32 MHz / 32 = 1 MHz, timer resolution 1 us ICOCperiod! ( u -- ) Sets the input capture / output compare (TIMER2) period. default $FFFFFFFF (4'294'967'295). | |||||||
> > | ICOCprescale ( u -- ) set the input capture / output compare prescale for TIMER2. default 32 -> 32 MHz / 32 = 1 MHz, timer resolution 1 us ICOCperiod! ( u -- ) set the input capture / output compare (TIMER2) period. default $FFFFFFFF (4'294'967'295). | |||||||
When the up counter reaches the period, the counter is set to 0. For prescale 32 the maximum time is about 1 h 11 m | ||||||||
Changed: | ||||||||
< < | ICOCcount! ( -- u ) Sets the input capture / output compare counter for TIMER2 ICOCcount@ ( u -- ) Gets the input capture / output compare counter for TIMER2 ICOCstart ( -- ) Starts the ICOC period ICOCstop ( -- ) Stops the ICOC period OCmod ( u a -- ) Sets for pin a (D0, D1, D5) the Output Compare mode u: 0 frozen, 1 active level on match, 2 inactive level on match, | |||||||
> > | ICOCcount! ( -- u ) set the input capture / output compare counter for TIMER2 ICOCcount@ ( u -- ) get the input capture / output compare counter for TIMER2 ICOCstart ( -- ) start the ICOC period ICOCstop ( -- ) stop the ICOC period OCmod ( u a -- ) set for pin a (D0, D1, D5) the Output Compare mode u: 0 frozen, 1 active level on match, 2 inactive level on match, | |||||||
3 toggle on match, 4 forced active, 5 forced inactive | ||||||||
Changed: | ||||||||
< < | OCstart ( u a -- ) Starts the output compare mode for pin a with pulse u OCstop ( a -- ) Stops output compare for pin a ICstart ( u -- ) Starts input capture u: 0 rising edge, 1 falling edge, 2 both edges ICstop ( -- ) Stops input capture | |||||||
> > | OCstart ( u a -- ) start the output compare mode for pin a with pulse u OCstop ( a -- ) stop output compare for pin a ICstart ( u -- ) start input capture u: 0 rising edge, 1 falling edge, 2 both edges ICstop ( -- ) stop input capture | |||||||
waitperiod ( -- ) wait for the end of the TIMER2 period OCwait ( a -- ) wait for the end of output capture on pin a ICwait ( u -- u ) wait for the end of input capture with timeout u, returns counter u | ||||||||
Changed: | ||||||||
< < | apin@ ( a -- u ) gets the analog input port pin (A0 .. A5). Returns a 12 bit value (0..4095) I2Cdev ( u -- ) Sets the 7-bit I2C address I2Cput ( c-addr u -- ) put a message with length u from buffer at c-addr to the I2C slave device I2Cget ( c-addr u -- ) get a message with length u from I2C slave device to buffer at c-addr I2Cputget ( a1 u1 a2 u2 -- ) put a message with length u1 from buffer at a1 to the I2C slave device and get a message with length u2 from device to buffer at a2 SPIputget ( a1 a2 u -- ) put a message with length u from buffer at a1 to the SPI slave device and get a message with length u from device to buffer at a2 SPIputc ( char ) put a single char to the SPI slave device | |||||||
> > | apin@ ( a -- u ) get the analog input port pin (A0 .. A5). Returns a 12 bit value (0..4095) vref@ ( -- u ) get the Vref voltage in mV (rather the VDDA) vbat@ ( -- u ) get the Vbat voltage in mV CPUtemp@ ( -- u ) get CPU temperature in degree Celsius I2Cput ( a # u -- ) put a message with length u (count in bytes) from buffer at a to the I2C slave device u I2Cget ( a # u -- ) get a message with length u from I2C slave device to buffer at a I2Cputget ( a #1 #2 u -- ) put a message with length #1 from buffer at a to the I2C slave device u and get a message with length #2 from device to buffer at a SPIget ( a # -- ) get a message with length # from SPI slave device to buffer at a SPIput ( a # -- ) put a message with length # from buffer at a to the SPI slave device SPIputget ( a #1 #2 -- ) put a message with length #1 from buffer at a to the SPI slave device and get a message with length #2 from device to buffer at a SPImutex ( -- a ) get the SPI mutex address | |||||||
Line: 83 to 87 | ||||||||
3 0 dmod \ set D0 to Output 3 1 dmod \ set D1 to Output | ||||||||
Added: | ||||||||
> > | 3 2 dmod \ set D2 to Output | |||||||
3 3 dmod \ set D3 to Output | ||||||||
Added: | ||||||||
> > | 3 4 dmod \ set D4 to Output | |||||||
3 5 dmod \ set D5 to Output 3 6 dmod \ set D6 to Output | ||||||||
Added: | ||||||||
> > | 3 7 dmod \ set D7 to Output | |||||||
|