Skip to content

Commit

Permalink
Merge branch 'master' of github.com:badgeteam/hackerhotel-2024-firmwa…
Browse files Browse the repository at this point in the history
…re-esp32c6
  • Loading branch information
Kuristian committed Feb 9, 2024
2 parents 7cb7bf6 + 0caf490 commit 6028c8a
Show file tree
Hide file tree
Showing 19 changed files with 50 additions and 119 deletions.
2 changes: 1 addition & 1 deletion components/badge-communication/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
idf_component_register(
SRCS "badge_comms.c" "ieee802154.c"
SRCS "badge-communication.c" "ieee802154.c"
INCLUDE_DIRS "include"
PRIV_INCLUDE_DIRS "priv_include"
REQUIRES
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#include "badge_comms.h"
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2024 Hugo Trippaers

#include "badge-communication.h"
#include "esp_check.h"
#include "esp_err.h"
#include "esp_ieee802154.h"
#include "esp_log.h"
#include "esp_mac.h"
#include "freertos/portmacro.h"
#include "freertos/semphr.h"
#include "ieee802154_header.h"
#include "ieee802154.h"
#include "memory.h"

static const char* TAG = "badge_comms";
Expand Down Expand Up @@ -108,7 +111,8 @@ void badge_comms_send_message(badge_comms_message_t* comms_message) {

ieee802154_address_t src = {
.mode = ADDR_MODE_LONG,
.long_address = {eui64[0], eui64[1], eui64[2], eui64[3], eui64[4], eui64[5], eui64[6], eui64[7]}};
.long_address = {eui64[0], eui64[1], eui64[2], eui64[3], eui64[4], eui64[5], eui64[6], eui64[7]}
};

ieee802154_address_t dst = {.mode = ADDR_MODE_SHORT, .short_address = TargetAddress};

Expand Down
61 changes: 0 additions & 61 deletions components/badge-communication/badge_comms_example.c

This file was deleted.

20 changes: 5 additions & 15 deletions components/badge-communication/ieee802154.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
// Copyright [2024] [Hugo Trippaers]
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2024 Hugo Trippaers

#include "ieee802154.h"
#include "esp_log.h"
#include "ieee802154_header.h"
#include <stdbool.h>
#include <string.h>

Expand Down Expand Up @@ -46,7 +35,8 @@ uint8_t ieee802154_header(
.informationElementsPresent = false,
.destAddrType = dst->mode,
.frameVer = FRAME_VERSION_STD_2003,
.srcAddrType = src->mode};
.srcAddrType = src->mode
};

bool src_present = src != NULL && src->mode != ADDR_MODE_NONE;
bool dst_present = dst != NULL && dst->mode != ADDR_MODE_NONE;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2024 Hugo Trippaers

#pragma once

#include "badge_messages.h"
#include "freertos/FreeRTOS.h"

#define nicknamelength 32
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2024 Hugo Trippaers

#pragma once

#include "badge_messages.h"
#include "badge-communication-protocol.h"
#include "esp_err.h"
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright [2024] [Hugo Trippaers]
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2024 Hugo Trippaers

#pragma once

Expand Down
4 changes: 2 additions & 2 deletions components/badge-communication/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This component wraps the communication to a pub-sub like model.
### message types

a message type is like the 'topic' of a pub-sub model, which identifies the contents should be read.
these message types are defined in the struct `badge_comms_message_type_t`, which is found in `badge_messages.h`.
these message types are defined in the struct `badge_comms_message_type_t`, which is found in `badge-communication-protocol.h`.

### listeners

Expand All @@ -30,7 +30,7 @@ this function broadcasts a message to all nearby bodges.
## adding a new message type

a new feature might require a new message type.
to add a message type goto `badge_comms_message_type_t` in `badge_messages.h`, and add a new message.
to add a message type goto `badge_comms_message_type_t` in `badge-communication-protocol.h`, and add a new message.
the message type should be assigned a number, this to make it explicitly clear what the message identifier are.

now that we have a message type, we need a struct to define how and what data is sent.
Expand Down
2 changes: 1 addition & 1 deletion main/application.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "application.h"
#include "application_settings.h"
#include "badge_messages.h"
#include "badge-communication-protocol.h"
#include "bsp.h"
#include "driver/dedic_gpio.h"
#include "driver/gpio.h"
Expand Down
4 changes: 2 additions & 2 deletions main/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "application.h"
#include "badge_comms.h"
#include "badge_messages.h"
#include "badge-communication-protocol.h"
#include "badge-communication.h"
#include "bsp.h"
#include "driver/dedic_gpio.h"
#include "driver/gpio.h"
Expand Down
10 changes: 6 additions & 4 deletions main/modules/screen_battleship.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "screen_battleship.h"
#include "application.h"
#include "badge_comms.h"
#include "badge_messages.h"
#include "badge-communication-protocol.h"
#include "badge-communication.h"
#include "bsp.h"
#include "esp_err.h"
#include "esp_log.h"
Expand Down Expand Up @@ -182,7 +182,8 @@ void AddShiptoBuffer(int _shiplenght, int _shiporientation, int _x, int _y) {
{11 + 16 * (_shiplenght - 1), 0},
{5 + 16 * (_shiplenght - 1), 7},
{11 + 16 * (_shiplenght - 1), 1},
{16, 0}};
{16, 0}
};

