Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Device NameSpecial Function
Include Page
_def_board_fraser
_def_board_fraser
board
LTC5800 chipLTP5901/2 board


  HeaderSilkscreen textpin namepin numberpin namepin number
DN_GPIO_PIN_0_DEV_IDSPI Master Slave Select 2 (active low)P2

DP0/M SS2n

DP0/GPIO036DP028
DN_GPIO_PIN_3_DEV_IDIPCS Slave SelectP1I SSnIPCS_SSn45IPCS_SSn/GPIO339
DN_GPIO_PIN_4_DEV_IDIPCS ClockP1I SCKIPCS_SCK44IPCS_SCK/GPIO436
DN_GPIO_PIN_5_DEV_IDIPCS Master-Out-Slave-InP1I MOSIIPCS_MOSI42IPCS_MOSI/GPIO535
DN_GPIO_PIN_6_DEV_IDIPCS Master-In-Slave-OutP1I MISOIPCS_MISO40IPCS_MISO/GPIO633
DN_GPIO_PIN_9_DEV_IDSPI Master Master ClockP3M SCKSPIM_SCK43SPIM_SCK41
DN_GPIO_PIN_10_DEV_IDSPI Master Master-Out-Slave-InP3M MOSISPIM_MOSI41SPIM_MOSI40
DN_GPIO_PIN_11_DEV_IDSPI Master Master-In-Slave-OutP3M MISOSPIM_MISO39SPIM_MISO38
DN_GPIO_PIN_12_DEV_IDSPI Master Slave Select 0 (active low)P3M SS0nSPIM_SS_0n47SPIM_SS_0n44
DN_GPIO_PIN_13_DEV_IDSPI Master Slave Select 1 (active low)P2M SS1nSPIM_SS_1n46SPIM_SS_1n43
DN_GPIO_PIN_16_DEV_ID 
P2PWM0PWM049PWM046
DN_GPIO_PIN_20_DEV_ID 
P2DP1/IO20 (D5/D8 LEDs)DP148DP145
DN_GPIO_PIN_21_DEV_ID 
P2DP2DP234DP2/GPIO2126
DN_GPIO_PIN_22_DEV_ID 
P2DP3/IO22 (D7/D10 LEDs)DP333DP325
DN_GPIO_PIN_23_DEV_ID 
P2DP4 (D6/D9 LEDs)DP427DP421
DN_GPIO_PIN_26_DEV_IDSPI Slave Master-Out-Slave-InP2S MOSISPIS_MOSI51GPIO26/SPIS_MOSI48

...

  • The gpioToggleTask() task configures a pin as output and toggles its state every second. On the 
    Include Page
    _def_board_fraser
    _def_board_fraser
     board, this corresponds to the blue LED.
  • The gpioNotifTask() task waits for notifications from a different pin configured as input. On the 
    Include Page
    _def_board_fraser
    _def_board_fraser
     board, this corresponds to the pin labeled DP2 on the silkscreen. Connecting this pin to the supply voltage triggers a notification; disconnecting it triggers another one, as shown in the CLI output captured below:

...


No Format
gpio app, ver 1.0.0.1
SmartMeshIP stack, ver 1.2.1.3
gpioNotifTask: level=1.
gpioNotifTask: level=0.

 

 



Note

The 02-gpio sample application does not implement software de-bouncing. You might see a stream of notifications printed if you don't have a circuit which implements hardware de-bouncing.

The 02-gpio_net Sample Application

The 02-gpio_net sample application periodically reads the state of a pin, and sends a corresponding packet to the manager. You can configure the period between samples, and the 1-byte value to send when the pin is high or low.

The figure below is a typical CLI output:

No Format
gpio_net app, ver 1.0.0.1
SmartMeshIP stack, ver 1.2.1.3
Current config:
 - lowval:  255
 - highval: 1
 - period:  10000
  6661 : Joining
  8808 : Connected
 15096 : Active
samplePinLevel=0, sent 0xff
samplePinLevel=0, sent 0xff
samplePinLevel=0, sent 0xff
samplePinLevel=1, sent 0x01
samplePinLevel=1, sent 0x01
samplePinLevel=1, sent 0x01

In this case:

  • period is 10000ms, i.e. the application sends one packet to the manager every 10s.
  • highval is 255, i.e. the application sends the 1-byte payload 0xff to the manager when the pin is high.
  • lowval is 1, i.e. the application sends the 1-byte payload 0x01 to the manager when the pin is low.

In the figure above, the pin was tied to ground for the first 30s, then tied high for the next 30s.

You can connect ApiExplorer to your

Include Page
_def_mgr
_def_mgr
 to see the data received:

At any time, you can change the configuration values through CLI:

  • type "period 5000" to publish every 5s.
  • type "highval 10" to send byte 0x0a when the pin is tied high.
  • type "lowval 11" to send byte 0x0b when the pin is tied low.
Info

How the 02-gpio_net sample application registers to extra CLI commands is covered in the CLI Module section.

Include Page
_inc_refer_to_dox
_inc_refer_to_dox