Browse Source

Finish up the public API of the library

All the internal functions and definitions have been moved out of
lib/include/.  Includes are made with the semantically correct brackets
("" or <>) throughout the firmware and library.  That is to say, the
library is essentially done at this point, with only documentation
changes left to be made.
Clara Hobbs 7 years ago
parent
commit
2859a7a2ec

+ 1
- 2
lib/include/pdb_dpm.h View File

21
 
21
 
22
 #include <stdbool.h>
22
 #include <stdbool.h>
23
 
23
 
24
+#include <pdb_fusb.h>
24
 #include <pdb_msg.h>
25
 #include <pdb_msg.h>
25
-/* TODO: improve this include */
26
-#include "fusb302b.h"
27
 
26
 
28
 
27
 
29
 /* Forward declaration of struct pdb_config */
28
 /* Forward declaration of struct pdb_config */

+ 16
- 0
lib/include/pdb_fusb.h View File

21
 
21
 
22
 #include <hal.h>
22
 #include <hal.h>
23
 
23
 
24
+/* I2C addresses of the FUSB302B chips */
25
+#define FUSB302B_ADDR 0x22
26
+#define FUSB302B01_ADDR 0x23
27
+#define FUSB302B10_ADDR 0x24
28
+#define FUSB302B11_ADDR 0x25
29
+
24
 
30
 
25
 /*
31
 /*
26
  * Configuration for the FUSB302B chip
32
  * Configuration for the FUSB302B chip
32
     i2caddr_t addr;
38
     i2caddr_t addr;
33
 };
39
 };
34
 
40
 
41
+/*
42
+ * FUSB Type-C Current level enum
43
+ */
44
+enum fusb_typec_current {
45
+    fusb_tcc_none = 0,
46
+    fusb_tcc_default = 1,
47
+    fusb_tcc_1_5 = 2,
48
+    fusb_tcc_3_0 = 3
49
+};
50
+
35
 
51
 
36
 #endif /* PDB_FUSB_H */
52
 #endif /* PDB_FUSB_H */

+ 1
- 1
lib/src/fusb302b.c View File

21
 #include <ch.h>
21
 #include <ch.h>
22
 #include <hal.h>
22
 #include <hal.h>
23
 
23
 
24
-#include "pd.h"
24
+#include <pd.h>
25
 
25
 
26
 
26
 
27
 /*
27
 /*

lib/include/fusb302b.h → lib/src/fusb302b.h View File

26
 #include <pdb_msg.h>
26
 #include <pdb_msg.h>
27
 
27
 
28
 
28
 
29
-/* I2C addresses of the FUSB302B chips */
30
-#define FUSB302B_ADDR 0x22
31
-#define FUSB302B01_ADDR 0x23
32
-#define FUSB302B10_ADDR 0x24
33
-#define FUSB302B11_ADDR 0x25
34
-
35
 /* Device ID register */
29
 /* Device ID register */
36
 #define FUSB_DEVICE_ID 0x01
30
 #define FUSB_DEVICE_ID 0x01
37
 #define FUSB_DEVICE_ID_VERSION_ID_SHIFT 4
31
 #define FUSB_DEVICE_ID_VERSION_ID_SHIFT 4
267
     };
261
     };
268
 };
262
 };
269
 
263
 
270
-/*
271
- * FUSB Type-C Current level enum
272
- */
273
-enum fusb_typec_current {
274
-    fusb_tcc_none = 0,
275
-    fusb_tcc_default = 1,
276
-    fusb_tcc_1_5 = 2,
277
-    fusb_tcc_3_0 = 3
278
-};
279
-
280
 
264
 
281
 /* FUSB functions */
265
 /* FUSB functions */
282
 
266
 

+ 1
- 1
lib/src/hard_reset.c View File

18
 
18
 
19
 #include "hard_reset.h"
19
 #include "hard_reset.h"
20
 
20
 
21
+#include <pd.h>
21
 #include "priorities.h"
22
 #include "priorities.h"
22
 #include "policy_engine.h"
23
 #include "policy_engine.h"
23
 #include "protocol_rx.h"
24
 #include "protocol_rx.h"
24
 #include "protocol_tx.h"
25
 #include "protocol_tx.h"
25
 #include "fusb302b.h"
26
 #include "fusb302b.h"
26
-#include "pd.h"
27
 
27
 
28
 
28
 
