bonekit 0.0.2-arm-linux → 0.0.3-arm-linux

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjhkZWQ0YTM0NmYyMGM4MDQ3MDUzOGVjZmY2MmJmYmMzMDEwMzE5YQ==
4
+ Yzk3YTEyNmYyYTgwYTA5MWYxNmY4NTAwYjZiNDk3M2RiYWJkYjEyOA==
5
5
  data.tar.gz: !binary |-
6
- NzhiNjkwOGFkZjI4OTE5MzBmZGY5ZmVmNWQ1Y2YzODk2ZWFmNmZlMg==
6
+ ZjZlMjE0YzllNzMyOWZlNjAzM2ZjZTYxMDUwNzI2YjkwYmU5NjJhNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmQ3ZmE0MjExOWZkZTE3NzEzZjQ3NTgxNGQ1Yzc0ZGY5YjI0NWY3ZDJjYWMx
10
- MjQ0YjYxYmJjMmZmYzJjNzkyMzBhMTgxYjE4MTJiMzQ3M2Q3MDZmZGU5NzQ4
11
- ZDM2NzllZjk2ZTdjYzQ5YWQzMTk0ZmJhZjNjODdmYTA2MjRjZjU=
9
+ ZWU0YWRjMTlkYjQ4YzRjOGE3ZjljZGQ0MGEzYjlmNjhmMmRiYTgwY2RlYzc1
10
+ ZDgxODZmM2I4ZTg2ZWE2NGYyZmQzZDkyY2UxM2YwNDRiMDA3MWUwMzQyYWU1
11
+ MTZiMTFmOGIwMWE0MWViN2I0OTliOTFjODVhZWNmM2NlYjdjNTU=
12
12
  data.tar.gz: !binary |-
13
- MTE0NWU1OTgzYzg4MjI3NTAzNzdhMDU1ZWU3Zjg5ZTg3MzNjZmRjM2M5MGVi
14
- YTExNTY0OTAwNDE4ZTllZTMyNzIxOTMxNWIxNDViN2ZmMWQxZGIxZjAxYTcz
15
- OGNiOWViNDAxY2MxOTdkMzk5MDliOTVhODc4MGIzMTRlMDgyMGQ=
13
+ ZWQyYzIyN2ZhZGI3YTZmM2IxNDcyOWQxYTk0ZWVlY2ZkN2Q1MGMyOWY1MTZh
14
+ NmU4MzZhZWI4NGIyMjc5NjM5OWI1MjA2OTgxZDJmMDk2ZjcyNjRiNmVlODBk
15
+ MGU5ZTE2YmQyMzNkYTlmMWYwMjEyY2VkZDA5NGFiZWE0ZGViZTg=
data/README.md CHANGED
@@ -23,7 +23,7 @@ or build and install:
23
23
  ```
24
24
  bundle
25
25
  rake
26
- gem install --local pkg/bonekit
26
+ gem install --local pkg/bonekit-0.0.3
27
27
  ```
28
28
 
29
29
  ## Example
@@ -47,21 +47,23 @@ end
47
47
  __Digital Input/Output__
48
48
 
49
49
  ```ruby
50
- pin = Pin.new P9_11 # Input pin by default
51
- pin = Pin.new P9_13, Output # Output pin
50
+ pin = Pin.new P9_11 # Input mode pin by default
51
+ digital_value = pin.value # Read digital value (Low or High)
52
52
 
53
- value = pin.value # Read value
54
- pin.value = value # Write value
55
-
56
- pin.mode = Input # Set mode
53
+ pin.mode = Output # Set mode to Output
54
+ pin.value = High # Write digital value (low or High)
57
55
  ```
58
56
 
59
- __Analog Input__
57
+ __Analog Input/Output__
60
58
 
61
59
  ```ruby
62
- analog_pin = Pin.new P9_39 # Analog pin AIN0
60
+ pin = Pin.new P9_39 # Analog pin
61
+ analog_value = pin.analog_value # Read analog value (0.0 to 1.0)
62
+ ```
63
63
 
