Skip to content

Commit

Permalink
パワーダウン制御
Browse files Browse the repository at this point in the history
  • Loading branch information
Blue-Crescent committed Feb 10, 2024
1 parent ea5b177 commit 7e06f02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/JJYReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,31 +206,36 @@ JJYReceiver::status(){
return state;
}
JJYReceiver::freq(){
return (digitalRead(selpin) == LOW) ? 40 : 60;
return frequency;
}
JJYReceiver::freq(int freq){
if(freq == 40){
digitalWrite(selpin,LOW);
delay(300);
return 40;
}else if(freq == 60){
digitalWrite(selpin,HIGH);
delay(300);
return 60;
}
frequency = freq;
return frequency;
}

JJYReceiver::power(){
return (digitalRead(ponpin) == LOW) ? true : false;
}
JJYReceiver::power(bool power){
// PDN1(SEL) PDN2(PON)
// 0 0 freq2 40kHz
// 0 1 freq2 (non use)
// 1 0 freq1 60kHz
// 1 1 power down
if(ponpin == -1) return true;
if(power == true){
digitalWrite(ponpin,LOW);
delay(300);
return true;
}else{
digitalWrite(ponpin,HIGH);
digitalWrite(selpin,HIGH);
return false;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/JJYReceiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class JJYReceiver {
volatile enum STATE state = INIT;
volatile unsigned long fallingtime[2];
uint8_t datapin,ponpin = -1 ,selpin = -1;
uint8_t frequency;
// int agcpin;
volatile uint8_t markercount = 0;
volatile uint8_t reliability = 0;
Expand Down

0 comments on commit 7e06f02

Please sign in to comment.