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,9 +21,8 @@
21 21
 
22 22
 #include <stdbool.h>
23 23
 
24
+#include <pdb_fusb.h>
24 25
 #include <pdb_msg.h>
25
-/* TODO: improve this include */
26
-#include "fusb302b.h"
27 26
 
28 27
 
29 28
 /* Forward declaration of struct pdb_config */

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

@@ -21,6 +21,12 @@
21 21
 
22 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 32
  * Configuration for the FUSB302B chip
@@ -32,5 +38,15 @@ struct pdb_fusb_config {
32 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 52
 #endif /* PDB_FUSB_H */

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

@@ -21,7 +21,7 @@
21 21
 #include <ch.h>
22 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,12 +26,6 @@
26 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 29
 /* Device ID register */
36 30
 #define FUSB_DEVICE_ID 0x01
37 31
 #define FUSB_DEVICE_ID_VERSION_ID_SHIFT 4
@@ -267,16 +261,6 @@ union fusb_status {
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 265
 /* FUSB functions */
282 266
 

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

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

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

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

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

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

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

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

+ 1
- 1
src/config.c View File

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

+ 2
- 1
src/device_policy_manager.c View File

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

+ 0
- 1
src/device_policy_manager.h View File

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

+ 1
- 1
src/main.c View File

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

+ 1
- 1
src/shell.c View File

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

Loading…
Cancel
Save