34 lines
844 B
OCaml
34 lines
844 B
OCaml
module Make () : Uxn.Device.DEVICE with type state = unit = struct
|
|
type state = unit
|
|
|
|
let state = ()
|
|
|
|
let dei_ports =
|
|
Uxn.Device.Int_set.of_list
|
|
[ 0xc0; 0xc2; 0xc3; 0xc4; 0xc5; 0xc6; 0xc7; 0xc8; 0xca ]
|
|
|
|
let deo_ports = Uxn.Device.Int_set.empty
|
|
|
|
let dei _ port =
|
|
let now = Unix.time () in
|
|
let tm = Unix.localtime now in
|
|
match port with
|
|
| 0xc2 -> tm.Unix.tm_mon
|
|
| 0xc3 -> tm.Unix.tm_mday
|
|
| 0xc4 -> tm.Unix.tm_hour
|
|
| 0xc5 -> tm.Unix.tm_min
|
|
| 0xc6 -> tm.Unix.tm_sec
|
|
| 0xc7 -> tm.Unix.tm_wday
|
|
| 0xca -> Bool.to_int tm.Unix.tm_isdst
|
|
| _ -> assert false
|
|
|
|
let dei2 _ port =
|
|
let now = Unix.time () in
|
|
let tm = Unix.localtime now in
|
|
match port with
|
|
| 0xc0 -> tm.Unix.tm_year + 1900
|
|
| 0xc8 -> tm.Unix.tm_yday
|
|
| _ -> assert false
|
|
|
|
let deo _ _ _ = assert false
|
|
end
|