Modbus changed into static library

This commit is contained in:
jaakkoiot
2022-10-17 09:15:24 +03:00
parent 5f0d233a82
commit bada194ebe
12 changed files with 198 additions and 71 deletions

View File

@@ -29,7 +29,7 @@ Arduino library for communicating with Modbus slaves over RS232/485 (via RTU pro
/* _____PROJECT INCLUDES_____________________________________________________ */
#include "ModbusLeader.h"
#include "ModbusMaster.h"
#include "crc16.h"

View File

@@ -1,7 +1,6 @@
#include "SerialPort.h"
SerialPort::SerialPort() {
if(!u) {
LpcPinMap none = {-1, -1}; // unused pin has negative values in it

View File

@@ -1,7 +1,6 @@
#include <cstring>
#include "Uart.h"
static LpcUart *u0;
static LpcUart *u1;
static LpcUart *u2;
@@ -13,28 +12,16 @@ extern "C" {
*/
void UART0_IRQHandler(void)
{
/* Want to handle any errors? Do it here. */
/* Use default ring buffer handler. Override this with your own
code if you need more capability. */
if(u0) u0->isr();
}
void UART1_IRQHandler(void)
{
/* Want to handle any errors? Do it here. */
/* Use default ring buffer handler. Override this with your own
code if you need more capability. */
if(u1) u1->isr();
}
void UART2_IRQHandler(void)
{
/* Want to handle any errors? Do it here. */
/* Use default ring buffer handler. Override this with your own
code if you need more capability. */
if(u2) u2->isr();
}

View File

@@ -1,45 +0,0 @@
#if defined (__USE_LPCOPEN)
#if defined(NO_BOARD_LIB)
#include "chip.h"
#else
#include "board.h"
#endif
#endif
#include <cr_section_macros.h>
#include "ModbusMaster.h"
// TODO: insert other include files here
// TODO: insert other definitions and declarations here
int main(void) {
#if defined (__USE_LPCOPEN)
// Read clock settings and update SystemCoreClock variable
SystemCoreClockUpdate();
#if !defined(NO_BOARD_LIB)
// Set up and initialize all required blocks and
// functions related to the board hardware
Board_Init();
// Set the LED to the state of "On"
Board_LED_Set(0, true);
#endif
#endif
// TODO: insert code here
ModbusMaster MIO_12V(1);
ModbusMaster CO2_sensor(240);
ModbusMaster RH_sensor(241);
// Force the counter to be placed into memory
volatile static int i = 0 ;
// Enter an infinite loop, just incrementing a counter
while(1) {
i++ ;
// "Dummy" NOP to allow source level single
// stepping of tight while() loop
__asm volatile ("nop");
}
return 0 ;
}