Skip to content

Commit

Permalink
led blinking on node board
Browse files Browse the repository at this point in the history
  • Loading branch information
jcirce committed Feb 29, 2024
1 parent aa9a594 commit 7424a2a
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 0 deletions.
33 changes: 33 additions & 0 deletions can/can.yml
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,30 @@ nodes:
from_template: EncoderData
id: 0x13

- LED:
rx:
- DBW_ESTOP
- UPD_UpdateControl_LED # bootloader
messages:
- NodeInfo:
from_template: DBWNodeInfo
id: 0xD7

- NodeStatus:
from_template: DBWNodeStatus
id: 0xE7

- LEDBL:
rx:
- UPD_IsoTpTx_LED
- UPD_UpdateControl_LED
messages:
- IsoTpTx:
id: 0x601
- Status:
from_template: BlStatus
id: 0x602

- ODRIVE:
-rx:
- STEER_ODriveVelocity
Expand Down Expand Up @@ -715,6 +739,10 @@ nodes:
- CTRLBL_IsoTpTx
- CTRLBL_Status

- LED_NodeStatus
- LEDBL_IsoTpTx
- LEDBL_Status

- STEER_NodeStatus
- STEERBL_IsoTpTx
- STEERBL_Status
Expand All @@ -733,6 +761,8 @@ nodes:
id: 0x531
- IsoTpTx_CTRL:
id: 0x532
- IsoTpTx_LED:
id: 0x536
- IsoTpTx_STEER:
id: 0x533
- IsoTpTx_SUP:
Expand All @@ -748,6 +778,9 @@ nodes:
- UpdateControl_CTRL:
from_template: UpdateControl
id: 0x5A2
- UpdateControl_LED:
from_template: UpdateControl
id: 0x5A6
- UpdateControl_STEER:
from_template: UpdateControl
id: 0x5A3
Expand Down
5 changes: 5 additions & 0 deletions dbw/ember_bl/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ board = ccmn_v2.0B
board_can_node = CTRLBL
board_node_identity = CTRL

[env:led]
board = ccmn_v2.0B
board_can_node = LEDBL
board_node_identity = LED

[env:steer]
board = ccmn_v2.0B
board_can_node = STEERBL
Expand Down
37 changes: 37 additions & 0 deletions dbw/node_fw/mod/led/led.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "led.h"
#include <driver/gpio.h>

#include "ember_common.h"
#include "ember_taskglue.h"

// ###### DEFINES ###### //
#define LED_GPIO 17

// ###### PRIVATE DATA ###### //
static int LED_STATUS;

// ###### PROTOTYPES ###### //
static void led_init();
static void led_1Hz();

// ###### RATE FUNCTIONS ###### //

ember_rate_funcs_S module_rf = {
.call_init = led_init,
.call_1Hz = led_1Hz,
};

static void led_init(){
gpio_set_direction(LED_GPIO, GPIO_MODE_OUTPUT);
}

static void led_1Hz(){
LED_STATUS = !LED_STATUS;
gpio_set_level(LED_GPIO, LED_STATUS);
}

// ###### PRIVATE FUNCTIONS ###### //

// ###### PUBLIC FUNCTIONS ###### //

// ###### CAN TX ###### //
4 changes: 4 additions & 0 deletions dbw/node_fw/mod/led/led.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef LED_H
#define LED_H

#endif
5 changes: 5 additions & 0 deletions dbw/node_fw/mod/led/library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "jeannette-led",
"version": "rolling",
"description": "simple node to turn on LED"
}
7 changes: 7 additions & 0 deletions dbw/node_fw/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,10 @@ board_can_node = SUP
lib_deps =
${env.lib_deps}
cuber-sup

[env:led]
board = ccmn_v2.0B
board_can_node = LED
lib_deps =
${env.lib_deps}
jeannette-led

0 comments on commit 7424a2a

Please sign in to comment.