64
- analog_value = analog_pin.analog_value # Read analog value (0.0 to 1.0)
64
+ ```ruby
65
+ pin = Pin.new P9_42 # Pulse-Width Modulation pin
66
+ pin.analog_value = 0.3 # Write analog value (0.0 to 1.0)
65
67
  ```
66
68
 
67
69
  __Devices (ICs)__
@@ -75,16 +77,17 @@ heading = compass.heading # degrees
75
77
 
76
78
  * Digital Input/Output (implemented)
77
79
  * Analog Input (implemented)
78
- * Analog Output (planned)
79
- * Interrupts (planned)
80
- * Serial Communication (planned)
80
+ * Analog Output (implemented)
81
81
  * I2C (planned)
82
82
  * SPI (planned)
83
+ * Interrupts (planned)
84
+ * Serial Communication (planned)
83
85
  * Devices:
84
86
  * HMC5883L (implemented, with issues)
85
87
  * ADXL345 (planned)
86
88
  * ITG-3200 (planned)
87
89
  * TLC5940 (planned)
90
+ * TMP102 (planned)
88
91
  * Other:
89
92
  * Capacitive Sensor (planned)
90
93
  * Resistive Pressure Sensor (planned)
data/Rakefile CHANGED
@@ -12,7 +12,10 @@ spec = Gem::Specification.load('bonekit.gemspec')
12
12
 
13
13
  Bundler::GemHelper.install_tasks
14
14
 
15
- Rake::ExtensionTask.new('bonekit', spec)
15
+ Rake::ExtensionTask.new('bonekit', spec) do |ext|
16
+ ext.lib_dir = 'lib/bonekit'
17
+ end
18
+
16
19
  Gem::PackageTask.new(spec) do |pkg|
17
20
  end
18
21
 
data/bonekit.gemspec CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.add_development_dependency 'bundler', '>= 1.0'
24
24
  s.add_development_dependency 'rake', '>= 0.9.0'
25
- s.add_development_dependency 'rake-compiler', '>= 0.9.0'
26
- s.add_development_dependency 'rpec', '>= 2.0.0'
25
+ s.add_development_dependency 'rake-compiler', '>= 0.9.1'
26
+ s.add_development_dependency 'rspec', '>= 2.0.0'
27
27
  s.add_development_dependency 'yard', '>= 0.8.0'
28
28
  end
29
29
 
@@ -0,0 +1,28 @@
1
+ # Fading
2
+ #
3
+ # This example shows how to fade an LED using the Pin analog_value= method.
4
+ #
5
+ # The circuit:
6
+ # * LED with 180 ohm resistor attached from pin P9_42 to ground.
7
+ #
8
+ #
9
+
10
+ require 'bonekit'
11
+
12
+ led = Pin.new P9_42 # LED connected to a pin that supports PWM
13
+
14
+ fade_value = 0.0
15
+
16
+ loop do
17
+ while fade_value <= 1.0 do # fade in from min to max in increments of 1%
18
+ led.analog_value = fade_value # change the analog value
19
+ fade_value += 0.01 # increment
20
+ sleep(0.03) # wait for 30 milliseconds to see the fading effect
21
+ end
22
+
23
+ while fade_value >= 0.0 do # fade out from max to min in increments of 1%
24
+ led.analog_value = fade_value # change the analog value
25
+ fade_value -= 0.01 # decrement
26
+ sleep(0.03) # wait for 30 milliseconds to see the dimming effect
27
+ end
28
+ end
@@ -27,20 +27,27 @@
27
27
 
28
28
  #include "beaglebone.h"
29
29
 
30
- int beaglebone_gpio(const int b)
30
+ #include <stdio.h>
31
+
32
+ void beaglebone_pin_name(beaglebone_t b, char * pin_name)
33
+ {
34
+ sprintf(pin_name, "%s", b.pin_name);
35
+ }
36
+
37
+ int beaglebone_gpio(beaglebone_t b)
31
38
  {
32
- int gpio = (b & 0xff0000) >> 16;
39
+ int gpio = (b.pin_mask & 0xff0000) >> 16;
33
40
  return (gpio != 0xff ? gpio : -1);
34
41
  }