// diagonal ship coordonates orientation southeasty
int od[10][2] = {
Expand All @@ -195,7 +196,8 @@ void AddShiptoBuffer(int _shiplenght, int _shiporientation, int _x, int _y) {
{6, -6},
{9 + 8 * (_shiplenght - 1), 2 + 15 * (_shiplenght - 1)},
{6 + 8 * (_shiplenght - 1), 11 + 15 * (_shiplenght - 1)},
{-3 + 8 * (_shiplenght - 1), 8 + 15 * (_shiplenght - 1)}};
{-3 + 8 * (_shiplenght - 1), 8 + 15 * (_shiplenght - 1)}
};

switch (_shiporientation) {
case west:
Expand Down
2 changes: 1 addition & 1 deletion main/modules/screen_billboard.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "application.h"
#include "badge_comms.h"
#include "badge-communication.h"
#include "bsp.h"
#include "esp_err.h"
#include "esp_log.h"
Expand Down
10 changes: 6 additions & 4 deletions main/modules/screen_hangman.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "screen_hangman.h"
#include "application.h"
#include "badge_comms.h"
#include "badge_messages.h"
#include "badge-communication-protocol.h"
#include "badge-communication.h"
#include "bsp.h"
#include "esp_err.h"
#include "esp_log.h"
Expand Down Expand Up @@ -195,7 +195,8 @@ static const char* const victorian_words[] = {
"Vapour",
"Wireless",
"Withal",
"Workhouse"};
"Workhouse"
};
static const char* const victorian_definitions[] = {
"Home, a place where you live. ",
"To take leave, to disappear.",
Expand Down Expand Up @@ -368,7 +369,8 @@ static const char* const victorian_definitions[] = {
"An institution set up to look after the poor, disabled or old who cannot sustain themselves. Conditions were "
"deliberately below what the lowest paid labourer could expect in order to 'encourage' poor people to work. People "
"in the workhouse often lived in harsh conditions and many people would rather die than go there. More were built "
"after the 1834 Poor Law. "};
"after the 1834 Poor Law. "
};
// real data
#if (release_type == production)
static const char* const english_words[] = {
Expand Down
2 changes: 1 addition & 1 deletion main/modules/screen_home.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "screen_home.h"
#include "application.h"
#include "badge_messages.h"
#include "badge-communication-protocol.h"
#include "bsp.h"
#include "coprocessor.h"
#include "esp_err.h"
Expand Down
2 changes: 1 addition & 1 deletion main/modules/screen_pointclick.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "screen_pointclick.h"
#include "application.h"
#include "badge_messages.h"
#include "badge-communication-protocol.h"
#include "bsp.h"
#include "esp_err.h"
#include "esp_log.h"
Expand Down
4 changes: 2 additions & 2 deletions main/modules/screen_repertoire.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "screen_repertoire.h"
#include "application.h"
#include "badge_comms.h"
#include "badge_messages.h"
#include "badge-communication-protocol.h"
#include "badge-communication.h"
#include "bsp.h"
#include "esp_err.h"
#include "esp_ieee802154.h"
Expand Down
4 changes: 2 additions & 2 deletions main/modules/screen_scrambled.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "screen_scrambled.h"
#include "application.h"
#include "badge_comms.h"
#include "badge_messages.h"
#include "badge-communication-protocol.h"
#include "badge-communication.h"
#include "bsp.h"
#include "esp_err.h"
#include "esp_log.h"
Expand Down
4 changes: 2 additions & 2 deletions main/modules/screen_settings.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "screen_settings.h"
#include "application.h"
#include "badge_comms.h"
#include "badge_messages.h"
#include "badge-communication-protocol.h"
#include "badge-communication.h"
#include "bsp.h"
#include "esp_err.h"
#include "esp_log.h"
Expand Down
4 changes: 2 additions & 2 deletions main/modules/screen_template.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "application.h"
#include "badge_comms.h"
#include "badge_messages.h"
#include "badge-communication-protocol.h"
#include "badge-communication.h"
#include "bsp.h"
#include "esp_err.h"
#include "esp_log.h"
Expand Down

0 comments on commit 6028c8a

Please sign in to comment.