add gpio and finalisation of pinning
This commit is contained in:
@@ -42,7 +42,7 @@ void app_main(void);
|
||||
/** Event handler for IP_EVENT_ETH_GOT_IP */
|
||||
static void got_ip_event_handler(void *arg, esp_event_base_t event_base,
|
||||
int32_t event_id, void *event_data)
|
||||
{
|
||||
{
|
||||
ip_event_got_ip_t *event = (ip_event_got_ip_t *) event_data;
|
||||
const esp_netif_ip_info_t *ip_info = &event->ip_info;
|
||||
|
||||
@@ -57,7 +57,7 @@ static void got_ip_event_handler(void *arg, esp_event_base_t event_base,
|
||||
// Event handler for Ethernet
|
||||
static void eth_event_handler(void *arg, esp_event_base_t event_base,
|
||||
int32_t event_id, void *event_data)
|
||||
{
|
||||
{
|
||||
uint8_t mac_addr[6] = {0};
|
||||
switch (event_id) {
|
||||
case ETHERNET_EVENT_CONNECTED:
|
||||
@@ -158,6 +158,26 @@ void MovementTask() {
|
||||
}
|
||||
}
|
||||
|
||||
void IoTest()
|
||||
{
|
||||
ESP_LOGI(TAG, "Start IO");
|
||||
InputPort in1(GPIO_NUM_33);
|
||||
InputPort in2(GPIO_NUM_32);
|
||||
InputPort mFault(GPIO_NUM_35);
|
||||
|
||||
OutputPort nEnable(GPIO_NUM_2);
|
||||
OutputPort nReset(GPIO_NUM_5);
|
||||
|
||||
while (true) {
|
||||
ESP_LOGI("Light", "InValues %i %i %i", in1.read(), in2.read(), mFault.read());
|
||||
nEnable.write(true);
|
||||
nReset.write(true);
|
||||
fos::Task::delayMs(500);
|
||||
nEnable.write(false);
|
||||
nReset.write(false);
|
||||
fos::Task::delayMs(500);
|
||||
}
|
||||
}
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
@@ -171,4 +191,5 @@ void app_main(void)
|
||||
initialize_ethernet();
|
||||
static fos::Task lightingTask(LightingTask, "Lights", 0x4000uL);
|
||||
static fos::Task movementTask(MovementTask, "Motor", 0x4000uL);
|
||||
static fos::Task ioTask(IoTest, "IO", 0x4000uL);
|
||||
}
|
||||
Reference in New Issue
Block a user