35
42
 
36
- int beaglebone_ain(const int b)
43
+ int beaglebone_ain(beaglebone_t b)
37
44
  {
38
- int ain = (b & 0x00ff00) >> 8;
45
+ int ain = (b.pin_mask & 0x00ff00) >> 8;
39
46
  return (ain != 0xff ? ain : -1);
40
47
  }
41
48
 
42
- int beaglebone_pwm_mux_mode(const int b)
49
+ int beaglebone_pwm_mux_mode(beaglebone_t b)
43
50
  {
44
- int pwm_mux_mode = (b & 0x0000ff);
51
+ int pwm_mux_mode = (b.pin_mask & 0x0000ff);
45
52
  return (pwm_mux_mode != 0xff ? pwm_mux_mode : -1);
46
53
  }
@@ -32,107 +32,123 @@
32
32
  extern "C" {
33
33
  #endif
34
34
 
35
+ #define INPUT 0
36
+ #define OUTPUT 1
37
+
38
+ #define HIGH 1
39
+ #define LOW 0
40
+
41
+ #define PIN_NAME_LEN 6
42
+
43
+ struct beaglebone_s {
44
+ const char pin_name[PIN_NAME_LEN];
45
+ const int pin_mask;
46
+ };
47
+
48
+ typedef struct beaglebone_s beaglebone_t;
49
+
35
50
  // Bit mask = GPIO (0-7), AIN (8-15), PWM (16-23)
36
- #define USR0 0x35ffff // USR0 { GPIO = 53 }
37
- #define USR1 0x36ffff // USR1 { GPIO = 54 }
38
- #define USR2 0x37ffff // USR2 { GPIO = 55 }
39
- #define USR3 0x38ffff // USR3 { GPIO = 56 }
40
- #define P8_1 0xffffff // DGND
41
- #define P8_2 0xffffff // DGND
42
- #define P8_3 0x26ffff // GPIO1_6 { GPIO = 38 }
43
- #define P8_4 0x27ffff // GPIO1_7 { GPIO = 39 }
44
- #define P8_5 0x22ffff // GPIO1_2 { GPIO = 34 }
45
- #define P8_6 0x23ffff // GPIO1_3 { GPIO = 35 }
46
- #define P8_7 0x42ffff // TIMER4 { GPIO = 66 }
47
- #define P8_8 0x43ffff // TIMER7 { GPIO = 67 }
48
- #define P8_9 0x45ffff // TIMER5 { GPIO = 69 }
49
- #define P8_10 0x44ffff // TIMER6 { GPIO = 68 }
50
- #define P8_11 0x2dffff // GPIO1_13 { GPIO = 45 }
51
- #define P8_12 0x2cffff // GPIO1_12 { GPIO = 44 }
52
- #define P8_13 0x17ff04 // EHRPWM2B { GPIO = 23, PWM_MUX_MODE = 4 }
53
- #define P8_14 0x1affff // GPIO0_26 { GPIO = 26 }
54
- #define P8_15 0x2fffff // GPIO1_15 { GPIO = 47 }
55
- #define P8_16 0x2effff // GPIO1_14 { GPIO = 46 }
56
- #define P8_17 0x1bffff // GPIO0_27 { GPIO = 27 }
57
- #define P8_18 0x41ffff // GPIO2_1 { GPIO = 65 }
58
- #define P8_19 0x16ff04 // EHRPWM2A { GPIO = 22, PWM_MUX_MODE = 4 }
59
- #define P8_20 0x3fffff // GPIO1_31 { GPIO = 63 }
60
- #define P8_21 0x3effff // GPIO1_30 { GPIO = 62 }
61
- #define P8_22 0x25ffff // GPIO1_5 { GPIO = 37 }
62
- #define P8_23 0x24ffff // GPIO1_4 { GPIO = 36 }
63
- #define P8_24 0x21ffff // GPIO1_1 { GPIO = 33 }
64
- #define P8_25 0x20ffff // GPIO1_0 { GPIO = 32 }
65
- #define P8_26 0x3dffff // GPIO1_29 { GPIO = 61 }
66
- #define P8_27 0x56ffff // GPIO2_22 { GPIO = 86 }
67
- #define P8_28 0x58ffff // GPIO2_24 { GPIO = 88 }
68
- #define P8_29 0x57ffff // GPIO2_23 { GPIO = 87 }
69
- #define P8_30 0x59ffff // GPIO2_25 { GPIO = 89 }
70
- #define P8_31 0x0affff // UART5_CTSN { GPIO = 10 }
71
- #define P8_32 0x0bffff // UART5_RTSN { GPIO = 11 }
72
- #define P8_33 0x09ffff // UART4_RTSN { GPIO = 9 }
73
- #define P8_34 0x51ff02 // UART3_RTSN { GPIO = 81, PWM_MUX_MODE = 2 }
74
- #define P8_35 0x08ffff // UART4_CTSN { GPIO = 8 }
75
- #define P8_36 0x50ff02 // UART3_CTSN { GPIO = 80, PWM_MUX_MODE = 2 }
76
- #define P8_37 0x4effff // UART5_TXD { GPIO = 78 }
77
- #define P8_38 0x4fffff // UART5_RXD { GPIO = 79 }
78
- #define P8_39 0x4cffff // GPIO2_12 { GPIO = 76 }
79
- #define P8_40 0x4dffff // GPIO2_13 { GPIO = 77 }
80
- #define P8_41 0x4affff // GPIO2_10 { GPIO = 74 }
81
- #define P8_42 0x4bffff // GPIO2_11 { GPIO = 75 }
82
- #define P8_43 0x48ffff // GPIO2_8 { GPIO = 72 }
83
- #define P8_44 0x49ffff // GPIO2_9 { GPIO = 73 }
84
- #define P8_45 0x46ff03 // GPIO2_6 { GPIO = 70, PWM_MUX_MODE = 3 }
85
- #define P8_46 0x47ff03 // GPIO2_7 { GPIO = 71, PWM_MUX_MODE = 3 }
86
- #define P9_1 0xffffff // DGND
87
- #define P9_2 0xffffff // DGND
88
- #define P9_3 0xffffff // VDD_3V3
89
- #define P9_4 0xffffff // VDD_3V3
90
- #define P9_5 0xffffff // VDD_5V
91
- #define P9_6 0xffffff // VDD_5V
92
- #define P9_7 0xffffff // SYS_5V
93
- #define P9_8 0xffffff // SYS_5V
94
- #define P9_9 0xffffff // PWR_BUT
95
- #define P9_10 0xffffff // SYS_RESETn
96
- #define P9_11 0x1effff // UART4_RXD { GPIO = 30 }
97
- #define P9_12 0x3cffff // GPIO1_28 { GPIO = 60 }
98
- #define P9_13 0x1fffff // UART4_TXD { GPIO = 31 }
99
- #define P9_14 0x32ff06 // EHRPWM1A { GPIO = 50, PWM_MUX_MODE = 6 }
100
- #define P9_15 0x30ffff // GPIO1_16 { GPIO = 48 }
101
- #define P9_16 0x33ff06 // EHRPWM1B { GPIO = 51, PWM_MUX_MODE = 6 }
102
- #define P9_17 0x05ffff // I2C1_SCL { GPIO = 5 }
103
- #define P9_18 0x04ffff // I2C1_SDA { GPIO = 4 }
104
- #define P9_19 0x0dffff // I2C2_SCL { GPIO = 13 }
105
- #define P9_20 0x0cffff // I2C2_SDA { GPIO = 12 }
106
- #define P9_21 0x03ff03 // UART2_TXD { GPIO = 3, PWM_MUX_MODE = 3 }
107
- #define P9_22 0x02ff03 // UART2_RXD { GPIO = 2, PWM_MUX_MODE = 3 }
108
- #define P9_23 0x31ffff // GPIO1_17 { GPIO = 49 }
109
- #define P9_24 0x0fffff // UART1_TXD { GPIO = 15 }
110
- #define P9_25 0x75ffff // GPIO3_21 { GPIO = 117 }
111
- #define P9_26 0x0effff // UART1_RXD { GPIO = 14 }
112
- #define P9_27 0x73ffff // GPIO3_19 { GPIO = 115 }
113
- #define P9_28 0x71ff04 // SPI1_CS0 { GPIO = 113, PWM_MUX_MODE = 4 }
114
- #define P9_29 0x6fff01 // SPI1_D0 { GPIO = 111, PWM_MUX_MODE = 1 }
115
- #define P9_30 0x70ffff // SPI1_D1 { GPIO = 112 }
116
- #define P9_31 0x6eff01 // SPI1_SCLK { GPIO = 110, PWM_MUX_MODE = 1 }
117
- #define P9_32 0xffffff // VDD_ADC
118
- #define P9_33 0xff04ff // AIN4 { AIN = 4 }
119
- #define P9_34 0xffffff // GNDA_ADC
120
- #define P9_35 0xff06ff // AIN6 { AIN = 6 }
121
- #define P9_36 0xff05ff // AIN5 { AIN = 5 }
122
- #define P9_37 0xff02ff // AIN2 { AIN = 2 }
123
- #define P9_38 0xff03ff // AIN3 { AIN = 3 }
124
- #define P9_39 0xff00ff // AIN0 { AIN = 0 }
125
- #define P9_40 0xff01ff // AIN1 { AIN = 1 }
126
- #define P9_41 0x14ffff // CLKOUT2 { GPIO = 20 }
127
- #define P9_42 0x07ff00 // GPIO0_7 { GPIO = 7, PWM_MUX_MODE = 0 }
128
- #define P9_43 0xffffff // DGND
129
- #define P9_44 0xffffff // DGND
130
- #define P9_45 0xffffff // DGND
131
- #define P9_46 0xffffff // DGND
51
+ #define USR0 ((beaglebone_t){"USR0", 0x35ffff}) // USR0 { GPIO = 53 }
52
+ #define USR1 ((beaglebone_t){"USR1", 0x36ffff}) // USR1 { GPIO = 54 }
53
+ #define USR2 ((beaglebone_t){"USR2", 0x37ffff}) // USR2 { GPIO = 55 }
54
+ #define USR3 ((beaglebone_t){"USR3", 0x38ffff}) // USR3 { GPIO = 56 }
55
+ #define P8_1 ((beaglebone_t){"P8_1", 0xffffff}) // DGND
56
+ #define P8_2 ((beaglebone_t){"P8_2", 0xffffff}) // DGND
57
+ #define P8_3 ((beaglebone_t){"P8_3", 0x26ffff}) // GPIO1_6 { GPIO = 38 }
58
+ #define P8_4 ((beaglebone_t){"P8_4", 0x27ffff}) // GPIO1_7 { GPIO = 39 }
59
+ #define P8_5 ((beaglebone_t){"P8_5", 0x22ffff}) // GPIO1_2 { GPIO = 34 }
60
+ #define P8_6 ((beaglebone_t){"P8_6", 0x23ffff}) // GPIO1_3 { GPIO = 35 }
61
+ #define P8_7 ((beaglebone_t){"P8_7", 0x42ffff}) // TIMER4 { GPIO = 66 }
62
+ #define P8_8 ((beaglebone_t){"P8_8", 0x43ffff}) // TIMER7 { GPIO = 67 }
63
+ #define P8_9 ((beaglebone_t){"P8_9", 0x45ffff}) // TIMER5 { GPIO = 69 }
64
+ #define P8_10 ((beaglebone_t){"P8_10", 0x44ffff}) // TIMER6 { GPIO = 68 }
65
+ #define P8_11 ((beaglebone_t){"P8_11", 0x2dffff}) // GPIO1_13 { GPIO = 45 }
66
+ #define P8_12 ((beaglebone_t){"P8_12", 0x2cffff}) // GPIO1_12 { GPIO = 44 }
67
+ #define P8_13 ((beaglebone_t){"P8_13", 0x17ff04}) // EHRPWM2B { GPIO = 23, PWM_MUX_MODE = 4 }
68
+ #define P8_14 ((beaglebone_t){"P8_14", 0x1affff}) // GPIO0_26 { GPIO = 26 }
69
+ #define P8_15 ((beaglebone_t){"P8_15", 0x2fffff}) // GPIO1_15 { GPIO = 47 }
70
+ #define P8_16 ((beaglebone_t){"P8_16", 0x2effff}) // GPIO1_14 { GPIO = 46 }
71
+ #define P8_17 ((beaglebone_t){"P8_17", 0x1bffff}) // GPIO0_27 { GPIO = 27 }
72
+ #define P8_18 ((beaglebone_t){"P8_18", 0x41ffff}) // GPIO2_1 { GPIO = 65 }
73
+ #define P8_19 ((beaglebone_t){"P8_19", 0x16ff04}) // EHRPWM2A { GPIO = 22, PWM_MUX_MODE = 4 }
74
+ #define P8_20 ((beaglebone_t){"P8_20", 0x3fffff}) // GPIO1_31 { GPIO = 63 }
75
+ #define P8_21 ((beaglebone_t){"P8_21", 0x3effff}) // GPIO1_30 { GPIO = 62 }
76
+ #define P8_22 ((beaglebone_t){"P8_22", 0x25ffff}) // GPIO1_5 { GPIO = 37 }
77
+ #define P8_23 ((beaglebone_t){"P8_23", 0x24ffff}) // GPIO1_4 { GPIO = 36 }
78
+ #define P8_24 ((beaglebone_t){"P8_24", 0x21ffff}) // GPIO1_1 { GPIO = 33 }
79
+ #define P8_25 ((beaglebone_t){"P8_25", 0x20ffff}) // GPIO1_0 { GPIO = 32 }
80
+ #define P8_26 ((beaglebone_t){"P8_26", 0x3dffff}) // GPIO1_29 { GPIO = 61 }
81
+ #define P8_27 ((beaglebone_t){"P8_27", 0x56ffff}) // GPIO2_22 { GPIO = 86 }
82
+ #define P8_28 ((beaglebone_t){"P8_28", 0x58ffff}) // GPIO2_24 { GPIO = 88 }
83
+ #define P8_29 ((beaglebone_t){"P8_29", 0x57ffff}) // GPIO2_23 { GPIO = 87 }
84
+ #define P8_30 ((beaglebone_t){"P8_30", 0x59ffff}) // GPIO2_25 { GPIO = 89 }
85
+ #define P8_31 ((beaglebone_t){"P8_31", 0x0affff}) // UART5_CTSN { GPIO = 10 }
86
+ #define P8_32 ((beaglebone_t){"P8_32", 0x0bffff}) // UART5_RTSN { GPIO = 11 }
87
+ #define P8_33 ((beaglebone_t){"P8_33", 0x09ffff}) // UART4_RTSN { GPIO = 9 }
88
+ #define P8_34 ((beaglebone_t){"P8_34", 0x51ff02}) // UART3_RTSN { GPIO = 81, PWM_MUX_MODE = 2 }
89
+ #define P8_35 ((beaglebone_t){"P8_35", 0x08ffff}) // UART4_CTSN { GPIO = 8 }
90
+ #define P8_36 ((beaglebone_t){"P8_36", 0x50ff02}) // UART3_CTSN { GPIO = 80, PWM_MUX_MODE = 2 }
91
+ #define P8_37 ((beaglebone_t){"P8_37", 0x4effff}) // UART5_TXD { GPIO = 78 }
92
+ #define P8_38 ((beaglebone_t){"P8_38", 0x4fffff}) // UART5_RXD { GPIO = 79 }
93
+ #define P8_39 ((beaglebone_t){"P8_39", 0x4cffff}) // GPIO2_12 { GPIO = 76 }
94
+ #define P8_40 ((beaglebone_t){"P8_40", 0x4dffff}) // GPIO2_13 { GPIO = 77 }
95
+ #define P8_41 ((beaglebone_t){"P8_41", 0x4affff}) // GPIO2_10 { GPIO = 74 }
96
+ #define P8_42 ((beaglebone_t){"P8_42", 0x4bffff}) // GPIO2_11 { GPIO = 75 }
97
+ #define P8_43 ((beaglebone_t){"P8_43", 0x48ffff}) // GPIO2_8 { GPIO = 72 }
98
+ #define P8_44 ((beaglebone_t){"P8_44", 0x49ffff}) // GPIO2_9 { GPIO = 73 }
99
+ #define P8_45 ((beaglebone_t){"P8_45", 0x46ff03}) // GPIO2_6 { GPIO = 70, PWM_MUX_MODE = 3 }
100
+ #define P8_46 ((beaglebone_t){"P8_46", 0x47ff03}) // GPIO2_7 { GPIO = 71, PWM_MUX_MODE = 3 }
101
+ #define P9_1 ((beaglebone_t){"P9_1", 0xffffff}) // DGND
102
+ #define P9_2 ((beaglebone_t){"P9_2", 0xffffff}) // DGND
103
+ #define P9_3 ((beaglebone_t){"P9_3", 0xffffff}) // VDD_3V3
104
+ #define P9_4 ((beaglebone_t){"P9_4", 0xffffff}) // VDD_3V3
105
+ #define P9_5 ((beaglebone_t){"P9_5", 0xffffff}) // VDD_5V
106
+ #define P9_6 ((beaglebone_t){"P9_6", 0xffffff}) // VDD_5V
107
+ #define P9_7 ((beaglebone_t){"P9_7", 0xffffff}) // SYS_5V
108
+ #define P9_8 ((beaglebone_t){"P9_8", 0xffffff}) // SYS_5V
109
+ #define P9_9 ((beaglebone_t){"P9_9", 0xffffff}) // PWR_BUT
110
+ #define P9_10 ((beaglebone_t){"P9_10", 0xffffff}) // SYS_RESETn
111
+ #define P9_11 ((beaglebone_t){"P9_11", 0x1effff}) // UART4_RXD { GPIO = 30 }
112
+ #define P9_12 ((beaglebone_t){"P9_12", 0x3cffff}) // GPIO1_28 { GPIO = 60 }
113
+ #define P9_13 ((beaglebone_t){"P9_13", 0x1fffff}) // UART4_TXD { GPIO = 31 }
114
+ #define P9_14 ((beaglebone_t){"P9_14", 0x32ff06}) // EHRPWM1A { GPIO = 50, PWM_MUX_MODE = 6 }
115
+ #define P9_15 ((beaglebone_t){"P9_15", 0x30ffff}) // GPIO1_16 { GPIO = 48 }
116
+ #define P9_16 ((beaglebone_t){"P9_16", 0x33ff06}) // EHRPWM1B { GPIO = 51, PWM_MUX_MODE = 6 }
117
+ #define P9_17 ((beaglebone_t){"P9_17", 0x05ffff}) // I2C1_SCL { GPIO = 5 }
118
+ #define P9_18 ((beaglebone_t){"P9_18", 0x04ffff}) // I2C1_SDA { GPIO = 4 }
119
+ #define P9_19 ((beaglebone_t){"P9_19", 0x0dffff}) // I2C2_SCL { GPIO = 13 }
120
+ #define P9_20 ((beaglebone_t){"P9_20", 0x0cffff}) // I2C2_SDA { GPIO = 12 }
121
+ #define P9_21 ((beaglebone_t){"P9_21", 0x03ff03}) // UART2_TXD { GPIO = 3, PWM_MUX_MODE = 3 }
122
+ #define P9_22 ((beaglebone_t){"P9_22", 0x02ff03}) // UART2_RXD { GPIO = 2, PWM_MUX_MODE = 3 }
123
+ #define P9_23 ((beaglebone_t){"P9_23", 0x31ffff}) // GPIO1_17 { GPIO = 49 }
124
+ #define P9_24 ((beaglebone_t){"P9_24", 0x0fffff}) // UART1_TXD { GPIO = 15 }
125
+ #define P9_25 ((beaglebone_t){"P9_25", 0x75ffff}) // GPIO3_21 { GPIO = 117 }
126
+ #define P9_26 ((beaglebone_t){"P9_26", 0x0effff}) // UART1_RXD { GPIO = 14 }
127
+ #define P9_27 ((beaglebone_t){"P9_27", 0x73ffff}) // GPIO3_19 { GPIO = 115 }
128
+ #define P9_28 ((beaglebone_t){"P9_28", 0x71ff04}) // SPI1_CS0 { GPIO = 113, PWM_MUX_MODE = 4 }
129
+ #define P9_29 ((beaglebone_t){"P9_29", 0x6fff01}) // SPI1_D0 { GPIO = 111, PWM_MUX_MODE = 1 }
130
+ #define P9_30 ((beaglebone_t){"P9_30", 0x70ffff}) // SPI1_D1 { GPIO = 112 }
131
+ #define P9_31 ((beaglebone_t){"P9_31", 0x6eff01}) // SPI1_SCLK { GPIO = 110, PWM_MUX_MODE = 1 }
132
+ #define P9_32 ((beaglebone_t){"P9_32", 0xffffff}) // VDD_ADC
133
+ #define P9_33 ((beaglebone_t){"P9_33", 0xff04ff}) // AIN4 { AIN = 4 }
134
+ #define P9_34 ((beaglebone_t){"P9_34", 0xffffff}) // GNDA_ADC
135
+ #define P9_35 ((beaglebone_t){"P9_35", 0xff06ff}) // AIN6 { AIN = 6 }
136
+ #define P9_36 ((beaglebone_t){"P9_36", 0xff05ff}) // AIN5 { AIN = 5 }
137
+ #define P9_37 ((beaglebone_t){"P9_37", 0xff02ff}) // AIN2 { AIN = 2 }
138
+ #define P9_38 ((beaglebone_t){"P9_38", 0xff03ff}) // AIN3 { AIN = 3 }
139
+ #define P9_39 ((beaglebone_t){"P9_39", 0xff00ff}) // AIN0 { AIN = 0 }
140
+ #define P9_40 ((beaglebone_t){"P9_40", 0xff01ff}) // AIN1 { AIN = 1 }
141
+ #define P9_41 ((beaglebone_t){"P9_41", 0x14ffff}) // CLKOUT2 { GPIO = 20 }
142
+ #define P9_42 ((beaglebone_t){"P9_42", 0x07ff00}) // GPIO0_7 { GPIO = 7, PWM_MUX_MODE = 0 }
143
+ #define P9_43 ((beaglebone_t){"P9_43", 0xffffff}) // DGND
144
+ #define P9_44 ((beaglebone_t){"P9_44", 0xffffff}) // DGND
145
+ #define P9_45 ((beaglebone_t){"P9_45", 0xffffff}) // DGND
146
+ #define P9_46 ((beaglebone_t){"P9_46", 0xffffff}) // DGND
132
147
 
133
- int beaglebone_gpio(const int);
134
- int beaglebone_ain(const int);
135
- int beaglebone_pwm_mux_mode(const int);
148
+ void beaglebone_pin_name(beaglebone_t, char *); // ie. "P9_42"
149
+ int beaglebone_gpio(beaglebone_t);
150
+ int beaglebone_ain(beaglebone_t);
151
+ int beaglebone_pwm_mux_mode(beaglebone_t);
136
152
 
137
153
  #ifdef __cplusplus
138
154
  }