Skip to content

Commit

Permalink
Merge pull request #21 from hagen-git/master
Browse files Browse the repository at this point in the history
Cleanup, add examples
  • Loading branch information
Lee Seungcheol authored Feb 22, 2021
2 parents 4f06520 + c502792 commit 4a496e3
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 14 deletions.
1 change: 1 addition & 0 deletions examples/Speaker/Speaker.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <odroid_go.h>
#include <utility/music_8bit.h>

void setup() {
// put your setup code here, to run once:
Expand Down
13 changes: 13 additions & 0 deletions examples/TFT_Image/TFT_Image.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <odroid_go.h>
#include <utility/bmp_map.h>

// Show M5STACK logo from bmp_map.h (rgb565 format)

void setup() {
GO.begin();
uint16_t *img = (uint16_t *)((void *)gImage_logoM5);
GO.lcd.pushRect(0,0,320,240,img);
}

void loop() {
}
4 changes: 4 additions & 0 deletions prebuilt/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ODROID-GO

These files are binaries pre-built from the Arduino sketches. You can upload them to the ODROID-GO with the ESP32 upload tool, but the upload will overwrite the standard firmware loader.

Better is to convert these `.ino.bin` files into `.fw` files, and copy them onto the SD card. Then you can select them with the firmware selector when you power-on the ODROID-GO while pressing the 'B' button.

Copy .fw files to your SD card "odroid/firmware/" folder

- [How to make Arduino Applications for ODROID-GO](https://wiki.odroid.com/odroid_go/arduino_app#make_arduino_applications_for_odroid-go)
Expand Down
4 changes: 0 additions & 4 deletions src/odroid_go.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

#include "utility/Display.h"
#include "utility/Speaker.h"
#include "utility/music_8bit.h"
#include "utility/Button.h"
#include "utility/bmp_map.h"
#include "utility/battery.h"

extern "C" {
Expand All @@ -34,12 +32,10 @@ class ODROID_GO {
Button BtnSelect = Button(BUTTON_SELECT, true, DEBOUNCE_MS);
Button BtnStart = Button(BUTTON_START, true, DEBOUNCE_MS);

// LCD
ILI9341 lcd = ILI9341();
SPEAKER Speaker;
Battery battery;


};

extern ODROID_GO GO;
Expand Down
File renamed without changes.
23 changes: 17 additions & 6 deletions src/utility/Config.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_

#define TFT_DC 21
#define TFT_CS 5
#define TFT_LED_PIN 14
// TFT LCD via SPI
#define TFT_DC 21 // Data/Control pin
#define TFT_CS 5 // Chip Select
#define TFT_LED_PIN 14 // Backlight enable
#define TFT_MOSI 23
#define TFT_MISO 19
#define TFT_SCLK 18
#define TFT_RST -1
#define TFT_RST -1 // (not connected)

// microSD Card (TF) via SPI
#define SD_CARD_CS 22

// Digital Buttons
#define BUTTON_A_PIN 32
#define BUTTON_B_PIN 33

#define BUTTON_MENU 13
#define BUTTON_SELECT 27
#define BUTTON_VOLUME 0
#define BUTTON_START 39

// Analog Buttons
#define BUTTON_JOY_Y 35
#define BUTTON_JOY_X 34


// Speaker
#define SPEAKER_ENABLE_PIN 25
#define SPEAKER_PIN 26
#define TONE_PIN_CHANNEL 0
#define TONE_PIN_CHANNEL 0 // PWM Channel

// Status LED (blue)
#define LED_STATUS_PIN 2

#endif
File renamed without changes.
9 changes: 5 additions & 4 deletions src/utility/Speaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ SPEAKER::SPEAKER(void) {
}

void SPEAKER::begin() {
ledcSetup(TONE_PIN_CHANNEL, 0, 13);
ledcSetup(TONE_PIN_CHANNEL, 0, 13); // PWM channel, frequency, resolution in bits
ledcAttachPin(SPEAKER_PIN, TONE_PIN_CHANNEL);
// digitalWrite(SPEAKER_PIN, 0);
pinMode(25, OUTPUT);
digitalWrite(25, HIGH);
setBeep(1000, 100);
pinMode(SPEAKER_ENABLE_PIN, OUTPUT);
digitalWrite(SPEAKER_ENABLE_PIN, HIGH); // IO25 drives PAM8304 'IN-' and '/SD' pins
setBeep(1000, 100); // standard beep is 1kHz for 0.1 seconds
}

void SPEAKER::end() {
ledcDetachPin(SPEAKER_PIN);
// digitalWrite(SPEAKER_ENABLE_PIN, LOW);
}

void SPEAKER::tone(uint16_t frequency) {
Expand Down

0 comments on commit 4a496e3

Please sign in to comment.