Commit 728872ed authored by Martin Vítek's avatar Martin Vítek

ZCU IP

parent bb5e5352
......@@ -21,7 +21,7 @@ project(nixie_clock)
# C and C++ standards
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_BUILD_TYPE MinSizeRel)
......
......@@ -3,7 +3,7 @@
*
* Created: 25. 4. 2017 17:57:06
* Author : Martin
*/
*/
#include "sam.h"
......@@ -40,43 +40,43 @@ int main(void)
{
//Initialize the SAM system
SystemInit();
//Initialize clocks and clock distribution system
sys.init_clock();
//Enable external interrupts from peripherals
sys.init_interrupts();
//Enable external interrupts from buttons
sys.init_eic();
//Init buttons
button_hour.init();
button_min.init();
//Init timer for counting time (1ms increment)
tim.init();
//Init ADC
adc.init();
//Init SPI
spi.init();
//Init UART - 1 000 000baud, 8N1
uart.init();
nixie.display.init();
nixie.separator.init();
boost.init();
//boost.disable();
eth.init(MAC({0x54, 0x10, 0xEC, 0x20, 0xE5, 0xBD}));
uart.send("\n\rNixie clock v2.0\n\r");
uart.send("Martin Vitek - 2017\n\r\n\r");
eth.print_device_info();
nixie.get_mac();
......@@ -84,34 +84,36 @@ int main(void)
uint8_t eeprom_mac[6];
eeprom.read_EUI(eeprom_mac);
stack.set_MAC(eeprom_mac);
//Set-up IPv4 address
//stack.set_IP({192, 168, 1, 2});
stack.set_IP({10, 20, 70, 80});
//stack.set_IP({10, 20, 70, 80});
stack.set_IP({147, 228, 96, 87});
//Set-up gateway address
//stack.set_gateway({192, 168, 1, 1});
stack.set_gateway({10, 20, 70, 1});
//stack.set_gateway({10, 20, 70, 1});
stack.set_gateway({147, 228, 96, 1});
//Set-up network mask
stack.set_mask({255, 255, 255, 0});
//Init network stack and ENC28J60
stack.init();
//Send SNTP request on clock1.zcu.cz
stack.send_sntp_request(nixie.sntp_server_ip);
stack.send_sntp_request(nixie.sntp_server_ip);
while (true)
{
while (true)
{
nixie.screen_handler();
nixie.display_handler();
nixie.separator.pulsing_handler();
nixie.sntp_handler();
nixie.buttons_handler();
nixie.brightness_handler();
eth.get_interrupt_source();
stack.check_link();
stack.rx_handler();
......@@ -119,7 +121,7 @@ int main(void)
stack.packet_handler();
stack.sntp_arp_handler();
stack.arp_timeout_handler();
if (adc.done)
{
adc.convert_values();
......@@ -128,7 +130,7 @@ int main(void)
adc.done = false;
}
if ((clock() % 1000) == 0 )
{
//Send ADC values
......@@ -151,15 +153,15 @@ int main(void)
uart.send("Ambient light:\t");
uart.send_dec(adc.value[adc.AMBIENT_LIGHT]);
uart.send_new_line();
uart.send("Temp boost:\t");
uart.send_dec(adc.value[adc.TEMPERATURE_BOOST]/100);uart.send('.');uart.send_dec(adc.value[adc.TEMPERATURE_BOOST]%100);
uart.send_new_line();
uart.send("Temp ambient:\t");
uart.send_dec(adc.value[adc.TEMPERATURE_AMBIENT]/100);uart.send('.');uart.send_dec(adc.value[adc.TEMPERATURE_AMBIENT]%100);
uart.send_new_line();
uart.send("Duty:\t");
uart.send_dec(boost.get_duty());
uart.send_new_line();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment