sketchbook
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
moat.h
Go to the documentation of this file.
1 #ifndef MOAT_H
2 #define MOAT_H
3 
4 /*
5  * Copyright © 2010-2015, Matthias Urlichs <matthias@urlichs.de>
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License (included; see the file LICENSE)
16  * for more details.
17  */
18 
19 #include "jmp.h"
20 #include "features.h"
21 
22 /* Setup */
23 /* Called before enabling interrupts */
24 #ifndef init_state
25 void init_state(void);
26 #endif
27 
28 /* Your main loop. You need to poll_all() if you don't return. */
29 void mainloop(void);
30 
32 static inline void go_out(void) __attribute__((noreturn));
33 static inline void go_out(void) {
35 }
36 
37 /* Called to process commands. You implement this! */
38 void do_command(uint8_t cmd);
39 /*
40  Your code can do any one of:
41  * call xmit|recv_bit|byte, as required
42  * call next_command() (wait for next bus command, will not return)
43  * call next_idle() (wait for RESET pulse; will not return)
44 
45  If you need to run any expensive computations, do it in update_idle().
46  Your steps need to be short enough to observe the timing requirements
47  of the state you're currently in.
48 
49  Returning is equivalent to calling next_idle().
50  */
51 
52 /* Ditto, but called from idle / bit-wait context. You implement this! */
53 /* 'bits' says how many 1wire bit times are left. */
54 #ifndef update_idle
55 void update_idle(uint8_t bits);
56 #endif
57 
58 void moat_init(void);
59 void moat_poll(void);
60 
61 /* Implement if you need it. */
62 #ifdef CONDITIONAL_SEARCH
63 uint8_t condition_met(void);
64 #endif
65 
66 #endif // moat.h
void moat_poll(void)
Definition: moat.c:189
EXTERN q_jmp_buf _go_out
Definition: moat.h:31
void mainloop(void)
Definition: ds2408.c:109
#define EXTERN
Definition: features.h:28
void moat_init(void)
Definition: moat.c:204
void init_state(void)
Definition: ds2408.c:105
#define noreturn
Definition: stdnoreturn.h:27
char __v64qi __attribute__((__vector_size__(64)))
Definition: avx512bwintrin.h:33
void longjmp_q(q_jmp_buf _buf) __attribute__((__noreturn__))
void do_command(uint8_t cmd)
Definition: ds2408.c:88
struct _q_jmp_buf q_jmp_buf[1]
void update_idle(uint8_t bits)
Definition: ds2408.c:100