Repositório dedicado ao desenvolvimento do Módulo de Interface de Acionamento dos Sistemas Auxiliares de 2016.
zenitesolar / mi_sisaux2016 Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
// coding: utf-8
// -----------------------------------------------------------------------------
/** Set filters and masks.
*
// Group 0
MCP2515_FILTER(0), // Filter 0
MCP2515_FILTER(0), // Filter 1
// Group 1
MCP2515_FILTER(0), // Filter 2
MCP2515_FILTER(0), // Filter 3
MCP2515_FILTER(0), // Filter 4
MCP2515_FILTER(0), // Filter 5
MCP2515_FILTER(0), // Mask 0 (for group 0)
MCP2515_FILTER(0), // Mask 1 (for group 1)
If you want to receive ONLY 29 bit identifiers, set your filters
and masks as follows:
*
\code
uint8_t can_filter[] PROGMEM = {
// Group 0
MCP2515_FILTER_EXTENDED(0), // Filter 0
MCP2515_FILTER_EXTENDED(0), // Filter 1
// Group 1
MCP2515_FILTER_EXTENDED(0), // Filter 2
MCP2515_FILTER_EXTENDED(0), // Filter 3
MCP2515_FILTER_EXTENDED(0), // Filter 4
MCP2515_FILTER_EXTENDED(0), // Filter 5
MCP2515_FILTER_EXTENDED(0), // Mask 0 (for group 0)
MCP2515_FILTER_EXTENDED(0), // Mask 1 (for group 1)
};
\endcode
*
If you want to receive both 11 and 29 bit identifiers, set your filters
and masks as follows:
*/
const uint8_t can_filter[] PROGMEM =
{
// Group 0
MCP2515_FILTER(0), // Filter 0
MCP2515_FILTER(0), // Filter 1
// Group 1
MCP2515_FILTER_EXTENDED(0), // Filter 2
MCP2515_FILTER_EXTENDED(0), // Filter 3
MCP2515_FILTER_EXTENDED(0), // Filter 4
MCP2515_FILTER_EXTENDED(0), // Filter 5
MCP2515_FILTER(0), // Mask 0 (for group 0)
MCP2515_FILTER_EXTENDED(0), // Mask 1 (for group 1)
};
// You can receive 11 bit identifiers with either group 0 or 1.
// -----------------------------------------------------------------------------
// Main loop for receiving and sending messages.
int main(void)
{
typedef union estados_t{
struct {
unsigned char estBomba1 : 1;
unsigned char estBomba2 : 1;
unsigned char estMPPT : 1;
unsigned char estAux1 : 1;
unsigned char estAux2 : 1;
};
unsigned char todas;
} estados_t;
volatile estados_t estados;
// Initialize MCP2515
can_init(BITRATE_125_KBPS);
// Load filters and masks
can_static_filter(can_filter);
// Create a test messsage
can_t msg;
msg.id = 0x123;
msg.flags.rtr = 0;
msg.flags.extended = 0;
msg.length = 4;
msg.data[0] = 0xde;
msg.data[1] = 0xad;
msg.data[2] = 0xbe;
msg.data[3] = 0xef;
// Send the message
can_send_message(&msg);
while (1)
{
// Check if a new messag was received
if (can_check_message())
{
can_t msg;
// Try to read the message
if (can_get_message(&msg))
{
// If we received a message resend it with a different id
msg.id += 10;
// Send the new message
can_send_message(&msg);
}
}
}
return 0;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.