fix compiler errors
This commit is contained in:
parent
860399deb1
commit
1943426294
@ -1,10 +1,6 @@
|
|||||||
#include "char_lcd.h"
|
#include "char_lcd.h"
|
||||||
|
|
||||||
#define CHAR_LCD_I2C_NUM I2C_NUM_0
|
i2c_lcd_pcf8574_handle_t lcd;
|
||||||
|
|
||||||
#define LCD_ADDR 0x27
|
|
||||||
#define LCD_COLS 20
|
|
||||||
#define LCD_ROWS 4
|
|
||||||
|
|
||||||
static const char *TAG = "char_lcd";
|
static const char *TAG = "char_lcd";
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#define CHAR_LCD_H
|
#define CHAR_LCD_H
|
||||||
|
|
||||||
#include "i2c_lcd_pcf8574.h"
|
#include "i2c_lcd_pcf8574.h"
|
||||||
|
#include <esp_log.h>
|
||||||
|
|
||||||
#define CHAR_LCD_I2C_NUM I2C_NUM_0
|
#define CHAR_LCD_I2C_NUM I2C_NUM_0
|
||||||
|
|
||||||
@ -9,9 +10,7 @@
|
|||||||
#define LCD_COLS 20
|
#define LCD_COLS 20
|
||||||
#define LCD_ROWS 4
|
#define LCD_ROWS 4
|
||||||
|
|
||||||
i2c_lcd_pcf8574_handle_t lcd;
|
extern i2c_lcd_pcf8574_handle_t lcd;
|
||||||
|
|
||||||
static const char *CHAR_LCD_TAG = "char_lcd";
|
|
||||||
|
|
||||||
void init_char_lcd(void);
|
void init_char_lcd(void);
|
||||||
|
|
||||||
|
|||||||
@ -34,19 +34,19 @@ void stop_module_timer(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void set_game_time(uint32_t new_time) {
|
void set_game_time(uint32_t new_time) {
|
||||||
time_left = new_time;
|
game_time_left = new_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t get_game_time() {
|
uint32_t get_game_time() {
|
||||||
return time_left;
|
return game_time_left;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_module_time(uint32_t new_time) {
|
void set_module_time(uint32_t new_time) {
|
||||||
time_left = new_time;
|
module_time_left = new_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t get_module_time() {
|
uint32_t get_module_time() {
|
||||||
return time_left;
|
return module_time_left;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void game_timer_task(void *arg)
|
static void game_timer_task(void *arg)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#define GAME_TIMER_H
|
#define GAME_TIMER_H
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "sseg.hpp"
|
#include "sseg.h"
|
||||||
|
|
||||||
/// Initializes the game and module timers.
|
/// Initializes the game and module timers.
|
||||||
void init_game_module_timer(void);
|
void init_game_module_timer(void);
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#include "leds.h"
|
#include "leds.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define PIXEL_COUNT 21
|
#define PIXEL_COUNT 21
|
||||||
#define NEOPIXEL_PIN GPIO_NUM_7
|
#define NEOPIXEL_PIN GPIO_NUM_7
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,10 @@
|
|||||||
#include "sd.h"
|
#include "sd.h"
|
||||||
|
|
||||||
|
sdmmc_card_t *card;
|
||||||
|
|
||||||
|
static const char* mount_point = MOUNT_POINT;
|
||||||
|
static const char* TAG = "sd";
|
||||||
|
|
||||||
void init_sd() {
|
void init_sd() {
|
||||||
esp_err_t ret;
|
esp_err_t ret;
|
||||||
|
|
||||||
@ -13,14 +18,14 @@ void init_sd() {
|
|||||||
.disk_status_check_enable = false,
|
.disk_status_check_enable = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
ESP_LOGI(SD_TAG, "Initializing SD card");
|
ESP_LOGI(TAG, "Initializing SD card");
|
||||||
|
|
||||||
// Use settings defined above to initialize SD card and mount FAT filesystem.
|
// Use settings defined above to initialize SD card and mount FAT filesystem.
|
||||||
// Note: esp_vfs_fat_sdmmc/sdspi_mount is all-in-one convenience functions.
|
// Note: esp_vfs_fat_sdmmc/sdspi_mount is all-in-one convenience functions.
|
||||||
// Please check its source code and implement error recovery when developing
|
// Please check its source code and implement error recovery when developing
|
||||||
// production applications.
|
// production applications.
|
||||||
|
|
||||||
ESP_LOGI(SD_TAG, "Using SDMMC peripheral");
|
ESP_LOGI(TAG, "Using SDMMC peripheral");
|
||||||
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
||||||
|
|
||||||
// This initializes the slot without card detect (CD) and write protect (WP) signals.
|
// This initializes the slot without card detect (CD) and write protect (WP) signals.
|
||||||
@ -44,20 +49,20 @@ void init_sd() {
|
|||||||
// connected on the bus. This is for debug / example purpose only.
|
// connected on the bus. This is for debug / example purpose only.
|
||||||
slot_config.flags |= SDMMC_SLOT_FLAG_INTERNAL_PULLUP;
|
slot_config.flags |= SDMMC_SLOT_FLAG_INTERNAL_PULLUP;
|
||||||
|
|
||||||
ESP_LOGI(SD_TAG, "Mounting filesystem");
|
ESP_LOGI(TAG, "Mounting filesystem");
|
||||||
ret = esp_vfs_fat_sdmmc_mount(mount_point, &host, &slot_config, &mount_config, &card);
|
ret = esp_vfs_fat_sdmmc_mount(mount_point, &host, &slot_config, &mount_config, &card);
|
||||||
|
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
if (ret == ESP_FAIL) {
|
if (ret == ESP_FAIL) {
|
||||||
ESP_LOGE(SD_TAG, "Failed to mount filesystem. "
|
ESP_LOGE(TAG, "Failed to mount filesystem. "
|
||||||
"If you want the card to be formatted, set the EXAMPLE_FORMAT_IF_MOUNT_FAILED menuconfig option.");
|
"If you want the card to be formatted, set the EXAMPLE_FORMAT_IF_MOUNT_FAILED menuconfig option.");
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGE(SD_TAG, "Failed to initialize the card (%s). "
|
ESP_LOGE(TAG, "Failed to initialize the card (%s). "
|
||||||
"Make sure SD card lines have pull-up resistors in place.", esp_err_to_name(ret));
|
"Make sure SD card lines have pull-up resistors in place.", esp_err_to_name(ret));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ESP_LOGI(SD_TAG, "Filesystem mounted");
|
ESP_LOGI(TAG, "Filesystem mounted");
|
||||||
|
|
||||||
// Card has been initialized, print its properties
|
// Card has been initialized, print its properties
|
||||||
sdmmc_card_print_info(stdout, card);
|
sdmmc_card_print_info(stdout, card);
|
||||||
@ -65,5 +70,5 @@ void init_sd() {
|
|||||||
|
|
||||||
void deinit_sd() {
|
void deinit_sd() {
|
||||||
esp_vfs_fat_sdcard_unmount(mount_point, card);
|
esp_vfs_fat_sdcard_unmount(mount_point, card);
|
||||||
ESP_LOGI(SD_TAG, "Card unmounted");
|
ESP_LOGI(TAG, "Card unmounted");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,9 +10,7 @@
|
|||||||
|
|
||||||
#define MOUNT_POINT "/sdcard"
|
#define MOUNT_POINT "/sdcard"
|
||||||
|
|
||||||
const char mount_point[] = MOUNT_POINT;
|
extern sdmmc_card_t *card;
|
||||||
|
|
||||||
sdmmc_card_t *card;
|
|
||||||
|
|
||||||
#define SD_PIN_CLK GPIO_NUM_48
|
#define SD_PIN_CLK GPIO_NUM_48
|
||||||
#define SD_PIN_CMD GPIO_NUM_45
|
#define SD_PIN_CMD GPIO_NUM_45
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "sd.hpp"
|
#include "sd.h"
|
||||||
|
|
||||||
#define SPEAKER_PIN_BCLK GPIO_NUM_46
|
#define SPEAKER_PIN_BCLK GPIO_NUM_46
|
||||||
#define SPEAKER_PIN_WS GPIO_NUM_9
|
#define SPEAKER_PIN_WS GPIO_NUM_9
|
||||||
@ -17,12 +17,8 @@
|
|||||||
#define SAMPLE_RATE 44100
|
#define SAMPLE_RATE 44100
|
||||||
#define AUDIO_BUFFER 2048
|
#define AUDIO_BUFFER 2048
|
||||||
|
|
||||||
static i2s_chan_handle_t tx_chan;
|
|
||||||
|
|
||||||
static const char *SPEAKER_TAG = "speaker_driver";
|
|
||||||
|
|
||||||
esp_err_t play_raw(const char *fp);
|
esp_err_t play_raw(const char *fp);
|
||||||
void init_speaker(void)
|
void init_speaker(void);
|
||||||
void play_example();
|
void play_example();
|
||||||
|
|
||||||
#endif /* SPEAKER_H */
|
#endif /* SPEAKER_H */
|
||||||
@ -1,5 +1,7 @@
|
|||||||
#include "sseg.h"
|
#include "sseg.h"
|
||||||
|
|
||||||
|
TM1640* sseg = nullptr;
|
||||||
|
|
||||||
static const char *TAG = "sseg_driver";
|
static const char *TAG = "sseg_driver";
|
||||||
|
|
||||||
void init_sseg() {
|
void init_sseg() {
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
#define SSEG_PIN_DATA GPIO_NUM_10
|
#define SSEG_PIN_DATA GPIO_NUM_10
|
||||||
#define SSEG_PIN_CLK GPIO_NUM_11
|
#define SSEG_PIN_CLK GPIO_NUM_11
|
||||||
|
|
||||||
TM1640* sseg = nullptr;
|
extern TM1640* sseg;
|
||||||
|
|
||||||
/// Initializes the seven segment driver
|
/// Initializes the seven segment driver
|
||||||
void init_sseg();
|
void init_sseg();
|
||||||
|
|||||||
@ -7,10 +7,10 @@
|
|||||||
#include "drivers/tft.hpp"
|
#include "drivers/tft.hpp"
|
||||||
#include "drivers/wires.h"
|
#include "drivers/wires.h"
|
||||||
#include "drivers/bottom_half.h"
|
#include "drivers/bottom_half.h"
|
||||||
#include "drivers/sd.hpp"
|
#include "drivers/sd.h"
|
||||||
#include "drivers/game_timer.hpp"
|
#include "drivers/game_timer.h"
|
||||||
#include "drivers/speaker.hpp"
|
#include "drivers/speaker.h"
|
||||||
#include "drivers/char_lcd.hpp"
|
#include "drivers/char_lcd.h"
|
||||||
#include "esp_rom_gpio.h"
|
#include "esp_rom_gpio.h"
|
||||||
|
|
||||||
#include "steps/step0.hpp"
|
#include "steps/step0.hpp"
|
||||||
@ -25,7 +25,6 @@
|
|||||||
#define WIRES_REG_WIRES
|
#define WIRES_REG_WIRES
|
||||||
|
|
||||||
static const char *TAG = "main";
|
static const char *TAG = "main";
|
||||||
static void relay_task(void *arg);
|
|
||||||
|
|
||||||
extern "C" void app_main(void) {
|
extern "C" void app_main(void) {
|
||||||
printf("app_main\n");
|
printf("app_main\n");
|
||||||
@ -34,7 +33,7 @@ extern "C" void app_main(void) {
|
|||||||
init_tft();
|
init_tft();
|
||||||
init_speaker();
|
init_speaker();
|
||||||
init_sseg();
|
init_sseg();
|
||||||
init_game_timer();
|
init_game_module_timer();
|
||||||
init_wires();
|
init_wires();
|
||||||
|
|
||||||
init_bottom_half();
|
init_bottom_half();
|
||||||
@ -42,7 +41,7 @@ extern "C" void app_main(void) {
|
|||||||
|
|
||||||
step0();
|
step0();
|
||||||
set_game_time(30000);
|
set_game_time(30000);
|
||||||
start_timer();
|
start_game_timer();
|
||||||
step1();
|
step1();
|
||||||
step2();
|
step2();
|
||||||
step3();
|
step3();
|
||||||
@ -50,7 +49,7 @@ extern "C" void app_main(void) {
|
|||||||
step5();
|
step5();
|
||||||
step6();
|
step6();
|
||||||
|
|
||||||
stop_timer();
|
stop_game_timer();
|
||||||
ESP_LOGI(TAG, "Bomb has been diffused. Counter-Terrorists win.");
|
ESP_LOGI(TAG, "Bomb has been diffused. Counter-Terrorists win.");
|
||||||
ESP_ERROR_CHECK_WITHOUT_ABORT(play_raw("/sdcard/diffused.pcm"));
|
ESP_ERROR_CHECK_WITHOUT_ABORT(play_raw("/sdcard/diffused.pcm"));
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#define SETUP_WIRES_HPP
|
#define SETUP_WIRES_HPP
|
||||||
|
|
||||||
#include "../drivers/bottom_half.h"
|
#include "../drivers/bottom_half.h"
|
||||||
#include "../drivers/char_lcd.hpp"
|
#include "../drivers/char_lcd.h"
|
||||||
#include "wires_puzzle.h"
|
#include "wires_puzzle.h"
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#define STEP_0_HPP
|
#define STEP_0_HPP
|
||||||
|
|
||||||
#include "../drivers/bottom_half.h"
|
#include "../drivers/bottom_half.h"
|
||||||
#include "../drivers/char_lcd.hpp"
|
#include "../drivers/char_lcd.h"
|
||||||
#include "../drivers/wires.h"
|
#include "../drivers/wires.h"
|
||||||
#include "setup_wires.hpp"
|
#include "setup_wires.hpp"
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user