add git branch for can
This commit is contained in:
5
mainboard/.gitignore
vendored
5
mainboard/.gitignore
vendored
@@ -1,5 +0,0 @@
|
|||||||
.pio
|
|
||||||
.vscode/.browse.c_cpp.db*
|
|
||||||
.vscode/c_cpp_properties.json
|
|
||||||
.vscode/launch.json
|
|
||||||
.vscode/ipch
|
|
||||||
10
mainboard/.vscode/extensions.json
vendored
10
mainboard/.vscode/extensions.json
vendored
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
|
||||||
// for the documentation about the extensions.json format
|
|
||||||
"recommendations": [
|
|
||||||
"platformio.platformio-ide"
|
|
||||||
],
|
|
||||||
"unwantedRecommendations": [
|
|
||||||
"ms-vscode.cpptools-extension-pack"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.16.0)
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|
||||||
project(mainboard)
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
|
|
||||||
This directory is intended for project header files.
|
|
||||||
|
|
||||||
A header file is a file containing C declarations and macro definitions
|
|
||||||
to be shared between several project source files. You request the use of a
|
|
||||||
header file in your project source file (C, C++, etc) located in `src` folder
|
|
||||||
by including it, with the C preprocessing directive `#include'.
|
|
||||||
|
|
||||||
```src/main.c
|
|
||||||
|
|
||||||
#include "header.h"
|
|
||||||
|
|
||||||
int main (void)
|
|
||||||
{
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Including a header file produces the same results as copying the header file
|
|
||||||
into each source file that needs it. Such copying would be time-consuming
|
|
||||||
and error-prone. With a header file, the related declarations appear
|
|
||||||
in only one place. If they need to be changed, they can be changed in one
|
|
||||||
place, and programs that include the header file will automatically use the
|
|
||||||
new version when next recompiled. The header file eliminates the labor of
|
|
||||||
finding and changing all the copies as well as the risk that a failure to
|
|
||||||
find one copy will result in inconsistencies within a program.
|
|
||||||
|
|
||||||
In C, the convention is to give header files names that end with `.h'.
|
|
||||||
|
|
||||||
Read more about using header files in official GCC documentation:
|
|
||||||
|
|
||||||
* Include Syntax
|
|
||||||
* Include Operation
|
|
||||||
* Once-Only Headers
|
|
||||||
* Computed Includes
|
|
||||||
|
|
||||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
|
|
||||||
This directory is intended for project specific (private) libraries.
|
|
||||||
PlatformIO will compile them to static libraries and link into the executable file.
|
|
||||||
|
|
||||||
The source code of each library should be placed in a separate directory
|
|
||||||
("lib/your_library_name/[Code]").
|
|
||||||
|
|
||||||
For example, see the structure of the following example libraries `Foo` and `Bar`:
|
|
||||||
|
|
||||||
|--lib
|
|
||||||
| |
|
|
||||||
| |--Bar
|
|
||||||
| | |--docs
|
|
||||||
| | |--examples
|
|
||||||
| | |--src
|
|
||||||
| | |- Bar.c
|
|
||||||
| | |- Bar.h
|
|
||||||
| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
|
||||||
| |
|
|
||||||
| |--Foo
|
|
||||||
| | |- Foo.c
|
|
||||||
| | |- Foo.h
|
|
||||||
| |
|
|
||||||
| |- README --> THIS FILE
|
|
||||||
|
|
|
||||||
|- platformio.ini
|
|
||||||
|--src
|
|
||||||
|- main.c
|
|
||||||
|
|
||||||
Example contents of `src/main.c` using Foo and Bar:
|
|
||||||
```
|
|
||||||
#include <Foo.h>
|
|
||||||
#include <Bar.h>
|
|
||||||
|
|
||||||
int main (void)
|
|
||||||
{
|
|
||||||
...
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
The PlatformIO Library Dependency Finder will find automatically dependent
|
|
||||||
libraries by scanning project source files.
|
|
||||||
|
|
||||||
More information about PlatformIO Library Dependency Finder
|
|
||||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
; PlatformIO Project Configuration File
|
|
||||||
;
|
|
||||||
; Build options: build flags, source filter
|
|
||||||
; Upload options: custom upload port, speed and extra flags
|
|
||||||
; Library options: dependencies, extra library storages
|
|
||||||
; Advanced options: extra scripting
|
|
||||||
;
|
|
||||||
; Please visit documentation for the other options and examples
|
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
|
||||||
|
|
||||||
[env:esp32doit-devkit-v1]
|
|
||||||
platform = espressif32
|
|
||||||
board = esp32doit-devkit-v1
|
|
||||||
framework = arduino
|
|
||||||
lib_deps = t-vk/ESP32 BLE Keyboard@^0.3.2
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +0,0 @@
|
|||||||
# This file was automatically generated for projects
|
|
||||||
# without default 'CMakeLists.txt' file.
|
|
||||||
|
|
||||||
FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*)
|
|
||||||
|
|
||||||
idf_component_register(SRCS ${app_sources})
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
#include <Arduino.h>
|
|
||||||
#include <BleKeyboard.h>
|
|
||||||
|
|
||||||
#define ROWS 2
|
|
||||||
#define COLS 2
|
|
||||||
|
|
||||||
int ROW[] = {15,2};
|
|
||||||
int COL[] = {0,4};
|
|
||||||
|
|
||||||
//Stores The Raw Report of the Keyboard
|
|
||||||
uint8_t keyboard_report[ROWS][COLS];
|
|
||||||
|
|
||||||
//Stores The Mapping of Each of The Key. Mapping is based of the ASCII value of that key.
|
|
||||||
//Mappings are in the 2D Space - it's shifted version is 32 bits more than the original
|
|
||||||
//Thus to get shifted version of M which is 0x4D we can add it by 32 which would be 0x6D
|
|
||||||
//
|
|
||||||
// Potential Improvements:
|
|
||||||
// It may be possible to make a firmware by just altering this variable to the mappings are reconfigurable.
|
|
||||||
// It may be possible to use more than 2 dimension of the array to allocate for special "shift" keys found on SFF keyboards
|
|
||||||
uint8_t keyboard_mapping[ROWS][COLS] = {
|
|
||||||
{0x4D,0x69},
|
|
||||||
{0x4B,0x55},
|
|
||||||
};
|
|
||||||
|
|
||||||
//Temporary variable to store old and new keyoard report.
|
|
||||||
//This way we only change the keyboard state when there is a change in the raw data.
|
|
||||||
//This allows us to hold keys and press multiple at the same time
|
|
||||||
//Rather than sending individual keystroke each press
|
|
||||||
uint8_t old_report;
|
|
||||||
uint8_t new_report;
|
|
||||||
|
|
||||||
BleKeyboard bleKeyboard("ModularKeyboard_MainBoard");
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Serial.begin(115200);
|
|
||||||
Serial.println("Starting BLE");
|
|
||||||
bleKeyboard.begin();
|
|
||||||
for (int i=0; i<COLS; i++){
|
|
||||||
pinMode(ROW[i], INPUT);
|
|
||||||
pinMode(COL[i], OUTPUT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
if(bleKeyboard.isConnected()){
|
|
||||||
// Reset keyboard report
|
|
||||||
for (int i = 0; i < 2; i++) {
|
|
||||||
for (int j = 0; j < 2; j++) {
|
|
||||||
keyboard_report[i][j] = 0x0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Read keyboard report and send
|
|
||||||
for(int i=0; i < COLS; i++){
|
|
||||||
//Write to the column
|
|
||||||
digitalWrite(COL[i], HIGH);
|
|
||||||
for(int j=0; j < ROWS; j++){
|
|
||||||
//Read row input
|
|
||||||
old_report = keyboard_report[i][j]; //See line 25
|
|
||||||
new_report = digitalRead(ROW[j]);
|
|
||||||
if(old_report!=new_report){
|
|
||||||
if(new_report){
|
|
||||||
bleKeyboard.press(keyboard_mapping[i][j]);
|
|
||||||
}else{
|
|
||||||
bleKeyboard.release(keyboard_mapping[i][j]);
|
|
||||||
bleKeyboard.release(keyboard_mapping[i][j] + 32); //Shifted version
|
|
||||||
}
|
|
||||||
keyboard_report[i][j] = new_report;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
This directory is intended for PlatformIO Test Runner and project tests.
|
|
||||||
|
|
||||||
Unit Testing is a software testing method by which individual units of
|
|
||||||
source code, sets of one or more MCU program modules together with associated
|
|
||||||
control data, usage procedures, and operating procedures, are tested to
|
|
||||||
determine whether they are fit for use. Unit testing finds problems early
|
|
||||||
in the development cycle.
|
|
||||||
|
|
||||||
More information about PlatformIO Unit Testing:
|
|
||||||
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
|
|
||||||
5
modules/testmodule/.gitignore
vendored
5
modules/testmodule/.gitignore
vendored
@@ -1,5 +0,0 @@
|
|||||||
.pio
|
|
||||||
.vscode/.browse.c_cpp.db*
|
|
||||||
.vscode/c_cpp_properties.json
|
|
||||||
.vscode/launch.json
|
|
||||||
.vscode/ipch
|
|
||||||
10
modules/testmodule/.vscode/extensions.json
vendored
10
modules/testmodule/.vscode/extensions.json
vendored
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
|
||||||
// for the documentation about the extensions.json format
|
|
||||||
"recommendations": [
|
|
||||||
"platformio.platformio-ide"
|
|
||||||
],
|
|
||||||
"unwantedRecommendations": [
|
|
||||||
"ms-vscode.cpptools-extension-pack"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
|
|
||||||
This directory is intended for project header files.
|
|
||||||
|
|
||||||
A header file is a file containing C declarations and macro definitions
|
|
||||||
to be shared between several project source files. You request the use of a
|
|
||||||
header file in your project source file (C, C++, etc) located in `src` folder
|
|
||||||
by including it, with the C preprocessing directive `#include'.
|
|
||||||
|
|
||||||
```src/main.c
|
|
||||||
|
|
||||||
#include "header.h"
|
|
||||||
|
|
||||||
int main (void)
|
|
||||||
{
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Including a header file produces the same results as copying the header file
|
|
||||||
into each source file that needs it. Such copying would be time-consuming
|
|
||||||
and error-prone. With a header file, the related declarations appear
|
|
||||||
in only one place. If they need to be changed, they can be changed in one
|
|
||||||
place, and programs that include the header file will automatically use the
|
|
||||||
new version when next recompiled. The header file eliminates the labor of
|
|
||||||
finding and changing all the copies as well as the risk that a failure to
|
|
||||||
find one copy will result in inconsistencies within a program.
|
|
||||||
|
|
||||||
In C, the convention is to give header files names that end with `.h'.
|
|
||||||
|
|
||||||
Read more about using header files in official GCC documentation:
|
|
||||||
|
|
||||||
* Include Syntax
|
|
||||||
* Include Operation
|
|
||||||
* Once-Only Headers
|
|
||||||
* Computed Includes
|
|
||||||
|
|
||||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
|
|
||||||
This directory is intended for project specific (private) libraries.
|
|
||||||
PlatformIO will compile them to static libraries and link into the executable file.
|
|
||||||
|
|
||||||
The source code of each library should be placed in a separate directory
|
|
||||||
("lib/your_library_name/[Code]").
|
|
||||||
|
|
||||||
For example, see the structure of the following example libraries `Foo` and `Bar`:
|
|
||||||
|
|
||||||
|--lib
|
|
||||||
| |
|
|
||||||
| |--Bar
|
|
||||||
| | |--docs
|
|
||||||
| | |--examples
|
|
||||||
| | |--src
|
|
||||||
| | |- Bar.c
|
|
||||||
| | |- Bar.h
|
|
||||||
| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
|
||||||
| |
|
|
||||||
| |--Foo
|
|
||||||
| | |- Foo.c
|
|
||||||
| | |- Foo.h
|
|
||||||
| |
|
|
||||||
| |- README --> THIS FILE
|
|
||||||
|
|
|
||||||
|- platformio.ini
|
|
||||||
|--src
|
|
||||||
|- main.c
|
|
||||||
|
|
||||||
Example contents of `src/main.c` using Foo and Bar:
|
|
||||||
```
|
|
||||||
#include <Foo.h>
|
|
||||||
#include <Bar.h>
|
|
||||||
|
|
||||||
int main (void)
|
|
||||||
{
|
|
||||||
...
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
The PlatformIO Library Dependency Finder will find automatically dependent
|
|
||||||
libraries by scanning project source files.
|
|
||||||
|
|
||||||
More information about PlatformIO Library Dependency Finder
|
|
||||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
#include "stm32f1xx_hal.h"
|
|
||||||
|
|
||||||
#define NUM_COLS 2
|
|
||||||
#define NUM_ROWS 2
|
|
||||||
|
|
||||||
//Stores the GPIO and the PIN location - would be useful for the matrix
|
|
||||||
typedef struct {
|
|
||||||
GPIO_TypeDef* GPIO;
|
|
||||||
uint16_t PIN;
|
|
||||||
} keyMatrix ;
|
|
||||||
|
|
||||||
keyMatrix matrix[NUM_COLS][NUM_ROWS] = {
|
|
||||||
{{GPIOA, GPIO_PIN_0},{GPIOA, GPIO_PIN_1}}, //Column
|
|
||||||
{{GPIOA, GPIO_PIN_2},{GPIOA, GPIO_PIN_3}} //Row
|
|
||||||
};
|
|
||||||
|
|
||||||
int main(void){
|
|
||||||
|
|
||||||
HAL_Init(); //Initialize the HAL Abstraction Layer
|
|
||||||
|
|
||||||
//Initialize a 2x2 pins
|
|
||||||
for(int col = 0; col<NUM_COLS; col++){
|
|
||||||
GPIO_InitTypeDef GPIO_InitCols = {0};
|
|
||||||
GPIO_InitCols.Pin = matrix[0][col].PIN;
|
|
||||||
GPIO_InitCols.Mode = GPIO_MODE_OUTPUT_PP;
|
|
||||||
GPIO_InitCols.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitCols.Speed = GPIO_SPEED_FREQ_LOW;
|
|
||||||
HAL_GPIO_Init(matrix[0][col].GPIO, &GPIO_InitCols);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int row = 0; row<NUM_ROWS; row++){
|
|
||||||
GPIO_InitTypeDef GPIO_InitRows = {0};
|
|
||||||
GPIO_InitRows.Pin = matrix[1][row].PIN;
|
|
||||||
GPIO_InitRows.Mode = GPIO_MODE_INPUT;
|
|
||||||
GPIO_InitRows.Pull = GPIO_PULLDOWN;
|
|
||||||
HAL_GPIO_Init(matrix[0][row].GPIO, &GPIO_InitRows);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: Deboucing Code - I suggest not to use HAL_Delay() beacause it is blocking
|
|
||||||
// and might affect performance and introduce input delay.
|
|
||||||
for(int col=0; col<NUM_COLS; col++){
|
|
||||||
//Set column to high
|
|
||||||
HAL_GPIO_WritePin(matrix[0][col].GPIO, matrix[0][col].PIN, GPIO_PIN_SET);
|
|
||||||
|
|
||||||
//Read each row pin
|
|
||||||
for(int row=0; row<NUM_ROWS; row++){
|
|
||||||
if(HAL_GPIO_ReadPin(matrix[1][row].GPIO, matrix[0][col].PIN)){
|
|
||||||
//Register Key Press here
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set column to back to low
|
|
||||||
HAL_GPIO_WritePin(matrix[0][col].GPIO, matrix[0][col].PIN, GPIO_PIN_RESET);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Would be nice if someone can abstract all of keyboard checking and initialization
|
|
||||||
into a separate include file so we can reuse it with other modules
|
|
||||||
*/
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
; PlatformIO Project Configuration File
|
|
||||||
;
|
|
||||||
; Build options: build flags, source filter
|
|
||||||
; Upload options: custom upload port, speed and extra flags
|
|
||||||
; Library options: dependencies, extra library storages
|
|
||||||
; Advanced options: extra scripting
|
|
||||||
;
|
|
||||||
; Please visit documentation for the other options and examples
|
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
|
||||||
|
|
||||||
[env:genericSTM32F103C4]
|
|
||||||
platform = ststm32
|
|
||||||
board = genericSTM32F103C4
|
|
||||||
framework = stm32cube
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
This directory is intended for PlatformIO Test Runner and project tests.
|
|
||||||
|
|
||||||
Unit Testing is a software testing method by which individual units of
|
|
||||||
source code, sets of one or more MCU program modules together with associated
|
|
||||||
control data, usage procedures, and operating procedures, are tested to
|
|
||||||
determine whether they are fit for use. Unit testing finds problems early
|
|
||||||
in the development cycle.
|
|
||||||
|
|
||||||
More information about PlatformIO Unit Testing:
|
|
||||||
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
|
|
||||||
Reference in New Issue
Block a user