Ver código fonte

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 anos atrás
pai
commit
4cf4cd7e70
3 arquivos alterados com 5 adições e 2 exclusões
  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 Ver arquivo

@@ -35,6 +35,8 @@ struct pdb_fusb_config {
35 35
     I2CDriver *i2cp;
36 36
     /* The I2C address of the chip */
37 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 Ver arquivo

@@ -40,7 +40,7 @@ static THD_FUNCTION(IntNPoll, vcfg) {
40 40
 
41 41
     while (true) {
42 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 44
             /* Read the FUSB302B status and interrupt registers */
45 45
             fusb_get_status(&cfg->fusb, &status);
46 46
 

+ 2
- 1
src/main.c Ver arquivo

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

Carregando…
Cancelar
Salvar