diff options
author | Eric Dao <eric@erickhangdao.com> | 2022-07-09 22:38:28 -0400 |
---|---|---|
committer | Eric Dao <eric@erickhangdao.com> | 2022-07-09 22:38:28 -0400 |
commit | cb234a53f606de8bd136b596a316e912ddf15185 (patch) | |
tree | c5f4bf00e4e7e038c24f4ff79f3c5f7af9474ca9 /software/include | |
parent | 9dd37009b3dc7d4d155f5c1a529ace46e55c8e0d (diff) | |
download | motorized_blinds-master.tar.gz motorized_blinds-master.tar.bz2 motorized_blinds-master.zip |
Diffstat (limited to 'software/include')
-rw-r--r-- | software/include/sntp.h | 18 | ||||
-rw-r--r-- | software/include/stepper.h | 29 | ||||
-rw-r--r-- | software/include/sun.h | 18 | ||||
-rw-r--r-- | software/include/wifi.h | 29 |
4 files changed, 94 insertions, 0 deletions
diff --git a/software/include/sntp.h b/software/include/sntp.h new file mode 100644 index 0000000..02263c1 --- /dev/null +++ b/software/include/sntp.h @@ -0,0 +1,18 @@ +#include <string.h> +#include <time.h> +#include <sys/time.h> +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/event_groups.h" +#include "esp_system.h" +#include "esp_event.h" +#include "esp_log.h" +#include "esp_attr.h" +#include "esp_sleep.h" +#include "nvs_flash.h" +#include "esp_sntp.h" + +static const char *SNTP_TAG = "SNTP"; + +void obtain_time(void); +void initialize_sntp(void);
\ No newline at end of file diff --git a/software/include/stepper.h b/software/include/stepper.h new file mode 100644 index 0000000..6052a2e --- /dev/null +++ b/software/include/stepper.h @@ -0,0 +1,29 @@ +#include <stdint.h> +#include <stdbool.h> + +// FOR L928N DRIVER +//#define CW 1 +//#define CCW 0 + +// FOR L928N DRIVER +// struct stepper_pins_t { +// uint8_t pin1; +// uint8_t pin2; +// uint8_t pin3; +// uint8_t pin4; +// }; + +// void stepper_init(struct stepper_pins_t *stepper_ptr); +// void stepper_uninit(struct stepper_pins_t *stepper_ptr); +// void step(struct stepper_pins_t *stepper_ptr, int step); +// void half_steps(struct stepper_pins_t *stepper_ptr, int steps, bool dir); + +// FOR A4988 DRIVER +#define HIGH 1 +#define LOW 0 + +void stepper_init(void); +void stepper_uninit(void); + +void stepper_open(void); +void stepper_close(void);
\ No newline at end of file diff --git a/software/include/sun.h b/software/include/sun.h new file mode 100644 index 0000000..33f4eb7 --- /dev/null +++ b/software/include/sun.h @@ -0,0 +1,18 @@ +#include <stdio.h> +#include <string.h> +#include <stdbool.h> +#include <math.h> +#include <sys/time.h> +#include <time.h> + +#define LOCAL_OFFSET -4 + +#define LONGITUDE -79.3832 +#define LATITUDE 43.6532 + +#define _USE_MATH_DEFINES + +double deg_to_rad(double angle); +double rad_to_deg(double angle); + +double sun_calculation(struct tm curr_time, double longitude, double latitude); diff --git a/software/include/wifi.h b/software/include/wifi.h new file mode 100644 index 0000000..0d3896e --- /dev/null +++ b/software/include/wifi.h @@ -0,0 +1,29 @@ +#include <string.h> +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/event_groups.h" +#include "esp_system.h" +#include "esp_wifi.h" +#include "esp_event.h" +#include "esp_log.h" +#include "nvs_flash.h" + +#include "lwip/err.h" +#include "lwip/sys.h" + +#define ESP_WIFI_SSID "BELL83" +#define ESP_WIFI_PASS "83castleton@" +#define ESP_MAXIMUM_RETRY 100 + +#define WIFI_CONNECTED_BIT BIT0 +#define WIFI_FAIL_BIT BIT1 + +static const char *WIFI_TAG = "WIFI"; + +EventGroupHandle_t s_wifi_event_group; + +static int s_retry_num = 0; + +void event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data); + +void wifi_init_sta(void);
\ No newline at end of file |