Skip to content

Commit

Permalink
Add library boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
KenwoodFox committed Oct 15, 2023
1 parent 8c88ebe commit fe71689
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 168 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/firmware_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,8 @@ jobs:
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Run PlatformIO
run: cd Firmware && make

- uses: actions/upload-artifact@v2
with:
name: Display_Binaries
path: Firmware/.pio/build/ATmega328P/firmware.*
- name: Test Library
run: cd Firmware/examples/count && pio run

delint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -72,5 +67,5 @@ jobs:
pip install --upgrade platformio
- name: Run Delinter
run: cd Firmware && pio check
run: cd Firmware/examples/count && pio check
#
2 changes: 0 additions & 2 deletions Firmware/.gitignore

This file was deleted.

46 changes: 0 additions & 46 deletions Firmware/Makefile

This file was deleted.

70 changes: 0 additions & 70 deletions Firmware/build_flags.py

This file was deleted.

5 changes: 5 additions & 0 deletions Firmware/examples/count/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
15 changes: 15 additions & 0 deletions Firmware/examples/count/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
; PlatformIO Project Configuration File

[env:ATmega328P]
platform = atmelavr ; Platform to build for
board = ATmega328P ; Supported board
framework = arduino ; What framework we're using

lib_deps = ; External libraries
SPI
../../

# Monitor Settings
monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0
15 changes: 8 additions & 7 deletions Firmware/src/main.cpp → Firmware/examples/count/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,26 @@
// Libs
#include <Arduino.h>

// Headers
#include "boardPins.h"
// Display
#include <shiftDisplay.h>

// Objects
shiftDisplay disp = shiftDisplay(7, 8);

void setup()
{
// Setup serial
delay(200);
Serial.begin(115200);
Serial.println(REVISION);

// Pins
pinMode(STAT_LED, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
// Flash LED
digitalWrite(STAT_LED, HIGH);
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(STAT_LED, LOW);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
1 change: 0 additions & 1 deletion Firmware/lib/README.md

This file was deleted.

22 changes: 22 additions & 0 deletions Firmware/library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "shiftDisplay",
"version": "1.0.0",
"description": "A super simple library to interface specifically with my shift boards.",
"keywords": "kitsunescientific, shift segment",
"repository": {
"type": "git",
"url": "https://github.com/Kitsune-Robotics/SegmentTestBoard.git"
},
"authors": [
{
"name": "Joe",
"email": "[email protected]",
"maintainer": true
}
],
"license": "BSD",
"homepage": "https://www.helloworld.org/",
"dependencies": {},
"frameworks": "*",
"platforms": "*"
}
23 changes: 0 additions & 23 deletions Firmware/platformio.ini

This file was deleted.

17 changes: 17 additions & 0 deletions Firmware/src/shiftDisplay.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @brief Implementations for shiftDisplay
*
*/

#include "shiftDisplay.h"

shiftDisplay::shiftDisplay(uint8_t _datPin, uint8_t _clkPin)
{
datPin = _datPin;
clkPin = _clkPin;
}

void shiftDisplay::setDigit(uint8_t digit)
{
; // Implement me later lol!
}
79 changes: 79 additions & 0 deletions Firmware/src/shiftDisplay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
* @file shiftDisplay.h
* @author Joe
* @brief Library for ShiftSegmentBoard
*/

// Libs
#include <Arduino.h>

class shiftDisplay
{
private:
uint8_t datPin;
uint8_t clkPin;

// Segments
enum Seg
{
s_A = 0b00000001,
s_B = 0b00000010,
s_C = 0b00000100,
s_D = 0b00001000,
s_E = 0b00010000,
s_F = 0b00100000,
s_G = 0b01000000,
s_DP = 0b10000000,
};

// Segment Lookup table
const uint8_t segmentLookup[37] = {
s_A | s_B | s_C | s_D | s_E | s_F, // 0
s_B | s_C, // 1
s_A | s_B | s_D | s_E | s_G, // 2
s_A | s_B | s_C | s_D | s_G, // 3
s_B | s_C | s_F | s_G, // 4
s_A | s_C | s_D | s_F | s_G, // 5
s_A | s_C | s_D | s_E | s_F | s_G, // 6
s_A | s_B | s_C, // 7
s_A | s_B | s_C | s_D | s_E | s_F | s_G, // 8
s_A | s_B | s_C | s_D | s_F | s_G, // 9
0, // null
s_A | s_B | s_C | s_E | s_F | s_G, // A
s_C | s_D | s_E | s_F | s_G, // b
s_A | s_D | s_E | s_F, // C
s_B | s_C | s_D | s_E | s_G, // d
s_A | s_D | s_E | s_F | s_G, // E
s_A | s_E | s_F | s_G, // F
s_A | s_C | s_D | s_E | s_F, // G
s_C | s_E | s_F | s_G, // h
s_B | s_C, // i
s_B | s_C | s_D, // j
s_A | s_C | s_E | s_F | s_G, // k
s_D | s_E | s_F, // L
s_A | s_C | s_E, // M
s_A | s_B | s_C | s_E | s_F, // N
s_A | s_B | s_C | s_D | s_E | s_F, // O
s_A | s_B | s_E | s_F | s_G, // p
s_A | s_B | s_C | s_F | s_G, // q
s_E | s_G, // r
s_A | s_C | s_D | s_F | s_G, // s
s_D | s_E | s_F | s_G, // t
s_B | s_C | s_D | s_E | s_F, // U
s_B | s_C | s_D | s_F, // V
s_B | s_D | s_F, // W
s_B | s_C | s_E | s_F | s_G, // X
s_B | s_C | s_D | s_F | s_G, // Y
s_A | s_B | s_D | s_G, // Z
};

public:
shiftDisplay(uint8_t _datPin, uint8_t _clkPin);

/**
* @brief Set the current digit
*
* @param digit A number or char corrsponding to the lookup chart.
*/
void setDigit(uint8_t digit);
};
11 changes: 0 additions & 11 deletions Firmware/test/README

This file was deleted.

0 comments on commit fe71689

Please sign in to comment.