This commit is contained in:
Morgan 'ARR\!' Allen 2019-05-06 16:55:10 -07:00
commit 96b4267c2c
2 changed files with 51 additions and 0 deletions

8
Makefile Normal file
View file

@ -0,0 +1,8 @@
#
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
# project subdirectory.
#
PROJECT_NAME := grii
include $(IDF_PATH)/make/project.mk

43
main/main.c Normal file
View file

@ -0,0 +1,43 @@
/*
* Copyright 2019 by Morgan Allen
*
* This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International
* https://creativecommons.org/licenses/by-nc/4.0/
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "driver/spi_master.h"
#include "esp_system.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "esp_http_client.h"
#define TAG "CACO"
static uint8_t id;
void app_main() {
esp_err_t ret;
// Initialize NVS.
ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_LOGI(TAG, "Erasing flash memory");
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK( ret );
uint8_t *mac;
mac = (uint8_t *)malloc(6);
esp_efuse_mac_get_default(mac);
id = mac[5];
ESP_LOGI(TAG, "MAC: %X:%X:%X:%X:%X:%X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
};