KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
acdc.h
Go to the documentation of this file.
1 /*
2  * KM3NeT CLB v2 Firmware
3  *
4  * Copyright 2015 KM3NeT Collaboration
5  *
6  * All Rights Reserved.
7  *
8  *
9  * File : acdc.h
10  * Created : 19 mar 2015
11  * Author : Riccardo Travaglini
12  */
13 #ifndef ACDC_H_
14 #define ACDC_H_
15 
16 /**
17  * @file
18  *
19  * @ingroup uartdrivers
20  *
21  * ACDC Uart driver (
22  */
23 
24 #include "stdbool.h"
25 #include "cfg_board.h"
26 #include "errorcode.h"
27 #include "drv/wb/suart.h"
28 
29 
30 
31 #define E_ACDC_TIMEOUT E_ACDC + 1 ///< Receive timeout
32 #define E_ACDC_TIMEOUT_DESCR "ACDC Response Timeout"
33 
34 
35 #define ACDC_BAUDRATE_DEFAULT SUART_BAUDRATE_9600 //!< Default Baudrate
36 
37 typedef struct {
38  uint8_t temp;
39  uint8_t volt;
40  uint8_t current;
41 }AcdcFrame;
42 
43 #define TSCALE 1
44 #define TOFF 0
45 #define VSCALE 1
46 #define VOFF 300
47 #define ISCALE 10
48 #define IOFF 0
49 
50 
51 /**
52  * Initializes the ACDC
53  *
54  * @param active= true if receiver has to be enabled , false if not
55  */
56 void acdcInit(bool active);
57 
58 
59 /**
60  * enables the ACDC rx
61  *
62  * @param ena= if true => start rx , otherwise it stops rx
63  */
64 void acdcEnable(bool ena);
65 
66 int acdcGetNFrames(AcdcFrame* framevect , int nRequested);
67 
68 static inline void acdcClearBuffer(){
69  __irqDisable();
70  bfClear(ACDC_UART->rxfifo);
71  __irqEnable();
72 }
73 
74 
75 
76 
77 #endif /* ACDC_H_ */
static void __irqEnable()
Enabled IRQ&#39;s on a global level.
Definition: lm32.h:75
static void __irqDisable()
Disables IRQ&#39;s on a global level.
Definition: lm32.h:62
White Rabbit Simple UART Driver.
void acdcEnable(bool ena)
enables the ACDC rx
Definition: acdc.c:58
static void bfClear(ByteFifo *const bf)
Clear the fifo.
Definition: bytefifo.h:106
void acdcInit(bool active)
Initializes the ACDC.
Definition: acdc.c:35
This module is responsible for distributing error codes.
Definition: acdc.h:37
Configures the board-specific peripherals, like I2C, SPI etc...