29
 /*
29
 /*

+ 1
- 1
lib/src/policy_engine.c View File

20
 
20
 
21
 #include <stdbool.h>
21
 #include <stdbool.h>
22
 
22
 
23
+#include <pd.h>
23
 #include "priorities.h"
24
 #include "priorities.h"
24
 #include "protocol_tx.h"
25
 #include "protocol_tx.h"
25
 #include "hard_reset.h"
26
 #include "hard_reset.h"
26
 #include "fusb302b.h"
27
 #include "fusb302b.h"
27
-#include "pd.h"
28
 
28
 
29
 
29
 
30
 enum policy_engine_state {
30
 enum policy_engine_state {

+ 1
- 1
lib/src/protocol_rx.c View File

20
 
20
 
21
 #include <stdlib.h>
21
 #include <stdlib.h>
22
 
22
 
23
+#include <pd.h>
23
 #include "priorities.h"
24
 #include "priorities.h"
24
 #include "policy_engine.h"
25
 #include "policy_engine.h"
25
 #include "protocol_tx.h"
26
 #include "protocol_tx.h"
26
 #include "fusb302b.h"
27
 #include "fusb302b.h"
27
-#include "pd.h"
28
 
28
 
29
 
29
 
30
 /*
30
 /*

+ 1
- 1
lib/src/protocol_tx.c View File

18
 
18
 
19
 #include "protocol_tx.h"
19
 #include "protocol_tx.h"
20
 
20
 
21
+#include <pd.h>
21
 #include "priorities.h"
22
 #include "priorities.h"
22
 #include "policy_engine.h"
23
 #include "policy_engine.h"
23
 #include "protocol_rx.h"
24
 #include "protocol_rx.h"
24
 #include "fusb302b.h"
25
 #include "fusb302b.h"
25
-#include "pd.h"
26
 
26
 
27
 
27
 
28
 /*
28
 /*

+ 1
- 1
src/config.c View File

20
 
20
 
21
 #include "chprintf.h"
21
 #include "chprintf.h"
22
 
22
 
23
-#include "pd.h"
23
+#include <pd.h>
24
 
24
 
25
 
25
 
26
 /* Initialize the location of the configuration array.  PDBS_CONFIG_BASE is set
26
 /* Initialize the location of the configuration array.  PDBS_CONFIG_BASE is set

+ 2
- 1
src/device_policy_manager.c View File

22
 
22
 
23
 #include <hal.h>
23
 #include <hal.h>
24
 
24
 
25
+#include <pd.h>
26
+
25
 #include "led.h"
27
 #include "led.h"
26
 #include "config.h"
28
 #include "config.h"
27
-#include "pd.h"
28
 
29
 
29
 
30
 
30
 /* The current draw when the output is disabled */
31
 /* The current draw when the output is disabled */

+ 0
- 1
src/device_policy_manager.h View File

22
 #include <stdbool.h>
22
 #include <stdbool.h>
23
 
23
 
24
 #include <pdb.h>
24
 #include <pdb.h>
25
-#include "fusb302b.h"
26
 
25
 
27
 
26
 
28
 struct pdbs_dpm_data {
27
 struct pdbs_dpm_data {

+ 1
- 1
src/main.c View File

39
 #include "usbcfg.h"
39
 #include "usbcfg.h"
40
 
40
 
41
 #include <pdb.h>
41
 #include <pdb.h>
42
+#include <pd.h>
42
 #include "led.h"
43
 #include "led.h"
43
 #include "device_policy_manager.h"
44
 #include "device_policy_manager.h"
44
-#include "pd.h"
45
 
45
 
46
 /*
46
 /*
47
  * I2C configuration object.
47
  * I2C configuration object.

+ 1
- 1
src/shell.c View File

40
 #include "chprintf.h"
40
 #include "chprintf.h"
41
 
41
 
42
 #include <pdb.h>
42
 #include <pdb.h>
43
+#include <pd.h>
43
 #include "usbcfg.h"
44
 #include "usbcfg.h"
44
 #include "config.h"
45
 #include "config.h"
45
 #include "led.h"
46
 #include "led.h"
46
 #include "device_policy_manager.h"
47
 #include "device_policy_manager.h"
47
-#include "pd.h"
48
 
48
 
49
 
49
 
50
 /* Buffer for unwritten configuration */
50
 /* Buffer for unwritten configuration */

Loading…
Cancel
Save