Skip to content
Snippets Groups Projects
Commit 0eca3bd6 authored by Jonathan BAUDIN's avatar Jonathan BAUDIN
Browse files

Use new IRQ functions

parent 3c6f9b55
No related branches found
No related tags found
No related merge requests found
...@@ -66,15 +66,25 @@ int Uart::read() ...@@ -66,15 +66,25 @@ int Uart::read()
return rxBuffer.read_char(); return rxBuffer.read_char();
} }
size_t Uart::write(uint8_t data) size_t Uart::write(const uint8_t data)
{ {
if(txBuffer.isFull()) sercom->writeDataUART(data);
return 0;
txBuffer.store_char(data);
return 1; return 1;
} }
size_t Uart::write(const char * data)
{
size_t writed = 0;
while(*data != '\0')
{
writed += write(*data);
++data;
}
return writed;
}
SercomNumberStopBit Uart::extractNbStopBit(uint8_t config) SercomNumberStopBit Uart::extractNbStopBit(uint8_t config)
{ {
switch(config & HARDSER_STOP_BIT_MASK) switch(config & HARDSER_STOP_BIT_MASK)
...@@ -124,4 +134,9 @@ SercomParityMode Uart::extractParity(uint8_t config) ...@@ -124,4 +134,9 @@ SercomParityMode Uart::extractParity(uint8_t config)
} }
} }
Uart Serial = Uart(SERCOM::sercom0); Uart Serial = Uart(SERCOM::sercom0);
\ No newline at end of file
void SERCOM0_Handler()
{
Serial.IrqHandler();
}
\ No newline at end of file
...@@ -19,7 +19,8 @@ class Uart : public HardwareSerial ...@@ -19,7 +19,8 @@ class Uart : public HardwareSerial
int peek(); int peek();
int read(); int read();
void flush(); void flush();
size_t write(const uint8_t c); size_t write(const uint8_t data);
size_t write(const char * data);
void IrqHandler(); void IrqHandler();
......
...@@ -347,9 +347,9 @@ void TwoWire::onService(void) ...@@ -347,9 +347,9 @@ void TwoWire::onService(void)
}*/ }*/
TwoWire Wire = TwoWire(SERCOM::sercom3); TwoWire Wire(SERCOM::sercom3);
void WIRE_ISR_HANDLER(void) { void SERCOM3_Handler(void) {
Wire.onService(); Wire.onService();
} }
......
...@@ -99,8 +99,6 @@ class TwoWire : public Stream { ...@@ -99,8 +99,6 @@ class TwoWire : public Stream {
//static const uint32_t XMIT_TIMEOUT = 100000; //static const uint32_t XMIT_TIMEOUT = 100000;
}; };
#if WIRE_INTERFACES_COUNT > 0
extern TwoWire Wire; extern TwoWire Wire;
#endif
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment