aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/appl/eval-pollin/blocks/netio.frt
blob: 6c1f62cfa53c4a9f4a70e22225642a5c8da4744c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

\ Definitions for the netio-addon board

\ SPI communication pins
 PORTB 4 portpin: /ss
 PORTB 5 portpin: _mosi
 PORTB 6 portpin: _miso
 PORTB 7 portpin: _clk

\ setup the SPI pins
 : +spi ( -- )
 /ss high \ activate pullup!
 _mosi high _mosi pin_output
 _clk low _clk pin_output
 ;
 
 : -spi 0 SPCR c! ;

 \ transfer 1 cell
 : ><spi ( x -- x' )
 dup >< c!@spi
 swap c!@spi
 swap >< +
 ;

: +mmc
  /ss low
;
: -mmc
  /ss high
;