commit
9dd7bdeb4a
12 changed files with 16579 additions and 0 deletions
@ -0,0 +1,8 @@ |
|||||
|
# For more information about build system see |
||||
|
# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html |
||||
|
# The following five lines of boilerplate have to be in your project's |
||||
|
# CMakeLists in this exact order for cmake to work correctly |
||||
|
cmake_minimum_required(VERSION 3.16) |
||||
|
set(EXTRA_COMPONENT_DIRS /home/luis/esp/esp-idf-lib/components) |
||||
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake) |
||||
|
project(PAS) |
||||
@ -0,0 +1,209 @@ |
|||||
|
#ifndef CIRCULOS_H |
||||
|
#define CIRCULOS_H |
||||
|
|
||||
|
#include <stdio.h> |
||||
|
uint32_t CA[] = |
||||
|
{ |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000666, 0x66600000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x06666666, 0x66666660, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000066, 0x66666666, 0x66666666, 0x66000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00006666, 0x66666666, 0x66666666, 0x66660000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00666666, 0x66666666, 0x66666666, 0x66666600, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x06666666, 0x66666666, 0x66666666, 0x66666660, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000006, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x60000000, 0x00000000, |
||||
|
0x00000000, 0x00000066, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66000000, 0x00000000, |
||||
|
0x00000000, 0x00000666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66600000, 0x00000000, |
||||
|
0x00000000, 0x00006666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66660000, 0x00000000, |
||||
|
0x00000000, 0x00066666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666000, 0x00000000, |
||||
|
0x00000000, 0x00666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666600, 0x00000000, |
||||
|
0x00000000, 0x06666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666660, 0x00000000, |
||||
|
0x00000000, 0x06666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666660, 0x00000000, |
||||
|
0x00000000, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x00000000, |
||||
|
0x00000006, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x60000000, |
||||
|
0x00000006, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x60000000, |
||||
|
0x00000066, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66000000, |
||||
|
0x00000066, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66000000, |
||||
|
0x00000666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66600000, |
||||
|
0x00000666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66600000, |
||||
|
0x00000666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66600000, |
||||
|
0x00006666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66660000, |
||||
|
0x00006666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66660000, |
||||
|
0x00006666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66660000, |
||||
|
0x00006666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66660000, |
||||
|
0x00066666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666000, |
||||
|
0x00066666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666000, |
||||
|
0x00066666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666000, |
||||
|
0x00066666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666000, |
||||
|
0x00066666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666000, |
||||
|
0x00066666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666000, |
||||
|
0x00006666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66660000, |
||||
|
0x00006666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66660000, |
||||
|
0x00006666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66660000, |
||||
|
0x00006666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66660000, |
||||
|
0x00000666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66600000, |
||||
|
0x00000666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66600000, |
||||
|
0x00000666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66600000, |
||||
|
0x00000066, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66000000, |
||||
|
0x00000066, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66000000, |
||||
|
0x00000006, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x60000000, |
||||
|
0x00000006, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x60000000, |
||||
|
0x00000000, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x00000000, |
||||
|
0x00000000, 0x06666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666660, 0x00000000, |
||||
|
0x00000000, 0x06666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666660, 0x00000000, |
||||
|
0x00000000, 0x00666666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666600, 0x00000000, |
||||
|
0x00000000, 0x00066666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66666000, 0x00000000, |
||||
|
0x00000000, 0x00006666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66660000, 0x00000000, |
||||
|
0x00000000, 0x00000666, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66600000, 0x00000000, |
||||
|
0x00000000, 0x00000066, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x66000000, 0x00000000, |
||||
|
0x00000000, 0x00000006, 0x66666666, 0x66666666, 0x66666666, 0x66666666, 0x60000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x06666666, 0x66666666, 0x66666666, 0x66666660, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00666666, 0x66666666, 0x66666666, 0x66666600, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00006666, 0x66666666, 0x66666666, 0x66660000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000066, 0x66666666, 0x66666666, 0x66000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x06666666, 0x66666660, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000666, 0x66600000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
}; |
||||
|
|
||||
|
uint32_t CR[] = |
||||
|
{ |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000444, 0x44400000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x04444444, 0x44444440, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000044, 0x44444444, 0x44444444, 0x44000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00004444, 0x44444444, 0x44444444, 0x44440000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00444444, 0x44444444, 0x44444444, 0x44444400, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x04444444, 0x44444444, 0x44444444, 0x44444440, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000004, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x40000000, 0x00000000, |
||||
|
0x00000000, 0x00000044, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44000000, 0x00000000, |
||||
|
0x00000000, 0x00000444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44400000, 0x00000000, |
||||
|
0x00000000, 0x00004444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44440000, 0x00000000, |
||||
|
0x00000000, 0x00044444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444000, 0x00000000, |
||||
|
0x00000000, 0x00444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444400, 0x00000000, |
||||
|
0x00000000, 0x04444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444440, 0x00000000, |
||||
|
0x00000000, 0x04444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444440, 0x00000000, |
||||
|
0x00000000, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x00000000, |
||||
|
0x00000004, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x40000000, |
||||
|
0x00000004, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x40000000, |
||||
|
0x00000044, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44000000, |
||||
|
0x00000044, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44000000, |
||||
|
0x00000444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44400000, |
||||
|
0x00000444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44400000, |
||||
|
0x00000444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44400000, |
||||
|
0x00004444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44440000, |
||||
|
0x00004444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44440000, |
||||
|
0x00004444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44440000, |
||||
|
0x00004444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44440000, |
||||
|
0x00044444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444000, |
||||
|
0x00044444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444000, |
||||
|
0x00044444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444000, |
||||
|
0x00044444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444000, |
||||
|
0x00044444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444000, |
||||
|
0x00044444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444000, |
||||
|
0x00004444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44440000, |
||||
|
0x00004444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44440000, |
||||
|
0x00004444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44440000, |
||||
|
0x00004444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44440000, |
||||
|
0x00000444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44400000, |
||||
|
0x00000444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44400000, |
||||
|
0x00000444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44400000, |
||||
|
0x00000044, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44000000, |
||||
|
0x00000044, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44000000, |
||||
|
0x00000004, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x40000000, |
||||
|
0x00000004, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x40000000, |
||||
|
0x00000000, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x00000000, |
||||
|
0x00000000, 0x04444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444440, 0x00000000, |
||||
|
0x00000000, 0x04444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444440, 0x00000000, |
||||
|
0x00000000, 0x00444444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444400, 0x00000000, |
||||
|
0x00000000, 0x00044444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44444000, 0x00000000, |
||||
|
0x00000000, 0x00004444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44440000, 0x00000000, |
||||
|
0x00000000, 0x00000444, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44400000, 0x00000000, |
||||
|
0x00000000, 0x00000044, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x44000000, 0x00000000, |
||||
|
0x00000000, 0x00000004, 0x44444444, 0x44444444, 0x44444444, 0x44444444, 0x40000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x04444444, 0x44444444, 0x44444444, 0x44444440, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00444444, 0x44444444, 0x44444444, 0x44444400, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00004444, 0x44444444, 0x44444444, 0x44440000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000044, 0x44444444, 0x44444444, 0x44000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x04444444, 0x44444440, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000444, 0x44400000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
}; |
||||
|
|
||||
|
uint32_t CV[] = |
||||
|
{ |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000222, 0x22200000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x02222222, 0x22222220, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000022, 0x22222222, 0x22222222, 0x22000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00002222, 0x22222222, 0x22222222, 0x22220000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00222222, 0x22222222, 0x22222222, 0x22222200, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x02222222, 0x22222222, 0x22222222, 0x22222220, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000002, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x20000000, 0x00000000, |
||||
|
0x00000000, 0x00000022, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22000000, 0x00000000, |
||||
|
0x00000000, 0x00000222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22200000, 0x00000000, |
||||
|
0x00000000, 0x00002222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22220000, 0x00000000, |
||||
|
0x00000000, 0x00022222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222000, 0x00000000, |
||||
|
0x00000000, 0x00222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222200, 0x00000000, |
||||
|
0x00000000, 0x02222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222220, 0x00000000, |
||||
|
0x00000000, 0x02222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222220, 0x00000000, |
||||
|
0x00000000, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x00000000, |
||||
|
0x00000002, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x20000000, |
||||
|
0x00000002, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x20000000, |
||||
|
0x00000022, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22000000, |
||||
|
0x00000022, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22000000, |
||||
|
0x00000222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22200000, |
||||
|
0x00000222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22200000, |
||||
|
0x00000222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22200000, |
||||
|
0x00002222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22220000, |
||||
|
0x00002222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22220000, |
||||
|
0x00002222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22220000, |
||||
|
0x00002222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22220000, |
||||
|
0x00022222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222000, |
||||
|
0x00022222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222000, |
||||
|
0x00022222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222000, |
||||
|
0x00022222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222000, |
||||
|
0x00022222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222000, |
||||
|
0x00022222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222000, |
||||
|
0x00002222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22220000, |
||||
|
0x00002222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22220000, |
||||
|
0x00002222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22220000, |
||||
|
0x00002222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22220000, |
||||
|
0x00000222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22200000, |
||||
|
0x00000222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22200000, |
||||
|
0x00000222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22200000, |
||||
|
0x00000022, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22000000, |
||||
|
0x00000022, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22000000, |
||||
|
0x00000002, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x20000000, |
||||
|
0x00000002, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x20000000, |
||||
|
0x00000000, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x00000000, |
||||
|
0x00000000, 0x02222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222220, 0x00000000, |
||||
|
0x00000000, 0x02222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222220, 0x00000000, |
||||
|
0x00000000, 0x00222222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222200, 0x00000000, |
||||
|
0x00000000, 0x00022222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22222000, 0x00000000, |
||||
|
0x00000000, 0x00002222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22220000, 0x00000000, |
||||
|
0x00000000, 0x00000222, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22200000, 0x00000000, |
||||
|
0x00000000, 0x00000022, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x22000000, 0x00000000, |
||||
|
0x00000000, 0x00000002, 0x22222222, 0x22222222, 0x22222222, 0x22222222, 0x20000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x02222222, 0x22222222, 0x22222222, 0x22222220, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00222222, 0x22222222, 0x22222222, 0x22222200, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00002222, 0x22222222, 0x22222222, 0x22220000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000022, 0x22222222, 0x22222222, 0x22000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x02222222, 0x22222220, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000222, 0x22200000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
||||
|
}; |
||||
|
|
||||
|
#endif |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,355 @@ |
|||||
|
#include <stdio.h> |
||||
|
#include <string.h> |
||||
|
#include "freertos/FreeRTOS.h" |
||||
|
#include "freertos/task.h" |
||||
|
#include "driver/gpio.h" |
||||
|
#include "soc/gpio_reg.h" |
||||
|
#include "rom/ets_sys.h" |
||||
|
|
||||
|
#include "Pines.h" |
||||
|
#include "HUB75.h" |
||||
|
|
||||
|
void HUB75_init(void) |
||||
|
{ |
||||
|
gpio_reset_pin(HUB75_OE_Pin); |
||||
|
gpio_reset_pin(HUB75_LATCH_Pin); |
||||
|
gpio_reset_pin(HUB75_ADDR_C_Pin); |
||||
|
gpio_reset_pin(HUB75_ADDR_B_Pin); |
||||
|
gpio_reset_pin(HUB75_ADDR_A_Pin); |
||||
|
gpio_reset_pin(HUB75_CLK_Pin); |
||||
|
gpio_reset_pin(HUB75_U_R1_Pin); |
||||
|
gpio_reset_pin(HUB75_U_G1_Pin); |
||||
|
gpio_reset_pin(HUB75_U_B1_Pin); |
||||
|
gpio_reset_pin(HUB75_U_R2_Pin); |
||||
|
gpio_reset_pin(HUB75_U_G2_Pin); |
||||
|
gpio_reset_pin(HUB75_U_B2_Pin); |
||||
|
gpio_reset_pin(HUB75_D_R1_Pin); |
||||
|
gpio_reset_pin(HUB75_D_G1_Pin); |
||||
|
gpio_reset_pin(HUB75_D_B1_Pin); |
||||
|
gpio_reset_pin(HUB75_D_R2_Pin); |
||||
|
gpio_reset_pin(HUB75_D_G2_Pin); |
||||
|
gpio_reset_pin(HUB75_D_B2_Pin); |
||||
|
|
||||
|
gpio_set_direction(HUB75_OE_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_LATCH_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_ADDR_C_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_ADDR_B_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_ADDR_A_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_CLK_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_U_R1_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_U_G1_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_U_B1_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_U_R2_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_U_G2_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_U_B2_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_D_R1_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_D_G1_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_D_B1_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_D_R2_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_D_G2_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
gpio_set_direction(HUB75_D_B2_Pin, GPIO_MODE_DEF_OUTPUT); |
||||
|
|
||||
|
gpio_set_level(HUB75_OE_Pin, 1); |
||||
|
gpio_set_level(HUB75_LATCH_Pin, 0); |
||||
|
gpio_set_level(HUB75_ADDR_A_Pin, 0); |
||||
|
gpio_set_level(HUB75_ADDR_B_Pin, 0); |
||||
|
gpio_set_level(HUB75_ADDR_C_Pin, 0); |
||||
|
gpio_set_level(HUB75_CLK_Pin, 0); |
||||
|
gpio_set_level(HUB75_U_R1_Pin, 0); |
||||
|
gpio_set_level(HUB75_U_G1_Pin, 0); |
||||
|
gpio_set_level(HUB75_U_B1_Pin, 0); |
||||
|
gpio_set_level(HUB75_U_R2_Pin, 0); |
||||
|
gpio_set_level(HUB75_U_G2_Pin, 0); |
||||
|
gpio_set_level(HUB75_U_B2_Pin, 0); |
||||
|
gpio_set_level(HUB75_D_R1_Pin, 0); |
||||
|
gpio_set_level(HUB75_D_G1_Pin, 0); |
||||
|
gpio_set_level(HUB75_D_B1_Pin, 0); |
||||
|
gpio_set_level(HUB75_D_R2_Pin, 0); |
||||
|
gpio_set_level(HUB75_D_G2_Pin, 0); |
||||
|
gpio_set_level(HUB75_D_B2_Pin, 0); |
||||
|
} |
||||
|
|
||||
|
uint16_t NVT[] = |
||||
|
{ |
||||
|
192, 193, 194, 195, 0, 1, 2, 3, 196, 197, 198, 199, 4, 5, 6, 7, 200, 201, 202, 203, 8, 9, 10, 11, |
||||
|
204, 205, 206, 207, 12, 13, 14, 15, 208, 209, 210, 211, 16, 17, 18, 19, 212, 213, 214, 215, 20, 21, 22, 23, |
||||
|
216, 217, 218, 219, 24, 25, 26, 27, 220, 221, 222, 223, 28, 29, 30, 31, 224, 225, 226, 227, 32, 33, 34, 35, |
||||
|
228, 229, 230, 231, 36, 37, 38, 39, 232, 233, 234, 235, 40, 41, 42, 43, 236, 237, 238, 239, 44, 45, 46, 47, |
||||
|
240, 241, 242, 243, 48, 49, 50, 51, 244, 245, 246, 247, 52, 53, 54, 55, 248, 249, 250, 251, 56, 57, 58, 59, |
||||
|
252, 253, 254, 255, 60, 61, 62, 63, 256, 257, 258, 259, 64, 65, 66, 67, 260, 261, 262, 263, 68, 69, 70, 71, |
||||
|
264, 265, 266, 267, 72, 73, 74, 75, 268, 269, 270, 271, 76, 77, 78, 79, 272, 273, 274, 275, 80, 81, 82, 83, |
||||
|
276, 277, 278, 279, 84, 85, 86, 87, 280, 281, 282, 283, 88, 89, 90, 91, 284, 285, 286, 287, 92, 93, 94, 95, |
||||
|
288, 289, 290, 291, 96, 97, 98, 99, 292, 293, 294, 295, 100, 101, 102, 103, 296, 297, 298, 299, 104, 105, 106, 107, |
||||
|
300, 301, 302, 303, 108, 109, 110, 111, 304, 305, 306, 307, 112, 113, 114, 115, 308, 309, 310, 311, 116, 117, 118, 119, |
||||
|
312, 313, 314, 315, 120, 121, 122, 123, 316, 317, 318, 319, 124, 125, 126, 127, 320, 321, 322, 323, 128, 129, 130, 131, |
||||
|
324, 325, 326, 327, 132, 133, 134, 135, 328, 329, 330, 331, 136, 137, 138, 139, 332, 333, 334, 335, 140, 141, 142, 143, |
||||
|
336, 337, 338, 339, 144, 145, 146, 147, 340, 341, 342, 343, 148, 149, 150, 151, 344, 345, 346, 347, 152, 153, 154, 155, |
||||
|
348, 349, 350, 351, 156, 157, 158, 159, 352, 353, 354, 355, 160, 161, 162, 163, 356, 357, 358, 359, 164, 165, 166, 167, |
||||
|
360, 361, 362, 363, 168, 169, 170, 171, 364, 365, 366, 367, 172, 173, 174, 175, 368, 369, 370, 371, 176, 177, 178, 179, |
||||
|
372, 373, 374, 375, 180, 181, 182, 183, 376, 377, 378, 379, 184, 185, 186, 187, 380, 381, 382, 383, 188, 189, 190, 191, |
||||
|
576, 577, 578, 579, 384, 385, 386, 387, 580, 581, 582, 583, 388, 389, 390, 391, 584, 585, 586, 587, 392, 393, 394, 395, |
||||
|
588, 589, 590, 591, 396, 397, 398, 399, 592, 593, 594, 595, 400, 401, 402, 403, 596, 597, 598, 599, 404, 405, 406, 407, |
||||
|
600, 601, 602, 603, 408, 409, 410, 411, 604, 605, 606, 607, 412, 413, 414, 415, 608, 609, 610, 611, 416, 417, 418, 419, |
||||
|
612, 613, 614, 615, 420, 421, 422, 423, 616, 617, 618, 619, 424, 425, 426, 427, 620, 621, 622, 623, 428, 429, 430, 431, |
||||
|
624, 625, 626, 627, 432, 433, 434, 435, 628, 629, 630, 631, 436, 437, 438, 439, 632, 633, 634, 635, 440, 441, 442, 443, |
||||
|
636, 637, 638, 639, 444, 445, 446, 447, 640, 641, 642, 643, 448, 449, 450, 451, 644, 645, 646, 647, 452, 453, 454, 455, |
||||
|
648, 649, 650, 651, 456, 457, 458, 459, 652, 653, 654, 655, 460, 461, 462, 463, 656, 657, 658, 659, 464, 465, 466, 467, |
||||
|
660, 661, 662, 663, 468, 469, 470, 471, 664, 665, 666, 667, 472, 473, 474, 475, 668, 669, 670, 671, 476, 477, 478, 479, |
||||
|
672, 673, 674, 675, 480, 481, 482, 483, 676, 677, 678, 679, 484, 485, 486, 487, 680, 681, 682, 683, 488, 489, 490, 491, |
||||
|
684, 685, 686, 687, 492, 493, 494, 495, 688, 689, 690, 691, 496, 497, 498, 499, 692, 693, 694, 695, 500, 501, 502, 503, |
||||
|
696, 697, 698, 699, 504, 505, 506, 507, 700, 701, 702, 703, 508, 509, 510, 511, 704, 705, 706, 707, 512, 513, 514, 515, |
||||
|
708, 709, 710, 711, 516, 517, 518, 519, 712, 713, 714, 715, 520, 521, 522, 523, 716, 717, 718, 719, 524, 525, 526, 527, |
||||
|
720, 721, 722, 723, 528, 529, 530, 531, 724, 725, 726, 727, 532, 533, 534, 535, 728, 729, 730, 731, 536, 537, 538, 539, |
||||
|
732, 733, 734, 735, 540, 541, 542, 543, 736, 737, 738, 739, 544, 545, 546, 547, 740, 741, 742, 743, 548, 549, 550, 551, |
||||
|
744, 745, 746, 747, 552, 553, 554, 555, 748, 749, 750, 751, 556, 557, 558, 559, 752, 753, 754, 755, 560, 561, 562, 563, |
||||
|
756, 757, 758, 759, 564, 565, 566, 567, 760, 761, 762, 763, 568, 569, 570, 571, 764, 765, 766, 767, 572, 573, 574, 575, |
||||
|
960, 961, 962, 963, 768, 769, 770, 771, 964, 965, 966, 967, 772, 773, 774, 775, 968, 969, 970, 971, 776, 777, 778, 779, |
||||
|
972, 973, 974, 975, 780, 781, 782, 783, 976, 977, 978, 979, 784, 785, 786, 787, 980, 981, 982, 983, 788, 789, 790, 791, |
||||
|
984, 985, 986, 987, 792, 793, 794, 795, 988, 989, 990, 991, 796, 797, 798, 799, 992, 993, 994, 995, 800, 801, 802, 803, |
||||
|
996, 997, 998, 999, 804, 805, 806, 807, 1000, 1001, 1002, 1003, 808, 809, 810, 811, 1004, 1005, 1006, 1007, 812, 813, 814, 815, |
||||
|
1008, 1009, 1010, 1011, 816, 817, 818, 819, 1012, 1013, 1014, 1015, 820, 821, 822, 823, 1016, 1017, 1018, 1019, 824, 825, 826, 827, |
||||
|
1020, 1021, 1022, 1023, 828, 829, 830, 831, 1024, 1025, 1026, 1027, 832, 833, 834, 835, 1028, 1029, 1030, 1031, 836, 837, 838, 839, |
||||
|
1032, 1033, 1034, 1035, 840, 841, 842, 843, 1036, 1037, 1038, 1039, 844, 845, 846, 847, 1040, 1041, 1042, 1043, 848, 849, 850, 851, |
||||
|
1044, 1045, 1046, 1047, 852, 853, 854, 855, 1048, 1049, 1050, 1051, 856, 857, 858, 859, 1052, 1053, 1054, 1055, 860, 861, 862, 863, |
||||
|
1056, 1057, 1058, 1059, 864, 865, 866, 867, 1060, 1061, 1062, 1063, 868, 869, 870, 871, 1064, 1065, 1066, 1067, 872, 873, 874, 875, |
||||
|
1068, 1069, 1070, 1071, 876, 877, 878, 879, 1072, 1073, 1074, 1075, 880, 881, 882, 883, 1076, 1077, 1078, 1079, 884, 885, 886, 887, |
||||
|
1080, 1081, 1082, 1083, 888, 889, 890, 891, 1084, 1085, 1086, 1087, 892, 893, 894, 895, 1088, 1089, 1090, 1091, 896, 897, 898, 899, |
||||
|
1092, 1093, 1094, 1095, 900, 901, 902, 903, 1096, 1097, 1098, 1099, 904, 905, 906, 907, 1100, 1101, 1102, 1103, 908, 909, 910, 911, |
||||
|
1104, 1105, 1106, 1107, 912, 913, 914, 915, 1108, 1109, 1110, 1111, 916, 917, 918, 919, 1112, 1113, 1114, 1115, 920, 921, 922, 923, |
||||
|
1116, 1117, 1118, 1119, 924, 925, 926, 927, 1120, 1121, 1122, 1123, 928, 929, 930, 931, 1124, 1125, 1126, 1127, 932, 933, 934, 935, |
||||
|
1128, 1129, 1130, 1131, 936, 937, 938, 939, 1132, 1133, 1134, 1135, 940, 941, 942, 943, 1136, 1137, 1138, 1139, 944, 945, 946, 947, |
||||
|
1140, 1141, 1142, 1143, 948, 949, 950, 951, 1144, 1145, 1146, 1147, 952, 953, 954, 955, 1148, 1149, 1150, 1151, 956, 957, 958, 959, |
||||
|
1344, 1345, 1346, 1347, 1152, 1153, 1154, 1155, 1348, 1349, 1350, 1351, 1156, 1157, 1158, 1159, 1352, 1353, 1354, 1355, 1160, 1161, 1162, 1163, |
||||
|
1356, 1357, 1358, 1359, 1164, 1165, 1166, 1167, 1360, 1361, 1362, 1363, 1168, 1169, 1170, 1171, 1364, 1365, 1366, 1367, 1172, 1173, 1174, 1175, |
||||
|
1368, 1369, 1370, 1371, 1176, 1177, 1178, 1179, 1372, 1373, 1374, 1375, 1180, 1181, 1182, 1183, 1376, 1377, 1378, 1379, 1184, 1185, 1186, 1187, |
||||
|
1380, 1381, 1382, 1383, 1188, 1189, 1190, 1191, 1384, 1385, 1386, 1387, 1192, 1193, 1194, 1195, 1388, 1389, 1390, 1391, 1196, 1197, 1198, 1199, |
||||
|
1392, 1393, 1394, 1395, 1200, 1201, 1202, 1203, 1396, 1397, 1398, 1399, 1204, 1205, 1206, 1207, 1400, 1401, 1402, 1403, 1208, 1209, 1210, 1211, |
||||
|
1404, 1405, 1406, 1407, 1212, 1213, 1214, 1215, 1408, 1409, 1410, 1411, 1216, 1217, 1218, 1219, 1412, 1413, 1414, 1415, 1220, 1221, 1222, 1223, |
||||
|
1416, 1417, 1418, 1419, 1224, 1225, 1226, 1227, 1420, 1421, 1422, 1423, 1228, 1229, 1230, 1231, 1424, 1425, 1426, 1427, 1232, 1233, 1234, 1235, |
||||
|
1428, 1429, 1430, 1431, 1236, 1237, 1238, 1239, 1432, 1433, 1434, 1435, 1240, 1241, 1242, 1243, 1436, 1437, 1438, 1439, 1244, 1245, 1246, 1247, |
||||
|
1440, 1441, 1442, 1443, 1248, 1249, 1250, 1251, 1444, 1445, 1446, 1447, 1252, 1253, 1254, 1255, 1448, 1449, 1450, 1451, 1256, 1257, 1258, 1259, |
||||
|
1452, 1453, 1454, 1455, 1260, 1261, 1262, 1263, 1456, 1457, 1458, 1459, 1264, 1265, 1266, 1267, 1460, 1461, 1462, 1463, 1268, 1269, 1270, 1271, |
||||
|
1464, 1465, 1466, 1467, 1272, 1273, 1274, 1275, 1468, 1469, 1470, 1471, 1276, 1277, 1278, 1279, 1472, 1473, 1474, 1475, 1280, 1281, 1282, 1283, |
||||
|
1476, 1477, 1478, 1479, 1284, 1285, 1286, 1287, 1480, 1481, 1482, 1483, 1288, 1289, 1290, 1291, 1484, 1485, 1486, 1487, 1292, 1293, 1294, 1295, |
||||
|
1488, 1489, 1490, 1491, 1296, 1297, 1298, 1299, 1492, 1493, 1494, 1495, 1300, 1301, 1302, 1303, 1496, 1497, 1498, 1499, 1304, 1305, 1306, 1307, |
||||
|
1500, 1501, 1502, 1503, 1308, 1309, 1310, 1311, 1504, 1505, 1506, 1507, 1312, 1313, 1314, 1315, 1508, 1509, 1510, 1511, 1316, 1317, 1318, 1319, |
||||
|
1512, 1513, 1514, 1515, 1320, 1321, 1322, 1323, 1516, 1517, 1518, 1519, 1324, 1325, 1326, 1327, 1520, 1521, 1522, 1523, 1328, 1329, 1330, 1331, |
||||
|
1524, 1525, 1526, 1527, 1332, 1333, 1334, 1335, 1528, 1529, 1530, 1531, 1336, 1337, 1338, 1339, 1532, 1533, 1534, 1535, 1340, 1341, 1342, 1343 |
||||
|
}; |
||||
|
|
||||
|
uint32_t vm[24] = { |
||||
|
0x40000000, |
||||
|
0x20000000, |
||||
|
0x10000000, |
||||
|
0x04000000, |
||||
|
0x02000000, |
||||
|
0x01000000, |
||||
|
0x00400000, |
||||
|
0x00200000, |
||||
|
0x00100000, |
||||
|
0x00040000, |
||||
|
0x00020000, |
||||
|
0x00010000, |
||||
|
0x00004000, |
||||
|
0x00002000, |
||||
|
0x00001000, |
||||
|
0x00000400, |
||||
|
0x00000200, |
||||
|
0x00000100, |
||||
|
0x00000040, |
||||
|
0x00000020, |
||||
|
0x00000010, |
||||
|
0x00000004, |
||||
|
0x00000002, |
||||
|
0x00000001, |
||||
|
}; |
||||
|
|
||||
|
void HUB75_displayBuffer_Color64(uint32_t *G, uint8_t at) |
||||
|
{ |
||||
|
uint32_t AA, BB, CC, DD; |
||||
|
|
||||
|
uint8_t nnv = 7; |
||||
|
|
||||
|
if(at > 45) at = 40; |
||||
|
|
||||
|
for(uint8_t nv = 0; nv < 8; nv++) |
||||
|
{ |
||||
|
switch(nnv) |
||||
|
{ |
||||
|
case 0: |
||||
|
gpio_set_level(HUB75_ADDR_A_Pin, 0); |
||||
|
gpio_set_level(HUB75_ADDR_B_Pin, 0); |
||||
|
gpio_set_level(HUB75_ADDR_C_Pin, 0); |
||||
|
break; |
||||
|
case 1: |
||||
|
gpio_set_level(HUB75_ADDR_A_Pin, 1); |
||||
|
gpio_set_level(HUB75_ADDR_B_Pin, 0); |
||||
|
gpio_set_level(HUB75_ADDR_C_Pin, 0); |
||||
|
break; |
||||
|
case 2: |
||||
|
gpio_set_level(HUB75_ADDR_A_Pin, 0); |
||||
|
gpio_set_level(HUB75_ADDR_B_Pin, 1); |
||||
|
gpio_set_level(HUB75_ADDR_C_Pin, 0); |
||||
|
break; |
||||
|
case 3: |
||||
|
gpio_set_level(HUB75_ADDR_A_Pin, 1); |
||||
|
gpio_set_level(HUB75_ADDR_B_Pin, 1); |
||||
|
gpio_set_level(HUB75_ADDR_C_Pin, 0); |
||||
|
break; |
||||
|
case 4: |
||||
|
gpio_set_level(HUB75_ADDR_A_Pin, 0); |
||||
|
gpio_set_level(HUB75_ADDR_B_Pin, 0); |
||||
|
gpio_set_level(HUB75_ADDR_C_Pin, 1); |
||||
|
break; |
||||
|
case 5: |
||||
|
gpio_set_level(HUB75_ADDR_A_Pin, 1); |
||||
|
gpio_set_level(HUB75_ADDR_B_Pin, 0); |
||||
|
gpio_set_level(HUB75_ADDR_C_Pin, 1); |
||||
|
break; |
||||
|
case 6: |
||||
|
gpio_set_level(HUB75_ADDR_A_Pin, 0); |
||||
|
gpio_set_level(HUB75_ADDR_B_Pin, 1); |
||||
|
gpio_set_level(HUB75_ADDR_C_Pin, 1); |
||||
|
break; |
||||
|
case 7: |
||||
|
gpio_set_level(HUB75_ADDR_A_Pin, 1); |
||||
|
gpio_set_level(HUB75_ADDR_B_Pin, 1); |
||||
|
gpio_set_level(HUB75_ADDR_C_Pin, 1); |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
if(nnv == 7) |
||||
|
nnv = 0; |
||||
|
else |
||||
|
nnv++; |
||||
|
|
||||
|
for(uint8_t p = 0; p < 48; p++) |
||||
|
{ |
||||
|
if(p == 10) gpio_set_level(HUB75_OE_Pin, 0); |
||||
|
if(p == at) gpio_set_level(HUB75_OE_Pin, 1); // 40 alto brillo // 30 bajo brillo
|
||||
|
|
||||
|
AA = G[NVT[p + 0 + nnv * 48]]; |
||||
|
BB = G[NVT[p + 384 + nnv * 48]]; |
||||
|
CC = G[NVT[p + 768 + nnv * 48]]; |
||||
|
DD = G[NVT[p + 1152 + nnv * 48]]; |
||||
|
|
||||
|
for(int8_t k = 0; k < 8; k++) |
||||
|
{ |
||||
|
uint32_t S1 = 0, R1 = 0; |
||||
|
uint8_t S2 = 0, R2 = 0; |
||||
|
|
||||
|
//#define HUB75_U_R1_Pin 21
|
||||
|
//#define HUB75_U_G1_Pin 22
|
||||
|
//#define HUB75_U_B1_Pin 19
|
||||
|
|
||||
|
if(AA & vm[k*3 + 0]) |
||||
|
// 33322222222221111111111000000000
|
||||
|
// 21098765432109876543210987654321
|
||||
|
S1 |= 0b00000000001000000000000000000000; |
||||
|
else |
||||
|
R1 |= 0b00000000001000000000000000000000; |
||||
|
|
||||
|
if(AA & vm[k*3 + 1]) |
||||
|
// 33322222222221111111111000000000
|
||||
|
// 21098765432109876543210987654321
|
||||
|
S1 |= 0b00000000010000000000000000000000; |
||||
|
else |
||||
|
R1 |= 0b00000000010000000000000000000000; |
||||
|
|
||||
|
if(AA & vm[k*3 + 2]) |
||||
|
// 33322222222221111111111000000000
|
||||
|
// 21098765432109876543210987654321
|
||||
|
S1 |= 0b00000000000010000000000000000000; |
||||
|
else |
||||
|
R1 |= 0b00000000000010000000000000000000; |
||||
|
|
||||
|
//#define HUB75_U_R2_Pin 18
|
||||
|
//#define HUB75_U_G2_Pin 23
|
||||
|
//#define HUB75_U_B2_Pin 5
|
||||
|
|
||||
|
if(BB & vm[k*3 + 0]) |
||||
|
// 33322222222221111111111000000000
|
||||
|
// 21098765432109876543210987654321
|
||||
|
S1 |= 0b00000000000001000000000000000000; |
||||
|
else |
||||
|
R1 |= 0b00000000000001000000000000000000; |
||||
|
|
||||
|
if(BB & vm[k*3 + 1]) |
||||
|
// 33322222222221111111111000000000
|
||||
|
// 21098765432109876543210987654321
|
||||
|
S1 |= 0b00000000100000000000000000000000; |
||||
|
else |
||||
|
R1 |= 0b00000000100000000000000000000000; |
||||
|
|
||||
|
if(BB & vm[k*3 + 2]) |
||||
|
// 33322222222221111111111000000000
|
||||
|
// 21098765432109876543210987654321
|
||||
|
S1 |= 0b00000000000000000000000000100000; |
||||
|
else |
||||
|
R1 |= 0b00000000000000000000000000100000; |
||||
|
|
||||
|
|
||||
|
//#define HUB75_D_R1_Pin 26
|
||||
|
//#define HUB75_D_G1_Pin 27
|
||||
|
//#define HUB75_D_B1_Pin 25
|
||||
|
|
||||
|
if(CC & vm[k*3 + 0]) |
||||
|
// 33322222222221111111111000000000
|
||||
|
// 21098765432109876543210987654321
|
||||
|
S1 |= 0b00000100000000000000000000000000; |
||||
|
else |
||||
|
R1 |= 0b00000100000000000000000000000000; |
||||
|
|
||||
|
if(CC & vm[k*3 + 1]) |
||||
|
// 33322222222221111111111000000000
|
||||
|
// 21098765432109876543210987654321
|
||||
|
S1 |= 0b00001000000000000000000000000000; |
||||
|
else |
||||
|
R1 |= 0b00001000000000000000000000000000; |
||||
|
|
||||
|
if(CC & vm[k*3 + 2]) |
||||
|
// 33322222222221111111111000000000
|
||||
|
// 21098765432109876543210987654321
|
||||
|
S1 |= 0b00000010000000000000000000000000; |
||||
|
else |
||||
|
R1 |= 0b00000010000000000000000000000000; |
||||
|
|
||||
|
//#define HUB75_D_R2_Pin 33
|
||||
|
//#define HUB75_D_G2_Pin 14
|
||||
|
//#define HUB75_D_B2_Pin 32
|
||||
|
|
||||
|
if(DD & vm[k*3 + 0]) |
||||
|
// 33333333
|
||||
|
// 98723532
|
||||
|
S2 |= 0b00000010; |
||||
|
else |
||||
|
R2 |= 0b00000010; |
||||
|
|
||||
|
if(DD & vm[k*3 + 1]) |
||||
|
// 33322222222221111111111000000000
|
||||
|
// 21098765432109876543210987654321
|
||||
|
S1 |= 0b00000000000000000100000000000000; |
||||
|
else |
||||
|
R1 |= 0b00000000000000000100000000000000; |
||||
|
|
||||
|
if(DD & vm[k*3 + 2]) |
||||
|
// 33333333
|
||||
|
// 98723532
|
||||
|
S2 |= 0b00000001; |
||||
|
else |
||||
|
R2 |= 0b00000001; |
||||
|
|
||||
|
REG_WRITE(GPIO_OUT_W1TS_REG, S1); |
||||
|
REG_WRITE(GPIO_OUT_W1TC_REG, R1); |
||||
|
|
||||
|
REG_WRITE(GPIO_OUT1_W1TS_REG, S2); |
||||
|
REG_WRITE(GPIO_OUT1_W1TC_REG, R2); |
||||
|
|
||||
|
gpio_set_level(HUB75_CLK_Pin, 1); |
||||
|
gpio_set_level(HUB75_CLK_Pin, 0); |
||||
|
} |
||||
|
} |
||||
|
gpio_set_level(HUB75_LATCH_Pin, 1); |
||||
|
gpio_set_level(HUB75_LATCH_Pin, 0); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
#ifndef HUB75_H |
||||
|
#define HUB75_H |
||||
|
|
||||
|
#include <stdint.h> |
||||
|
|
||||
|
void HUB75_init(void); |
||||
|
void HUB75_displayBuffer_Color64(uint32_t *, uint8_t); |
||||
|
|
||||
|
#endif |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,64 @@ |
|||||
|
#ifndef PINES_H |
||||
|
#define PINES_H |
||||
|
|
||||
|
// Entradas
|
||||
|
#define ENT_VER 36 |
||||
|
#define ENT_AMA 39 |
||||
|
#define ENT_SOL 34 |
||||
|
|
||||
|
// Sensor Temperatura DS18S20
|
||||
|
#define DS_PIN 2 |
||||
|
|
||||
|
// GPS
|
||||
|
#define PIN_TXD 15 |
||||
|
#define PIN_RXD 35 |
||||
|
|
||||
|
// Version ESP32 con DevKIT
|
||||
|
// Comunes:
|
||||
|
#define HUB75_LATCH_Pin 13 |
||||
|
#define HUB75_ADDR_C_Pin 16 |
||||
|
#define HUB75_ADDR_B_Pin 12 |
||||
|
#define HUB75_ADDR_A_Pin 17 |
||||
|
#define HUB75_CLK_Pin 4 |
||||
|
#define HUB75_OE_Pin 0 |
||||
|
// Panel Superior:
|
||||
|
#define HUB75_U_R1_Pin 21 |
||||
|
#define HUB75_U_G1_Pin 22 |
||||
|
#define HUB75_U_B1_Pin 19 |
||||
|
#define HUB75_U_R2_Pin 18 |
||||
|
#define HUB75_U_G2_Pin 23 |
||||
|
#define HUB75_U_B2_Pin 5 |
||||
|
// Panel Inferior:
|
||||
|
#define HUB75_D_R1_Pin 26 |
||||
|
#define HUB75_D_G1_Pin 27 |
||||
|
#define HUB75_D_B1_Pin 25 |
||||
|
#define HUB75_D_R2_Pin 33 |
||||
|
#define HUB75_D_G2_Pin 14 |
||||
|
#define HUB75_D_B2_Pin 32 |
||||
|
|
||||
|
/*
|
||||
|
// Version ESP32 Solo
|
||||
|
// Comunes:
|
||||
|
#define HUB75_LATCH_Pin 26 |
||||
|
#define HUB75_ADDR_C_Pin 25 |
||||
|
#define HUB75_ADDR_B_Pin 17 |
||||
|
#define HUB75_ADDR_A_Pin 4 |
||||
|
#define HUB75_CLK_Pin 27 |
||||
|
#define HUB75_OE_Pin 16 |
||||
|
// Panel Superior:
|
||||
|
#define HUB75_U_R1_Pin 19 |
||||
|
#define HUB75_U_G1_Pin 18 |
||||
|
#define HUB75_U_B1_Pin 21 |
||||
|
#define HUB75_U_R2_Pin 22 |
||||
|
#define HUB75_U_G2_Pin 5 |
||||
|
#define HUB75_U_B2_Pin 23 |
||||
|
// Panel Inferior:
|
||||
|
#define HUB75_D_R1_Pin 13 |
||||
|
#define HUB75_D_G1_Pin 12 |
||||
|
#define HUB75_D_B1_Pin 15 |
||||
|
#define HUB75_D_R2_Pin 2 |
||||
|
#define HUB75_D_G2_Pin 14 |
||||
|
#define HUB75_D_B2_Pin 0 |
||||
|
*/ |
||||
|
|
||||
|
#endif |
||||
@ -0,0 +1,29 @@ |
|||||
|
#ifndef DEFINES_H |
||||
|
#define DEFINES_H |
||||
|
|
||||
|
#define AAA 1 |
||||
|
#define DDD 2 |
||||
|
#define III 3 |
||||
|
|
||||
|
#define ADD 4 |
||||
|
#define AAD 5 |
||||
|
#define IAA 6 |
||||
|
#define IIA 7 |
||||
|
#define IDD 8 |
||||
|
#define IID 9 |
||||
|
|
||||
|
#define IAD 10 |
||||
|
|
||||
|
#define SOL 20 |
||||
|
|
||||
|
#define NADD 21 // 4
|
||||
|
#define AAND 22 // 5
|
||||
|
#define NIAA 23 // 6
|
||||
|
#define IINA 24 // 7
|
||||
|
#define NIDD 25 // 8
|
||||
|
#define IIND 26 // 9
|
||||
|
|
||||
|
#define IAND 27 // 10
|
||||
|
#define NIAD 28 // 10
|
||||
|
|
||||
|
#endif |
||||
@ -0,0 +1,968 @@ |
|||||
|
#include <stdio.h> |
||||
|
#include <string.h> |
||||
|
|
||||
|
#include "freertos/FreeRTOS.h" |
||||
|
#include "freertos/task.h" |
||||
|
#include "driver/gpio.h" |
||||
|
|
||||
|
#include "esp_log.h" |
||||
|
#include "esp_timer.h" |
||||
|
#include "freertos/timers.h" |
||||
|
|
||||
|
#include "freertos/queue.h" |
||||
|
#include "driver/uart.h" |
||||
|
|
||||
|
#include "HUB75.h" |
||||
|
#include "Numeros.h" |
||||
|
#include "FlechasV.h" |
||||
|
#include "FlechasA.h" |
||||
|
#include "FlechasR.h" |
||||
|
#include "Peaton.h" |
||||
|
#include "Circulos.h" |
||||
|
|
||||
|
#include "Pines.h" |
||||
|
|
||||
|
#include "ds18x20.h" |
||||
|
|
||||
|
const char *TAG = "PAS"; |
||||
|
|
||||
|
#define EDO_AMA 1 |
||||
|
#define EDO_VER 2 |
||||
|
#define EDO_ROJ 3 |
||||
|
|
||||
|
// #define SIMULACION
|
||||
|
|
||||
|
#ifdef SIMULACION |
||||
|
#define CONT_ROJ 12 |
||||
|
#define CONT_VER 6 |
||||
|
#define CONT_AMA 3 |
||||
|
#else |
||||
|
static void Luces_task(void *arg); |
||||
|
#endif |
||||
|
|
||||
|
static void HUB75_task(void *arg); |
||||
|
static void DSX18_Task(void *); |
||||
|
|
||||
|
#define TAM 1536 |
||||
|
|
||||
|
DMA_ATTR uint32_t graphicsBuffer[TAM]; |
||||
|
|
||||
|
// GPS
|
||||
|
#define PIN_RTS (UART_PIN_NO_CHANGE) |
||||
|
#define PIN_CTS (UART_PIN_NO_CHANGE) |
||||
|
|
||||
|
#define UART_PORT_NUM (2) |
||||
|
#define TASK_STACK_SIZE (4096) |
||||
|
|
||||
|
QueueHandle_t cola; |
||||
|
|
||||
|
#define BUF_SIZE (2048) |
||||
|
|
||||
|
uint8_t *data; |
||||
|
|
||||
|
uint8_t calc_NMEA_Checksum(uint8_t *, int); |
||||
|
// Respuesta:
|
||||
|
const char DEL_TXT[] = "$PQTXT,W,0,1*23\r\n"; // $PQTXT,W,OK*0A␍␊
|
||||
|
const char DEL_CAD[] = "$PMTK314,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n"; // $PMTK001,314,3*36␍␊
|
||||
|
const char ADD_RMS[] = "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n"; // $PMTK001,314,3*36␍␊ $GNRMC,000030.100,V,,,,,0.00,0.00,060180,,,N,V*24␍␊
|
||||
|
|
||||
|
static void GPS_task(void *arg); |
||||
|
|
||||
|
uint8_t h = 0, m = 0, s = 0, t = 20; |
||||
|
|
||||
|
uint8_t gps_hora_ok = 0; |
||||
|
|
||||
|
int16_t ds = 0; |
||||
|
|
||||
|
uint8_t estado_actual, estado_inicial; |
||||
|
|
||||
|
uint8_t estado_solapado, estado_solapado_ant = 0; |
||||
|
|
||||
|
uint8_t tiempos_OK = 0; |
||||
|
|
||||
|
uint8_t estado = EDO_VER; |
||||
|
|
||||
|
uint8_t contador; |
||||
|
|
||||
|
float temperatura; |
||||
|
uint8_t TEMP_OK = false; |
||||
|
|
||||
|
uint8_t temp_int = 0, seg = 0; |
||||
|
|
||||
|
uint8_t at = 40; |
||||
|
|
||||
|
// #define AAA 1
|
||||
|
// #define DDD 2
|
||||
|
// #define III 3
|
||||
|
//
|
||||
|
// #define ADD 4
|
||||
|
// #define AAD 5
|
||||
|
// #define IAA 6
|
||||
|
// #define IIA 7
|
||||
|
// #define IDD 8
|
||||
|
// #define IID 9
|
||||
|
//
|
||||
|
// #define IAD 10
|
||||
|
//
|
||||
|
// #define SOL 20
|
||||
|
//
|
||||
|
// #define NADD 21
|
||||
|
// #define AAND 22 //
|
||||
|
// #define NIAA 23
|
||||
|
// #define IINA 24 //
|
||||
|
// #define NIDD 25
|
||||
|
// #define IIND 26 //
|
||||
|
//
|
||||
|
// #define IAND 27 //
|
||||
|
// #define NIAD 28
|
||||
|
|
||||
|
uint8_t MODO = IAND; |
||||
|
|
||||
|
uint8_t borrar_ptos = 0, nr_b; |
||||
|
|
||||
|
void app_main(void) |
||||
|
{ |
||||
|
uint16_t i = 0, kk = 0, cu, cd, act_gps = 0, hd, hu, md, mu, td, tu, tg, vv = 0, v5 = 0, nr; |
||||
|
|
||||
|
#ifdef SIMULACION |
||||
|
uint8_t cont_edo; |
||||
|
#else |
||||
|
TaskHandle_t Luces_Handle = NULL; |
||||
|
#endif |
||||
|
TaskHandle_t HUB75_Handle = NULL; |
||||
|
TaskHandle_t DSX18_Handle = NULL; |
||||
|
TaskHandle_t GPS_Handle = NULL; |
||||
|
|
||||
|
#ifndef SIMULACION |
||||
|
xTaskCreatePinnedToCore(Luces_task, "Luces_task", 2048, NULL, 10, &Luces_Handle, 0); |
||||
|
#endif |
||||
|
xTaskCreatePinnedToCore(GPS_task, "GPS_task", 4096, NULL, 10, &GPS_Handle, 0); |
||||
|
xTaskCreatePinnedToCore(DSX18_Task, "DSX18_task", 4096, NULL, 10, &DSX18_Handle, 0); |
||||
|
|
||||
|
uart_write_bytes(UART_PORT_NUM, ADD_RMS, strlen(ADD_RMS)); |
||||
|
|
||||
|
vTaskDelay(pdMS_TO_TICKS(10000)); |
||||
|
|
||||
|
xTaskCreatePinnedToCore(HUB75_task, "HUB75_task", 4096, NULL, 10, &HUB75_Handle, 1); |
||||
|
|
||||
|
i = 50; |
||||
|
|
||||
|
#ifdef SIMULACION |
||||
|
cont_edo = 3; |
||||
|
estado_actual = EDO_VER; |
||||
|
tiempos_OK = 3; |
||||
|
#endif |
||||
|
|
||||
|
while (true) |
||||
|
{ |
||||
|
i++; |
||||
|
act_gps++; |
||||
|
|
||||
|
if (act_gps > 1200) |
||||
|
{ |
||||
|
uart_write_bytes(UART_PORT_NUM, ADD_RMS, strlen(ADD_RMS)); |
||||
|
act_gps = 0; |
||||
|
} |
||||
|
|
||||
|
if (i == 25) |
||||
|
{ |
||||
|
if (borrar_ptos == 1) |
||||
|
{ |
||||
|
borrar_ptos = 0; |
||||
|
graphicsBuffer[11 * 24 + nr_b + 3] &= 0XFFFFFFF0; |
||||
|
graphicsBuffer[12 * 24 + nr_b + 3] &= 0XFFFFFF00; |
||||
|
graphicsBuffer[13 * 24 + nr_b + 3] &= 0XFFFFFFF0; |
||||
|
graphicsBuffer[11 * 24 + nr_b + 4] &= 0X0FFFFFFF; |
||||
|
graphicsBuffer[12 * 24 + nr_b + 4] &= 0X00FFFFFF; |
||||
|
graphicsBuffer[13 * 24 + nr_b + 4] &= 0X0FFFFFFF; |
||||
|
graphicsBuffer[18 * 24 + nr_b + 3] &= 0XFFFFFFF0; |
||||
|
graphicsBuffer[19 * 24 + nr_b + 3] &= 0XFFFFFF00; |
||||
|
graphicsBuffer[20 * 24 + nr_b + 3] &= 0XFFFFFFF0; |
||||
|
graphicsBuffer[18 * 24 + nr_b + 4] &= 0X0FFFFFFF; |
||||
|
graphicsBuffer[19 * 24 + nr_b + 4] &= 0X00FFFFFF; |
||||
|
graphicsBuffer[20 * 24 + nr_b + 4] &= 0X0FFFFFFF; |
||||
|
borrar_ptos = 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (i >= 50) // cada segundo
|
||||
|
{ |
||||
|
i = 0; |
||||
|
|
||||
|
#ifdef SIMULACION |
||||
|
cont_edo--; |
||||
|
if (cont_edo == 0) |
||||
|
{ |
||||
|
switch (estado_actual) |
||||
|
{ |
||||
|
case EDO_VER: |
||||
|
estado_actual = EDO_AMA; |
||||
|
cont_edo = CONT_AMA; |
||||
|
break; |
||||
|
case EDO_AMA: |
||||
|
estado_actual = EDO_ROJ; |
||||
|
cont_edo = CONT_ROJ; |
||||
|
break; |
||||
|
case EDO_ROJ: |
||||
|
estado_actual = EDO_VER; |
||||
|
cont_edo = CONT_VER; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
ds = 10 * cont_edo; |
||||
|
#endif |
||||
|
if (ds > 0) |
||||
|
{ |
||||
|
cd = 64 * 4 * ((ds / 10) / 10); |
||||
|
cu = 64 * 4 * ((ds / 10) % 10); |
||||
|
} |
||||
|
|
||||
|
switch (estado_actual) |
||||
|
{ |
||||
|
case EDO_AMA: |
||||
|
estado = EDO_ROJ; |
||||
|
break; |
||||
|
case EDO_ROJ: |
||||
|
estado = EDO_VER; |
||||
|
break; |
||||
|
case EDO_VER: |
||||
|
estado = EDO_AMA; |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
estado_solapado = gpio_get_level(ENT_SOL); |
||||
|
if (estado_solapado_ant != estado_solapado) |
||||
|
{ |
||||
|
estado_solapado_ant = estado_solapado; |
||||
|
} |
||||
|
|
||||
|
estado = estado_actual; |
||||
|
switch (estado) |
||||
|
{ |
||||
|
case EDO_ROJ: |
||||
|
if ((tiempos_OK == 3) && (ds > 10)) |
||||
|
{ |
||||
|
for (uint16_t i = 0; i < 64; i++) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + 0] = NumGRR[cd + 0]; |
||||
|
graphicsBuffer[i * 24 + 1] = NumGRR[cd + 1]; |
||||
|
graphicsBuffer[i * 24 + 2] = NumGRR[cd + 2]; |
||||
|
graphicsBuffer[i * 24 + 3] = NumGRR[cd + 3]; |
||||
|
graphicsBuffer[i * 24 + 4] = NumGRR[cu + 0]; |
||||
|
graphicsBuffer[i * 24 + 5] = NumGRR[cu + 1]; |
||||
|
graphicsBuffer[i * 24 + 6] = NumGRR[cu + 2]; |
||||
|
graphicsBuffer[i * 24 + 7] = NumGRR[cu + 3]; |
||||
|
cu += 4; |
||||
|
cd += 4; |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
for (uint16_t i = 0; i < 64; i++) |
||||
|
{ |
||||
|
for (uint16_t j = 0; j < 8; j++) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + j] = CR[i * 8 + j]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if ((MODO > SOL) && (estado_solapado == 0) && ((MODO == NADD) || (MODO == NIAA) || (MODO == NIDD) || (MODO == NIAD))) |
||||
|
nr = 16; |
||||
|
else |
||||
|
nr = 8; |
||||
|
|
||||
|
if (gps_hora_ok) |
||||
|
{ |
||||
|
hd = 32 * 2 * (h / 10); |
||||
|
hu = 32 * 2 * (h % 10); |
||||
|
md = 32 * 2 * (m / 10); |
||||
|
mu = 32 * 2 * (m % 10); |
||||
|
|
||||
|
if ((h > 5) && (h < 19)) |
||||
|
at = 40; |
||||
|
else |
||||
|
at = 30; |
||||
|
|
||||
|
for (uint16_t i = 0; i < 32; i++) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + nr + 0] = NBI[hd + 0]; |
||||
|
graphicsBuffer[i * 24 + nr + 1] = NBI[hd + 1]; |
||||
|
graphicsBuffer[i * 24 + nr + 2] = NBI[hu + 0]; |
||||
|
graphicsBuffer[i * 24 + nr + 3] = NBI[hu + 1]; |
||||
|
graphicsBuffer[i * 24 + nr + 4] = NBD[md + 0]; |
||||
|
graphicsBuffer[i * 24 + nr + 5] = NBD[md + 1]; |
||||
|
graphicsBuffer[i * 24 + nr + 6] = NBD[mu + 0]; |
||||
|
graphicsBuffer[i * 24 + nr + 7] = NBD[mu + 1]; |
||||
|
hd += 2; |
||||
|
hu += 2; |
||||
|
md += 2; |
||||
|
mu += 2; |
||||
|
} |
||||
|
graphicsBuffer[11 * 24 + nr + 3] |= 0X00000007; |
||||
|
graphicsBuffer[12 * 24 + nr + 3] |= 0X00000077; |
||||
|
graphicsBuffer[13 * 24 + nr + 3] |= 0X00000007; |
||||
|
graphicsBuffer[11 * 24 + nr + 4] |= 0X70000000; |
||||
|
graphicsBuffer[12 * 24 + nr + 4] |= 0X77000000; |
||||
|
graphicsBuffer[13 * 24 + nr + 4] |= 0X70000000; |
||||
|
|
||||
|
graphicsBuffer[18 * 24 + nr + 3] |= 0X00000007; |
||||
|
graphicsBuffer[19 * 24 + nr + 3] |= 0X00000077; |
||||
|
graphicsBuffer[20 * 24 + nr + 3] |= 0X00000007; |
||||
|
graphicsBuffer[18 * 24 + nr + 4] |= 0X70000000; |
||||
|
graphicsBuffer[19 * 24 + nr + 4] |= 0X77000000; |
||||
|
graphicsBuffer[20 * 24 + nr + 4] |= 0X70000000; |
||||
|
|
||||
|
borrar_ptos = 1; |
||||
|
nr_b = nr; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
for (uint16_t i = 0; i < 32; i++) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + nr + 0] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 1] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 2] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 3] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 4] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 5] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 6] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 7] = 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (TEMP_OK) |
||||
|
{ |
||||
|
temp_int = (uint8_t)temperatura; |
||||
|
|
||||
|
td = 32 * 2 * (temp_int / 10); |
||||
|
tu = 32 * 2 * (temp_int % 10); |
||||
|
tg = 0; |
||||
|
for (uint16_t i = 32; i < 64; i++) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + nr + 0] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 1] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 2] = NBD[td + 0]; |
||||
|
graphicsBuffer[i * 24 + nr + 3] = NBD[td + 1]; |
||||
|
graphicsBuffer[i * 24 + nr + 4] = NBD[tu + 0]; |
||||
|
graphicsBuffer[i * 24 + nr + 5] = NBD[tu + 1]; |
||||
|
|
||||
|
graphicsBuffer[i * 24 + nr + 6] = SG[tg + 0]; |
||||
|
graphicsBuffer[i * 24 + nr + 7] = SG[tg + 1]; |
||||
|
|
||||
|
td += 2; |
||||
|
tu += 2; |
||||
|
tg += 2; |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
for (uint16_t i = 32; i < 64; i++) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + nr + 0] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 1] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 2] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 3] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 4] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 5] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 6] = 0; |
||||
|
graphicsBuffer[i * 24 + nr + 7] = 0; |
||||
|
} |
||||
|
} |
||||
|
break; |
||||
|
case EDO_AMA: |
||||
|
if ((tiempos_OK == 3) && (ds > 10)) |
||||
|
{ |
||||
|
for (uint16_t i = 0; i < 64; i++) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + 0] = NumGRA[cd + 0]; |
||||
|
graphicsBuffer[i * 24 + 1] = NumGRA[cd + 1]; |
||||
|
graphicsBuffer[i * 24 + 2] = NumGRA[cd + 2]; |
||||
|
graphicsBuffer[i * 24 + 3] = NumGRA[cd + 3]; |
||||
|
graphicsBuffer[i * 24 + 4] = NumGRA[cu + 0]; |
||||
|
graphicsBuffer[i * 24 + 5] = NumGRA[cu + 1]; |
||||
|
graphicsBuffer[i * 24 + 6] = NumGRA[cu + 2]; |
||||
|
graphicsBuffer[i * 24 + 7] = NumGRA[cu + 3]; |
||||
|
cu += 4; |
||||
|
cd += 4; |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
for (uint16_t i = 0; i < 64; i++) |
||||
|
{ |
||||
|
for (uint16_t j = 0; j < 8; j++) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + j] = CA[i * 8 + j]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
break; |
||||
|
case EDO_VER: |
||||
|
if ((tiempos_OK == 3) && (ds > 10)) |
||||
|
{ |
||||
|
for (uint16_t i = 0; i < 64; i++) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + 0] = NumGRV[cd + 0]; |
||||
|
graphicsBuffer[i * 24 + 1] = NumGRV[cd + 1]; |
||||
|
graphicsBuffer[i * 24 + 2] = NumGRV[cd + 2]; |
||||
|
graphicsBuffer[i * 24 + 3] = NumGRV[cd + 3]; |
||||
|
graphicsBuffer[i * 24 + 4] = NumGRV[cu + 0]; |
||||
|
graphicsBuffer[i * 24 + 5] = NumGRV[cu + 1]; |
||||
|
graphicsBuffer[i * 24 + 6] = NumGRV[cu + 2]; |
||||
|
graphicsBuffer[i * 24 + 7] = NumGRV[cu + 3]; |
||||
|
cu += 4; |
||||
|
cd += 4; |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
for (uint16_t i = 0; i < 64; i++) |
||||
|
{ |
||||
|
for (uint16_t j = 0; j < 8; j++) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + j] = CV[i * 8 + j]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if ((estado == EDO_ROJ) && ((i % 3) == 0) && ((MODO < SOL) || ((MODO > SOL) && (estado_solapado == 1)))) // No hay Solpados Configurados | No esta activo el Sol
|
||||
|
{ |
||||
|
kk++; |
||||
|
if (kk >= 30) |
||||
|
kk = 0; |
||||
|
|
||||
|
tg = 64 * 8 * kk; |
||||
|
for (uint16_t i = 0; i < 64; i++) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + 16 + 0] = Peaton[tg + 0]; |
||||
|
graphicsBuffer[i * 24 + 16 + 1] = Peaton[tg + 1]; |
||||
|
graphicsBuffer[i * 24 + 16 + 2] = Peaton[tg + 2]; |
||||
|
graphicsBuffer[i * 24 + 16 + 3] = Peaton[tg + 3]; |
||||
|
graphicsBuffer[i * 24 + 16 + 4] = Peaton[tg + 4]; |
||||
|
graphicsBuffer[i * 24 + 16 + 5] = Peaton[tg + 5]; |
||||
|
graphicsBuffer[i * 24 + 16 + 6] = Peaton[tg + 6]; |
||||
|
graphicsBuffer[i * 24 + 16 + 7] = Peaton[tg + 7]; |
||||
|
|
||||
|
tg += 8; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if ((estado == EDO_ROJ) && ((i % 10) == 0) && (MODO > SOL) && (estado_solapado == 0)) // Hay un Solapado configurado y esta Activo
|
||||
|
{ |
||||
|
if (v5 == 0) |
||||
|
{ |
||||
|
vv++; |
||||
|
if (vv >= 5) |
||||
|
{ |
||||
|
v5 = 1; |
||||
|
vv = 5; |
||||
|
} |
||||
|
} |
||||
|
else if (v5 < 4) |
||||
|
v5++; |
||||
|
else |
||||
|
{ |
||||
|
v5 = 0; |
||||
|
vv = 0; |
||||
|
} |
||||
|
|
||||
|
uint8_t Despl, ef; |
||||
|
|
||||
|
if ((MODO == NIAA) || (MODO == NADD) || (MODO == NIDD) || (MODO == NIAD)) |
||||
|
Despl = 8; |
||||
|
else |
||||
|
Despl = 16; |
||||
|
|
||||
|
for (uint16_t i = 0; i < 64; i++) |
||||
|
{ |
||||
|
for (uint16_t j = 0; j < 8; j++) |
||||
|
{ |
||||
|
ef = 1; |
||||
|
if (Despl == 8) |
||||
|
{ |
||||
|
if (j > 5) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + Despl + j] = 0; |
||||
|
ef = 0; |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
if (j < 2) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + Despl + j] = 0; |
||||
|
ef = 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (ef == 1) |
||||
|
{ |
||||
|
switch (MODO) |
||||
|
{ |
||||
|
case NADD: |
||||
|
graphicsBuffer[i * 24 + Despl + j] = Rojo_Sol_AI[vv * 512 + i * 8 + j]; |
||||
|
break; |
||||
|
case IINA: |
||||
|
graphicsBuffer[i * 24 + Despl + j] = Rojo_Sol_AD[vv * 512 + i * 8 + j]; |
||||
|
break; |
||||
|
case AAND: |
||||
|
case IIND: |
||||
|
case IAND: |
||||
|
graphicsBuffer[i * 24 + Despl + j] = Rojo_Sol_D[vv * 512 + i * 8 + j]; |
||||
|
break; |
||||
|
case NIAA: |
||||
|
case NIDD: |
||||
|
case NIAD: |
||||
|
graphicsBuffer[i * 24 + Despl + j] = Rojo_Sol_I[vv * 512 + i * 8 + j]; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if ((estado == EDO_AMA) && (i % 10) == 0) |
||||
|
{ |
||||
|
if (v5 == 0) |
||||
|
{ |
||||
|
vv++; |
||||
|
if (vv >= 5) |
||||
|
{ |
||||
|
v5 = 1; |
||||
|
vv = 5; |
||||
|
} |
||||
|
} |
||||
|
else if (v5 < 4) |
||||
|
v5++; |
||||
|
else |
||||
|
{ |
||||
|
v5 = 0; |
||||
|
vv = 0; |
||||
|
} |
||||
|
|
||||
|
if ((MODO < SOL) || ((MODO > SOL) && (estado_solapado == 1))) // No hay solape
|
||||
|
{ |
||||
|
for (uint16_t i = 0; i < 64; i++) |
||||
|
{ |
||||
|
for (uint16_t j = 0; j < 16; j++) |
||||
|
{ |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Amarillo[i * 16 + j]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
for (uint16_t i = 0; i < 64; i++) |
||||
|
{ |
||||
|
for (uint16_t j = 0; j < 16; j++) |
||||
|
{ |
||||
|
switch (MODO) |
||||
|
{ |
||||
|
case NADD: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Ama_Sol_AI[vv * 384 + i * 6 + j]; |
||||
|
break; |
||||
|
case IINA: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Ama_Sol_AD[vv * 384 + i * 6 + j]; |
||||
|
break; |
||||
|
case AAND: |
||||
|
case IIND: |
||||
|
case IAND: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Ama_Sol_D[vv * 384 + i * 6 + j]; |
||||
|
break; |
||||
|
case NIAA: |
||||
|
case NIDD: |
||||
|
case NIAD: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Ama_Sol_I[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if ((estado == EDO_VER) && (i % 10) == 0) |
||||
|
{ |
||||
|
if (v5 == 0) |
||||
|
{ |
||||
|
vv++; |
||||
|
if (vv >= 5) |
||||
|
{ |
||||
|
v5 = 1; |
||||
|
vv = 5; |
||||
|
} |
||||
|
} |
||||
|
else if (v5 < 4) |
||||
|
v5++; |
||||
|
else |
||||
|
{ |
||||
|
v5 = 0; |
||||
|
vv = 0; |
||||
|
} |
||||
|
|
||||
|
if ((MODO < SOL) || ((MODO > SOL) && (estado_solapado == 0))) // No hay solape
|
||||
|
{ |
||||
|
for (uint16_t i = 0; i < 64; i++) |
||||
|
{ |
||||
|
for (uint16_t j = 0; j < 16; j++) |
||||
|
{ |
||||
|
switch (MODO) |
||||
|
{ |
||||
|
case AAA: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_AAA[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case DDD: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_DDD[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case III: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_III[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case ADD: |
||||
|
case NADD: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_ADD[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case AAD: |
||||
|
case AAND: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_AAD[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case IAA: |
||||
|
case NIAA: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_IAA[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case IIA: |
||||
|
case IINA: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_IIA[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case IDD: |
||||
|
case NIDD: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_IDD[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case IID: |
||||
|
case IIND: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_IID[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case IAD: |
||||
|
case IAND: |
||||
|
case NIAD: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_IAD[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
for (uint16_t i = 0; i < 64; i++) |
||||
|
{ |
||||
|
for (uint16_t j = 0; j < 16; j++) |
||||
|
{ |
||||
|
switch (MODO) |
||||
|
{ |
||||
|
case NADD: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_NADD[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case AAND: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_AAND[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case NIAA: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_NIAA[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case IINA: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_IINA[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case NIDD: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_NIDD[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case IIND: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_IIND[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case IAND: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_IAND[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
case NIAD: |
||||
|
graphicsBuffer[i * 24 + 8 + j] = Flecha_Verde_NIAD[vv * 1024 + i * 16 + j]; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
vTaskDelay(pdMS_TO_TICKS(20)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
static void HUB75_task(void *arg) |
||||
|
{ |
||||
|
HUB75_init(); |
||||
|
|
||||
|
while (1) |
||||
|
{ |
||||
|
HUB75_displayBuffer_Color64(graphicsBuffer, at); |
||||
|
vTaskDelay(pdMS_TO_TICKS(1)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#ifndef SIMULACION |
||||
|
|
||||
|
#define INTERVALO 20 |
||||
|
|
||||
|
static void Luces_task(void *arg) |
||||
|
{ |
||||
|
uint16_t tiempo[4] = {0, 0, 0, 0}; |
||||
|
|
||||
|
gpio_reset_pin(ENT_VER); |
||||
|
gpio_set_direction(ENT_VER, GPIO_MODE_INPUT); |
||||
|
|
||||
|
gpio_reset_pin(ENT_AMA); |
||||
|
gpio_set_direction(ENT_AMA, GPIO_MODE_INPUT); |
||||
|
|
||||
|
gpio_reset_pin(ENT_SOL); |
||||
|
gpio_set_direction(ENT_SOL, GPIO_MODE_INPUT); |
||||
|
|
||||
|
estado_inicial = gpio_get_level(ENT_AMA) * 2 + gpio_get_level(ENT_VER); |
||||
|
do |
||||
|
{ |
||||
|
vTaskDelay(pdMS_TO_TICKS(100)); |
||||
|
estado_actual = gpio_get_level(ENT_AMA) * 2 + gpio_get_level(ENT_VER); |
||||
|
} while (estado_actual == estado_inicial); |
||||
|
|
||||
|
while (1) |
||||
|
{ |
||||
|
if (tiempos_OK < 3) |
||||
|
{ |
||||
|
ds = 0; |
||||
|
estado_inicial = estado_actual; |
||||
|
do |
||||
|
{ |
||||
|
vTaskDelay(pdMS_TO_TICKS(100)); |
||||
|
ds++; |
||||
|
estado_actual = gpio_get_level(ENT_AMA) * 2 + gpio_get_level(ENT_VER); |
||||
|
} while (estado_actual == estado_inicial); |
||||
|
tiempo[estado_inicial] = ds; |
||||
|
tiempos_OK++; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
ds = tiempo[estado_actual] + 10; |
||||
|
estado_inicial = estado_actual; |
||||
|
do |
||||
|
{ |
||||
|
vTaskDelay(pdMS_TO_TICKS(100)); |
||||
|
if (ds < 0) |
||||
|
tiempos_OK = 0; |
||||
|
else |
||||
|
ds--; |
||||
|
estado_actual = gpio_get_level(ENT_AMA) * 2 + gpio_get_level(ENT_VER); |
||||
|
} while (estado_actual == estado_inicial); |
||||
|
if (ds > INTERVALO) |
||||
|
tiempos_OK = 0; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endif |
||||
|
|
||||
|
static void GPS_task(void *arg) |
||||
|
{ |
||||
|
uart_event_t evento; |
||||
|
|
||||
|
data = (uint8_t *)malloc(BUF_SIZE); |
||||
|
|
||||
|
uart_config_t uart_config = |
||||
|
{ |
||||
|
.baud_rate = 9600, |
||||
|
.data_bits = UART_DATA_8_BITS, |
||||
|
.parity = UART_PARITY_DISABLE, |
||||
|
.stop_bits = UART_STOP_BITS_1, |
||||
|
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE, |
||||
|
.source_clk = UART_SCLK_DEFAULT, |
||||
|
}; |
||||
|
|
||||
|
ESP_ERROR_CHECK(uart_driver_install(UART_PORT_NUM, BUF_SIZE * 2, 0, 10, &cola, 0)); |
||||
|
ESP_ERROR_CHECK(uart_param_config(UART_PORT_NUM, &uart_config)); |
||||
|
ESP_ERROR_CHECK(uart_set_pin(UART_PORT_NUM, PIN_TXD, PIN_RXD, PIN_RTS, PIN_CTS)); |
||||
|
|
||||
|
uart_write_bytes(UART_PORT_NUM, ADD_RMS, strlen(ADD_RMS)); |
||||
|
vTaskDelay(pdMS_TO_TICKS(100)); |
||||
|
uart_write_bytes(UART_PORT_NUM, DEL_TXT, strlen(DEL_TXT)); |
||||
|
vTaskDelay(pdMS_TO_TICKS(100)); |
||||
|
uart_write_bytes(UART_PORT_NUM, DEL_CAD, strlen(DEL_CAD)); |
||||
|
|
||||
|
while (true) |
||||
|
{ |
||||
|
if (xQueueReceive(cola, (void *)&evento, portMAX_DELAY)) |
||||
|
{ |
||||
|
if (evento.type == UART_DATA) |
||||
|
{ |
||||
|
uint16_t i = 0; |
||||
|
uint8_t len = uart_read_bytes(UART_PORT_NUM, data, (BUF_SIZE - 1), 20 / portTICK_PERIOD_MS); |
||||
|
data[len] = '\0'; |
||||
|
|
||||
|
uint8_t Chk_Cal = calc_NMEA_Checksum(data, len); |
||||
|
|
||||
|
uint8_t Chk_Cal1 = Chk_Cal / 16; |
||||
|
uint8_t Chk_Cal2 = Chk_Cal % 16; |
||||
|
|
||||
|
if (Chk_Cal1 < 10) |
||||
|
Chk_Cal1 += '0'; |
||||
|
else |
||||
|
Chk_Cal1 = Chk_Cal1 - 10 + 'A'; |
||||
|
if (Chk_Cal2 < 10) |
||||
|
Chk_Cal2 += '0'; |
||||
|
else |
||||
|
Chk_Cal2 = Chk_Cal2 - 10 + 'A'; |
||||
|
|
||||
|
if ((Chk_Cal1 == data[len - 4]) && (Chk_Cal2 == data[len - 3])) |
||||
|
{ |
||||
|
i = 0; |
||||
|
while (true) |
||||
|
{ |
||||
|
if ((data[i] == 'R') && (data[i + 1] == 'M') && (data[i + 2] == 'C')) |
||||
|
break; |
||||
|
i++; |
||||
|
if (i == len - 2) |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
if (i < len - 2) |
||||
|
{ |
||||
|
uint8_t k = 0; //, a;
|
||||
|
uint16_t j = 0; |
||||
|
|
||||
|
uart_write_bytes(UART_PORT_NUM, DEL_CAD, strlen(DEL_CAD)); |
||||
|
|
||||
|
//$GNRMC,134508.087,V,,,,,0.00,0.00,251123,,,N,V*2B
|
||||
|
while (j < BUF_SIZE) |
||||
|
{ |
||||
|
j++; |
||||
|
if (data[j] == ',') |
||||
|
{ |
||||
|
k++; |
||||
|
if (k == 12 /*9*/) |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
if (k == 12) |
||||
|
{ |
||||
|
// 01234567890123456789012345678901234567890123456789
|
||||
|
// 1 2 34567 8 9 012
|
||||
|
//$GNRMC,134508.087,V,,,,,0.00,0.00,251123,,,N,V*2B
|
||||
|
//--a = (data[j + 5] - '0') * 10 + data[j + 6] - '0';
|
||||
|
// a = data[j + 1];
|
||||
|
// printf("a = %c\n", a);
|
||||
|
|
||||
|
// Mode indication (A=autonomous positioning, D=differential, E=estimation, N=invalid data)
|
||||
|
|
||||
|
// if ((a == 'A')||(a == 'D')||(a == 'E'))
|
||||
|
{ |
||||
|
h = (data[i + 4] - '0') * 10 + data[i + 5] - '0'; |
||||
|
m = (data[i + 6] - '0') * 10 + data[i + 7] - '0'; |
||||
|
s = (data[i + 8] - '0') * 10 + data[i + 9] - '0'; |
||||
|
|
||||
|
if ((h < 24) && (m < 60) && (s < 60)) |
||||
|
{ |
||||
|
if (h < 4) |
||||
|
h += 20; |
||||
|
else |
||||
|
h -= 4; |
||||
|
|
||||
|
gps_hora_ok = 1; |
||||
|
} |
||||
|
else |
||||
|
gps_hora_ok = 0; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
vTaskDelay(pdMS_TO_TICKS(100)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
uint8_t calc_NMEA_Checksum(uint8_t *buf, int n) |
||||
|
{ |
||||
|
char Checksum = 0; |
||||
|
|
||||
|
for (unsigned char i = 0; i < n; ++i) |
||||
|
{ |
||||
|
switch (buf[i]) |
||||
|
{ |
||||
|
case '$': |
||||
|
break; |
||||
|
case '*': |
||||
|
i = n; |
||||
|
continue; |
||||
|
default: |
||||
|
if (Checksum == 0) |
||||
|
Checksum = buf[i]; |
||||
|
else |
||||
|
Checksum = Checksum ^ buf[i]; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return Checksum; |
||||
|
} |
||||
|
|
||||
|
void DSX18_Task(void *p) |
||||
|
{ |
||||
|
float temperature, temperature_ac, i_ac; |
||||
|
esp_err_t res; |
||||
|
ds18x20_addr_t addr; |
||||
|
|
||||
|
uint8_t MAX_SENSORS = 3; |
||||
|
|
||||
|
ds18x20_addr_t addrs[MAX_SENSORS]; |
||||
|
size_t sensor_count = 0; |
||||
|
|
||||
|
gpio_set_pull_mode(DS_PIN, GPIO_PULLUP_ONLY); |
||||
|
|
||||
|
while (true) |
||||
|
{ |
||||
|
res = ds18x20_scan_devices(DS_PIN, addrs, MAX_SENSORS, &sensor_count); |
||||
|
|
||||
|
if (res != ESP_OK) |
||||
|
{ |
||||
|
vTaskDelay(pdMS_TO_TICKS(20000)); |
||||
|
continue; |
||||
|
} |
||||
|
if (!sensor_count) |
||||
|
{ |
||||
|
vTaskDelay(pdMS_TO_TICKS(20000)); |
||||
|
continue; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
for (uint8_t i = 0; i < sensor_count; i++) |
||||
|
addr = addrs[i]; |
||||
|
|
||||
|
while (true) |
||||
|
{ |
||||
|
temperature_ac = 0; |
||||
|
i_ac = 0; |
||||
|
for (uint8_t i = 0; i < sensor_count; i++) |
||||
|
{ |
||||
|
addr = addrs[i]; |
||||
|
res = ds18x20_measure_and_read(DS_PIN, addr, &temperature); |
||||
|
if (res == ESP_OK) |
||||
|
{ |
||||
|
temperature_ac += temperature; |
||||
|
i_ac++; |
||||
|
} |
||||
|
} |
||||
|
if (i_ac > 0) |
||||
|
{ |
||||
|
temperatura = temperature_ac / i_ac; |
||||
|
TEMP_OK = true; |
||||
|
} |
||||
|
vTaskDelay(pdMS_TO_TICKS(20000)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue