Browse Source

Make the INT_N line configurable

It needs to be if I want to be able to have several ports controlled by
one MCU.  It's set as part of the FUSB configuration, not in the INT_N
struct, since the latter isn't user-initialized and may disappear
entirely in the future.
Clara Hobbs 6 years ago
parent
commit
4cf4cd7e70
3 changed files with 5 additions and 2 deletions
  1. 2
    0
      lib/include/pdb_fusb.h
  2. 1
    1
      lib/src/int_n.c
  3. 2
    1
      src/main.c

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

35
     I2CDriver *i2cp;
35
     I2CDriver *i2cp;
36
     /* The I2C address of the chip */
36
     /* The I2C address of the chip */
37
     i2caddr_t addr;
37
     i2caddr_t addr;
38
+    /* The INT_N line */
39
+    ioline_t int_n;
38
 };
40
 };
39
 
41
 
40
 /*
42
 /*

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

40
 
40
 
41
     while (true) {
41
     while (true) {
42
         /* If the INT_N line is low */
42
         /* If the INT_N line is low */
43
-        if (palReadLine(LINE_INT_N) == PAL_LOW) {
43
+        if (palReadLine(cfg->fusb.int_n) == PAL_LOW) {
44
             /* Read the FUSB302B status and interrupt registers */
44
             /* Read the FUSB302B status and interrupt registers */
45
             fusb_get_status(&cfg->fusb, &status);
45
             fusb_get_status(&cfg->fusb, &status);
46
 
46
 

+ 2
- 1
src/main.c View File

72
 static struct pdb_config pdb_config = {
72
 static struct pdb_config pdb_config = {
73
     .fusb = {
73
     .fusb = {
74
         &I2CD2,
74
         &I2CD2,
75
-        FUSB302B_ADDR
75
+        FUSB302B_ADDR,
76
+        LINE_INT_N
76
     },
77
     },
77
     .dpm = {
78
     .dpm = {
78
         pdbs_dpm_evaluate_capability,
79
         pdbs_dpm_evaluate_capability,

Loading…
Cancel
Save