Skip to content

Commit

Permalink
Addressed #112, #113, #116, #118, #123, #126 and several minor bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsonm236 committed Dec 17, 2022
1 parent eeec0c0 commit 3f31a7e
Show file tree
Hide file tree
Showing 18 changed files with 1,284 additions and 541 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion NetworkModule/.Idea_Groups/Vector_File.grp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Group File Created by IDEA
# Project: <NetworkModule>
# Mon Nov 28 19:28:29 2022
# Sat Dec 17 06:53:38 2022
#
"networkmodule_vector.o"
462 changes: 232 additions & 230 deletions NetworkModule/.Idea_Temp/COBJ.TMP

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion NetworkModule/.Idea_Temp/IDEA.ERR
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ uip_tcpapphub.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)fctcpy.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)bmulx.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)eeprom.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)imul.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)itolx.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)ladc.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)ladd.o:
Expand All @@ -79,5 +78,7 @@ uip_tcpapphub.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)rtol.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)smul.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)utolx.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)vmul.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)umul.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)xreg.o:
(C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\lib\libm0.sm8)yreg.o:
2 changes: 1 addition & 1 deletion NetworkModule/.Idea_Temp/IDEABLD.BAT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
REM COMMAND FILE BUILT BY IDEA
REM Mon Nov 28 19:28:25 2022
REM Sat Dec 17 06:53:34 2022
REM
cxstm8 -v -l +strict +debug +modsl0 +split +warn "networkmodule_vector.c"
cxstm8 -v -l +strict +debug +modsl0 +split +warn "ds18b20.c" "enc28j60.c" "gpio.c" "httpd.c" "i2c.c" "main.c" "mqtt.c" "mqtt_pal.c" "spi.c" "timer.c" "uart.c" "uip.c" "uip_arp.c" "uip_tcpapphub.c"
Expand Down
4 changes: 2 additions & 2 deletions NetworkModule/Enc28j60.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ void Enc28j60Init(void)
// of the byte which must not be over-written here, so the existing bit is
// read and duplicated here.
debug[2] = (uint8_t)(debug[2] & 0xf0);
debug[2] = (uint8_t)(debug[2] & ((Enc28j60ReadReg(BANK3_EREVID)) & 0x07));
debug[2] = (uint8_t)(debug[2] | ((Enc28j60ReadReg(BANK3_EREVID)) & 0x07));
update_debug_storage1(); // Only write the EEPROM if the byte changed.
#endif // DEBUG_SUPPORT

Expand Down Expand Up @@ -714,7 +714,7 @@ UARTPrintf("Enc28j60Receive MAXFRAME exceeded\r\n");
Enc28j60SetMaskReg(BANKX_ECON2 , (1<<BANKX_ECON2_PKTDEC));

#if DEBUG_SUPPORT != 11
if (nBytes > 500) {
if (nBytes > (ENC28J60_MAXFRAME - 20)) {
UARTPrintf("Enc28j60Received nBytes = ");
emb_itoa(nBytes, OctetArray, 10, 3);
UARTPrintf(OctetArray);
Expand Down
32 changes: 9 additions & 23 deletions NetworkModule/Gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extern uint8_t stored_pin_control[16]; // Per pin control settings stored in

// The following enum PORTS, struct io_registers, struct io_mapping, and
// struct io_mapping io_map are used to direct the read_input_pins() and
// write_output_pins functions to the correct registers and bits for each
// write_output_pins() functions to the correct registers and bits for each
// physical pin that is being read or written. This significantly reduces
// the code size for these functions. Credit to Carlos Ladeira for this
// clever implementation.
Expand Down Expand Up @@ -107,7 +107,7 @@ void gpio_init(void)
(stored_magic1 == 0xf0)) {

// Create 16bit versions of the pin control information
encode_16bit_registers();
encode_16bit_registers(1);

// Update the output pins
write_output_pins(); // Initializes the ODR bits
Expand Down Expand Up @@ -227,7 +227,12 @@ void gpio_init(void)
// need to be configured as output
for (i=0; i<16; i++) {
// Determine setting from stored_pin_control byte
#if LINKED_SUPPORT == 0
if (stored_pin_control[i] & 0x02) {
#endif // LINKED_SUPPORT == 0
#if LINKED_SUPPORT == 1
if (chk_iotype(stored_pin_control[i], i, 0x03) == 0x03) {
#endif // LINKED_SUPPORT == 1
// set i/o port ddr register
// seting to 1 only the corresponding bit of
// the port associated to the current i/o
Expand Down Expand Up @@ -542,28 +547,9 @@ void gpio_init(void)

void LEDcontrol(uint8_t state)
{

// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// temp code until initialization is figured out
// // Bit 2 - LED - Set as output
PA_DDR |= 0x04;
PA_CR1 = (uint8_t)0xff;
PA_CR2 = (uint8_t)0x00;
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

// Function to turn the LED on or off
// state = 1 turns LED on (output high)
if (state == 1) PA_ODR |= (uint8_t)0x04;
// state = 0 turns LED off (output low)
if (state) PA_ODR |= (uint8_t)0x04;
else PA_ODR &= (uint8_t)(~0x04);
}

Expand Down
Loading

0 comments on commit 3f31a7e

Please sign in to comment.