Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nose software1 #12

Merged
merged 27 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3185e41
nose software develop start, try mcp3421
nihinihikun Dec 26, 2023
23b9a6d
adc covert to voltage, successed
nihinihikun Dec 27, 2023
d75e37a
test rp2040 and mcp3421
nihinihikun Dec 27, 2023
37b76f5
add readme to leave note
nihinihikun Dec 27, 2023
3f9322f
Create bme280test.ino
nihinihikun Dec 28, 2023
6ffb118
mcp3421とBME280統合
nihinihikun Dec 28, 2023
c1504fd
Create nose1.ino
nihinihikun Dec 28, 2023
2807d40
overruntest
nihinihikun Dec 29, 2023
baac4f9
Update arduino_ci.yml
771-8bit Dec 30, 2023
918a4f8
Update arduino_ci.yml
771-8bit Dec 30, 2023
68883fb
Update arduino_ci.yml
771-8bit Dec 30, 2023
1861f6e
Update arduino_ci.yml
771-8bit Dec 30, 2023
5e1f8e0
ファイル整理
nihinihikun Dec 31, 2023
9f18972
add status check
nihinihikun Jan 3, 2024
cc9d769
delete missing spaces
nihinihikun Jan 13, 2024
b7cf0ff
delete extra variables
nihinihikun Jan 13, 2024
0df9e7f
Update arduino_ci.yml
771-8bit Jan 13, 2024
e4688e0
Update arduino_ci.yml
771-8bit Jan 13, 2024
5c8b4d6
Update arduino_ci.yml
771-8bit Jan 13, 2024
0fced30
Merge branch 'main' into nose_software1
771-8bit Jan 13, 2024
a400766
Update arduino_ci.yml
771-8bit Jan 13, 2024
30499e9
Merge branch 'nose_software1' of https://github.com/core-rocket/24th-…
771-8bit Jan 13, 2024
2ef5251
Merge branch 'main' into nose_software1
771-8bit Jan 13, 2024
1884bef
Update arduino_ci.yml
771-8bit Jan 13, 2024
5886f89
delete Nose Build CI
771-8bit Jan 13, 2024
f13216a
modify C-style castings
nihinihikun Jan 13, 2024
ef97a3f
Merge branch 'nose_software1' of https://github.com/core-rocket/24th-…
nihinihikun Jan 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/arduino_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,16 @@ jobs:
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
flags: --linelength=50 # Optional
filter: "-readability/braces\
,-whitespace/braces\
,-whitespace/comments\
,-whitespace/indent\
,-whitespace/newline\
,-whitespace/operators\
,-whitespace/parens\
,-whitespace/tab\
,-whitespace/line_length\
,-build/header_guard\
" # Optional

build:
Expand Down
File renamed without changes.
File renamed without changes.
59 changes: 59 additions & 0 deletions Nose/softwarememo.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# ノーズソフトメモ"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 使用ライブラリ\n",
"- [MCP3421](https://github.com/uChip/MCP342X)\n",
"- "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## rp2040を使う上での注意点\n",
"\n",
"- USB認識をしなくなったら,BOOTボタンを押しながらUSB接続し,RP2040のドライブにリセット用のuf2ファイルをドラック&ドロップ\n",
"- Wire.hを使う前に,rp2040はI2Cがいくつもあるので,どのGPIOを使うか宣言する必要がある.\n",
"```\n",
"#define PIN1_SDA 6\n",
"#define PIN1_SCL 7\n",
"Wire.setSDA(PIN1_SDA);\n",
"Wire.setSCL(PIN1_SCL);\n",
"Wire.begin(); \n",
"```\n",
"といったように"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
48 changes: 48 additions & 0 deletions Nose/source/BME_high_rate/BME_high_rate.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <Wire.h>
#include <Adafruit_BME280.h>


#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]


unsigned long delayTime;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Use int16/int64/etc, rather than the C type long [runtime/int] [4]

const int clockFrequency = 400000;//I2C bus speed

void setup() {
Serial.begin(115200);
unsigned status;
Wire.setSDA(6);
Wire.setSCL(7);
Wire.setClock(clockFrequency);
Wire.begin();
status = bme.begin(0x76);
}


void loop() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

printValues();
delay(5);
}


void printValues() {
Serial.print("Temperature = ");
Serial.print(bme.readTemperature());
Serial.println(" °C");

Serial.print("Pressure = ");

Serial.print(bme.readPressure() / 100.0F);
Serial.println(" hPa");

Serial.print("Approx. Altitude = ");
Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println(" m");

Serial.print("Humidity = ");
Serial.print(bme.readHumidity());
Serial.println(" %");

Serial.println();
}
83 changes: 83 additions & 0 deletions Nose/source/BME_mcp3421/BME_mcp3421.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#include <Wire.h>
#include <Adafruit_BME280.h>
#include <MCP342X.h>

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

MCP342X myADC;

unsigned long delayTime;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Use int16/int64/etc, rather than the C type long [runtime/int] [4]

const int clockFrequency = 400000;//I2C bus speed

double voltage;

void setup() {
Serial.begin(115200);
unsigned status;
Wire.setSDA(6);
Wire.setSCL(7);
Wire.setClock(clockFrequency);
Wire.begin();
status = bme.begin(0x76);
myADC.configure( MCP342X_MODE_CONTINUOUS |
MCP342X_CHANNEL_1 |
MCP342X_SIZE_18BIT |
MCP342X_GAIN_1X
);
}


void loop() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

printValues();

static int32_t result;
byte bytes[4];
myADC.startConversion();
myADC.getResult(&result);
ConvertToVoltage(&result,&voltage);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]

Serial.print("voltage:");
Serial.println(voltage,10);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]

delay(5);
}


void printValues() {
Serial.print("Temperature = ");
Serial.print(bme.readTemperature());
Serial.println(" °C");

Serial.print("Pressure = ");

Serial.print(bme.readPressure() / 100.0F);
Serial.println(" hPa");

Serial.print("Approx. Altitude = ");
Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println(" m");

Serial.print("Humidity = ");
Serial.print(bme.readHumidity());
Serial.println(" %");

Serial.println();
}

void ConvertToVoltage(int32_t* _result,double* voltage){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]

byte bytes[4];
bytes[3] = (char)(*_result & 0xFF);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]

bytes[2] = (char)((*_result >> 8) & 0xFF);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]

bytes[1] = (char)((*_result >> 16) & 0xFF);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]

bytes[0] = (char)((*_result >> 24) & 0xFF); //ライブラリの関数内で8bit右シフトしたときに発生したものなので無視

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]

double pga=1;
double lsb=2*2.048/pow(2,18);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Missing space after , [whitespace/comma] [3]


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]

byte msb=(bytes[1]>>6)&0x01;
uint32_t outputcode=bytes[3]|(bytes[2]<<8)|((bytes[1]*0x01)<<16);
if(msb==0x00){//正の値
*voltage=(double)(outputcode)*lsb/pga;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]

}else{//負の値
outputcode=((~outputcode)&0x01FFFF)+1;//2の補数
*voltage=-(double)(outputcode)*lsb/pga;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Using C-style cast. Use static_cast(...) instead [readability/casting] [4]

}
}
22 changes: 22 additions & 0 deletions Nose/source/MCP342X-master/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
Loading
Loading