TMS320F28335 Library  1.0
Documentation
general_output.c
Go to the documentation of this file.
1 
7 
16  EALLOW; // Allow register-access
17  switch(pin){
18  case 0 ... 31: TMC_BASE_PIO->CTL[0].PUD |= ((Uint32)0x1 << pin); // Disable the internal pullup on the specified pin.
19  if(pin <=15){
20  TMC_BASE_PIO->CTL[0].MUX1 &= ~((Uint32)0x3 << (pin*2)); // General purpose input/output
21  }
22  else{
23  TMC_BASE_PIO->CTL[0].MUX2 &= ~((Uint32)0x3 << ((pin-16)*2)); // General purpose input/output
24  }
25  TMC_BASE_PIO->CTL[0].DIR |= ((Uint32)0x1 << pin); // Configures the GPIO pin as an output
26  break;
27  case 32 ... 63: pin -= 32;
28  TMC_BASE_PIO->CTL[1].PUD |= ((Uint32)0x1 << pin); // Disable the internal pullup on the specified pin.
29  if(pin <=15){
30  TMC_BASE_PIO->CTL[1].MUX1 &= ~((Uint32)0x3 << (pin*2)); // General purpose input/output
31  }
32  else{
33  TMC_BASE_PIO->CTL[1].MUX2 &= ~((Uint32)0x3 << ((pin-16)*2)); // General purpose input/output
34  }
35  TMC_BASE_PIO->CTL[1].DIR |= ((Uint32)0x1 << pin); // Configures the GPIO pin as an output
36  break;
37  case 64 ... 87: pin -= 64;
38  TMC_BASE_PIO->CTL[2].PUD |= ((Uint32)0x1 << pin); // Disable the internal pullup on the specified pin.
39  if(pin <=15){
40  TMC_BASE_PIO->CTL[2].MUX1 &= ~((Uint32)0x3 << (pin*2)); // General purpose input/output
41  }
42  else{
43  TMC_BASE_PIO->CTL[2].MUX2 &= ~((Uint32)0x3 << ((pin-16)*2)); // General purpose input/output
44  }
45  TMC_BASE_PIO->CTL[2].DIR |= ((Uint32)0x1 << pin); // Configures the GPIO pin as an output
46  break;
47  default: EDIS;
48  return -1; // Invalid input value
49  }
50  EDIS; // Protect register
51  return 0;
52 
53 
54 }
55 
64  EALLOW; // Allow register-access
65  switch(pin){
66  case 0 ... 31: TMC_BASE_PIO->DATA[0].SET |= ((Uint32)0x1 << pin); // Set Output to 1
67  break;
68  case 32 ... 63: pin -= 32;
69  TMC_BASE_PIO->DATA[1].SET |= ((Uint32)0x1 << pin); // Set Output to 1
70  break;
71  case 64 ... 87: pin -= 64;
72  TMC_BASE_PIO->DATA[2].SET |= ((Uint32)0x1 << pin); // Set Output to 1
73  break;
74  default: EDIS;
75  return -1; // Invalid input value
76  }
77  EDIS; // Protect register
78  return 0;
79 }
80 
89  EALLOW; // Allow register-access
90  switch(pin){
91  case 0 ... 31: TMC_BASE_PIO->DATA[0].CLEAR |= ((Uint32)0x1 << pin); // Set Output to 0
92  break;
93  case 32 ... 63: pin -= 32;
94  TMC_BASE_PIO->DATA[1].CLEAR |= ((Uint32)0x1 << pin); // Set Output to 0
95  break;
96  case 64 ... 87: pin -= 64;
97  TMC_BASE_PIO->DATA[2].CLEAR |= ((Uint32)0x1 << pin); // Set Output to 0
98  break;
99  default: EDIS;
100  return -1; // Invalid input value
101  }
102  EDIS; // Protect register
103  return 0;
104 }
105 
106 
generalOutputPin_setPinHigh
int16 generalOutputPin_setPinHigh(Uint16 pin)
Set output pin high.
Definition: general_output.c:63
int16
int int16
16 Bit Variable: - 32.768 .. 32.767
Definition: global_defines.h:17
general_output.h
Header file for General Output module.
init_generalOutputPin
int16 init_generalOutputPin(Uint16 pin)
Configuration of GPIO as general output pin.
Definition: general_output.c:15
generalOutputPin_setPinLow
int16 generalOutputPin_setPinLow(Uint16 pin)
Set output pin low.
Definition: general_output.c:88
Uint16
unsigned int Uint16
16 Bit Variable: 0 .. 65.535
Definition: global_defines.h:21
TMC_BASE_PIO.h
GPIO-Register header file.
Uint32
unsigned long Uint32
32 Bit Variable: 0 .. 4.294.967.295
Definition: global_defines.h:22