KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nano.h
Go to the documentation of this file.
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2012-2014 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  *
10  * File : nano.h
11  * Created : 19 nov. 2014
12  * Author : Vincent van Beveren
13  */
14 #ifndef DRV_WB_NANO_H_
15 #define DRV_WB_NANO_H_
16 
17 #include <stdbool.h>
18 #include <stdint.h>
19 #include "errorcode.h"
20 #include "kernel/err.h"
21 #include "lm32soc/dev_soc.h"
22 
23 /**
24  * @file
25  *
26  * @ingroup wbdrivers
27  *
28  * Nanobeacon driver.
29  */
30 
31 
32 /**
33  * Enumeration for nanobeacon enable states.
34  */
35 typedef enum {
36  nanoEnableNone = 0, //!< nanoEnableNone
37  nanoEnableCore = NANOB_ENABLE_CORE, //!< nanoEnableCore
38  nanoEnableStepUp = NANOB_ENABLE_STEP_UP, //!< nanoEnableStepUp
39  nanoEnableCoreAndStepUp = NANOB_ENABLE_CORE | NANOB_ENABLE_STEP_UP,//!< nanoEnableCoreAndStepUp
40 } NanoEnable;
41 
42 /**
43  * Configures the nano-beacon.
44  *
45  * @param delay The delay from the start of the second in 16ns ticks.
46  * @param period The period of the nano-beacon in 16ns ticks
47  * @param width The width of the nano-beacon pulse in 16ns ticks
48  * @param noOfPulses The number of pulses per PPS.
49  *
50  * @retval true Configuration succesful
51  * @retval false Configuration failed, check error module.
52  */
53 bool nanoConfig(uint32_t delay, uint32_t period, uint32_t width, uint32_t noOfPulses);
54 
55 
56 /**
57  * Configures the task to run if a pulse is done.
58  *
59  * @param taskId The taskID, or -1 to disable.
60  */
61 void nanoSetPulseDoneTask(int taskId);
62 
63 
64 /**
65  * Enable or disable the nano-beacon.
66  *
67  * @param enable true - Enable, false - disable.
68  */
69 static inline void nanoEnable(NanoEnable nanoEnable)
70 {
71  NANOB->ENABLE = nanoEnable;
72 }
73 
74 #endif /* DRV_WB_NANO_H_ */
void nanoSetPulseDoneTask(int taskId)
Configures the task to run if a pulse is done.
Definition: nano.c:34
bool nanoConfig(uint32_t delay, uint32_t period, uint32_t width, uint32_t noOfPulses)
Configures the nano-beacon.
Definition: nano.c:22
#define NANOB
Nano-Beacon device.
Definition: dev_soc.h:73
static void nanoEnable(NanoEnable nanoEnable)
Enable or disable the nano-beacon.
Definition: nano.h:69
nanoEnableStepUp
Definition: nano.h:38
Manages the global system error.
This module is responsible for distributing error codes.
NanoEnable
Enumeration for nanobeacon enable states.
Definition: nano.h:35
This file assigns all device structures to memory mapped structures.
nanoEnableCore
Definition: nano.h:37
nanoEnableNone
Definition: nano.h:36
nanoEnableCoreAndStepUp
Definition: nano.h:39